Author Topic: The "facing" SEXP and other problems  (Read 3685 times)

0 Members and 1 Guest are viewing this topic.

Offline Slasher

  • 29
The "facing" SEXP and other problems
In this hypothetical mission there is Target and the player.

I want to arrange things so that whenever the player is looking directly at Target, Target is tagged.  Whenever the player is looking away from Target, Target no longer shows up as tagged.

However, after having been facing Target for a given number of seconds straight, Target is motivated to do something.  Something = Anything.

If the player looks away from Target (not tagged), then things reset, so to speak.  I've gotten as far as the first part, now I just need to get Target to do Something. 



 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
Ok...

Use every-time, ship-tag and ship-untag.

As for the number of seconds, use a variable.

---------------------

every-time

not

facing
Player
Target

modify-variable
NumberOfSeconds
0

----------------------------

when (high repeat count, interval time 1 second)

facing
Player
Target

modify-variable
NumberOfSeconds
+
  NumberOfSeconds
  1

--------------------------------

when

= / >

NumberOfSeconds
<insert value>

do-something

:)
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
Thanks Mobius, so far this seems to work.

Now, if there were forty Targets instead of one.  What would be the least work intensive way of making this work.  For example, if facing Target 22 for a while, Target 22 will do this. 

Also, is there any way to force every-time to evaluate only once every second, or specify a delay of any kind for this SEXP? 

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
Depends...uhm...

Are you going to pick up a random Target? In that case a random argument will greatly reduce the work. can you please be more specific? What do you want to do, exactly?
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
When facing Target X for Y seconds, Target X should go kill something.  But after Target X goes off to do this, success or failure, Target X will revert to his docile state after Z seconds. 

Basically I want the player to be able to invoke this behavior in Target X as many times in a mission as s/he wishes.  The effect will always wear off, but can be reintroduced upon Target X at the player's leisure. 

Say Target X goes hostile against Target A.  Target X doesn't do a good job and Target A is still alive.  Player looks at Target X again to get the ball rolling. 

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
I can get the target to revert to its original state, it's just imbuing the target with the desire to move again, to repeat those results, that's proving problematic right now.

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
Ok, got it. You know, I think to be good at FREDding  :drevil:

If there are many Targets and you want to pick up a random one, create a string variable and use:

when-argument

random-of

<arguments>

<insert condition>

modify-variable
SpecialTarget
 <argument>

And replace the variable when necessary.

As for the rest...

I use string variables to set certain conditions, like "sensors jammed"(<condition to send the message> and variable Communications set to <Ok/Possible> to make the message appear...the variable becomes "NotOk/NotPossible" when an AWACS calibrates its jammers...no messages are sent in that case)

every-time

or

-and

--not
facing
Player
Target

--string-equals
StatusCheckTarget (this is a string variable)
NotActive (=sample of string the variable can be set to)

- =
NumberOfSeconds
<value3> (this is number of seconds 3, obviously greater than 1 and 2. It's equal to value2+1)


modify-variable
NumberOfSeconds
0

----------------------------------

When you activate the target use:

modify-variable
StatusCheckTarget
Active

----------------------------------

The variable NumberOfSeconds should always keep increasing(the event above will reset it to 0 when needed)

when (highest repeat count, interval time 1 second)

-or

--and
---facing
Player
Target

---not
NumberOfSeconds
>
value1-1


--string-equals
StatusCheckTarget
Active


modify-variable
NumberOfSeconds
+
  NumberOfSeconds
  1

----------------------------------

every-time

=
NumberOfSeconds
<value3> (obviously: value1 < value 2 < value3. value3 is value2+1)


modify-variable
StatusCheckTarget
NotActive

clear-goals (or whatever you want to reset the Target. You may wish to move it back to its precedent position, use waypoints-once for that...you can tell it to ignore its target and many other things)


Please tell me if it works  :nervous:
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
EDIT: Most of this has been rendered irrelevant now, see two posts down.

I have a new problem.  I can't define the second argument for the change-iff SEXP as a variable, specifically a string variable.  I tried to strong arm my way around this by editing it in via WordPad, but now the game crashes.  I'm not sure how to proceed.
« Last Edit: March 27, 2008, 09:23:09 am by Slasher »

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
EDIT: Most of this has been rendered irrelevant now, see next post down.

Sorry to keep convoluting this further, hopefully the madness will stop here. 

If I want to "convert" one target, as it were, and then immediately convert another, and I want the effect to run on its own clock for each individual target, how could I do this without a handful of events and variables for each ship?

For example, if Target A is converted, then two seconds later I convert Target B, Target A should revert back to its original state two seconds before Target B.  I don't want Target A, Target B....Target Z all reverting back at the same moment.

[edit]:  Okay, I'm pretty sure now there is no really short way of doing this.  In order to get what I want, each individual ship would need its own timer (variable) to keep track of how long it has been friendly. 

I could use a single event to reset each fighter to hostile as its timer gets to a set value, but each ship would require its own variable (value set at mission-time that it became friendly) and thus each eligible ship requires its own event. 

FRED2 does not want to let me define the arguments for any-of as number variables.  WordPad allows me to circumvent this problem for the time being, however.

Still working on this...

[shadow edit2!]:  Okay, FRED2 also does not like me using <argument> in the modify-variable SEXP.  If all arguments of any-of are number variables, or for that matter any variable, will using the arguments to any-of for modify-variable cause bad things to happen? 
« Last Edit: March 27, 2008, 09:23:24 am by Slasher »

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
Yes, I think being unable to use number variables as arguments to any-of (and similar SEXPs, I'd assume) is causing the problem here.



Variables Neon1 et al. are given a value of whatever the mission time is when they have been in the player's view for a certain amount of time.  These are all defined in other events.  I wish it didn't take that many events, but I haven't come up with a better solution. 

Now, the editor didn't let me use those variables as arguments to any-of, so I had to edit them in using WordPad.  As such, when it came time to reset any of those variables to zero using modify-variable, FRED2 wouldn't let me specify "<argument>" as the variable to be modified.  Again, I WordPadded it into the mission.  This doesn't seem to work as it should in-game, however, and while it could be due to any number of causes, I believe this is the culprit.

Is there any way around this?
« Last Edit: March 27, 2008, 09:25:16 am by Slasher »

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
I tried using the 3-23-2008 build of FRED2 which I think was the latest to see if maybe the older version I was using was the problem.  No-go there either.  Is this an oversight I should put into Mantis or was there a reason to not let number variables be referenced in the xxxx-argument SEXPs?

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
How do you place variables?

I right click on "string" and select "replace variable".

I can't replace a variable with <argument> when using modify-variable either. I suggest creating another variable and use:

modify-variable
NewVariable
<argument>

...then use "NewVariable" for future references :)


In your face, N00ber. Looks like I can give more than colors :P
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
In other words, use a new variable and set its value as whatever the real variable I'm trying to modify is? 

The problem is there are any number of "timer" variables that may need to be reset to zero at a given time.  It might be zero variables, it might be one, it might be fifty (not likely, just an example).  When a certain criteria is met, a ship's timer variable is given a value of whatever the mission time is at that moment.  This is defined in a separate event for each ship.  The event I show above will check all the time to see if the values of those variables is greater than 15 + the mission time.  If it is, it resets them to zero.  At least, this is how it should work, but every-time-argument and any-of hate my guts.

Basically, each ship timer should work completely independently of another.  In other words, if I start the timer running on one, it should get its full fifteen seconds regardless of whether or not another ship's fifteen seconds is almost up.  If they all reset to zero at once, this doesn't work.

I know this is still doable, it'll just require an extra event for each eligible ship so long as the argument and any-of SEXPs remain b0rked.  :/

Mobius, I can't thank you enough for sticking through all that.  Even though I didn't come to the solution I wanted, you did help me come to a solution and eliminate the unworkable alternatives.  Don't ever let anyone tell you you're good for just colors!  :) :yes:

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
You could use the string variable I mentioned above for that. When it becomes Active/NotActive, thanks to one of the events posted above, the timer will be easily set to 0.

You should be able to store the values in variables for every single target...you might wish to create a new series of variables and add the SEXP modify-variable again to store an "absolute value". I hope you're not going to have 50 targets(lol), everything should be easy to handle with a reasonable number of targets...

I'd suggest you to create a new series of variables and name them properly(so that you can't risk confusion) :)
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Slasher

  • 29
Re: The "facing" SEXP and other problems
Yeah, that's the conclusion I came to.  It would just require a lot more events that I wanted, but you have to work within the confines of the engine I guess.

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
I'd like to see the results ;)
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Re: The "facing" SEXP and other problems
This needs to go into Karajorma's FAQ under Fred Gymnastics. :jaw:
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
Lol...

This will hopefully be useful should I want to join a team as FREDder :nervous: :D
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Snail

  • SC 5
  • 214
  • Posts: ☂
Re: The "facing" SEXP and other problems
150kb missions :wtf:

  

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: The "facing" SEXP and other problems
De Gustibus Non Disputandum Est.
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]