Author Topic: How do I use the every-time SEXP?  (Read 1975 times)

0 Members and 1 Guest are viewing this topic.

Offline SF-Junky

  • 29
  • Bread can mold, what can you do?
How do I use the every-time SEXP?
Hey there.

I have the following situation: The player must escort a vessel and is supposed to stay within 2500 meters. Now if the player moves away from said vessel more than 2500 meters AND another event (let's call it "free to go") has not tbeen triggered, I want the game to always send a single warning message. If the player doesn't return to a distance smaller than 2500 meters within 10 seconds, the end-mission SEXP shall be triggered.

How do I do that?

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: How do I use the every-time SEXP?
You'll probably need to use a variable with mission-time sexp. You shouldn't need every-time for this. Just a when with a high trigger count.

EDIT: Ok, now I've got time to sit and think about this. Here's probably what you want. (Note: not tested, just whipped up off the top of my head.)

Create a variable, I'm calling it TIMEVARIABLE here. Give it a really high numeric value.

Code: [Select]
when (high trigger count, delay=1)
-and
-->
---distance (alpha-escort)
---2500
--not
---is-event-true-delay
----free to go
--is-event-true-delay
---start escort
-send-random-message (or whatever you want to do)
--"Get back here in 10 seconds or the world ends!"
-set-variable
---TIMEVARIABLE = mission-time

when (high trigger count, delay=1)
-and
-->
---distance (alpha-escort)
---2500
--not
---is-event-true-delay
----free to go
--is-event-true-delay
---start escort
-->=
---mission-time
---TIMEVARIABLE + 10
-end-mission

I think that will do it... but I've got a splitting headache and I haven't tested it.
« Last Edit: November 25, 2012, 12:46:21 pm by mjn.mixael »
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: How do I use the every-time SEXP?
That's gonna send a 'get back here!' message every ten seconds, but that should be easy to prevent.

 

Offline SF-Junky

  • 29
  • Bread can mold, what can you do?
Re: How do I use the every-time SEXP?
This is working. But Battuta is right, the message is sent every second. Guess I gonna need a third SEXP there.
« Last Edit: November 30, 2012, 03:10:24 am by SF-Junky »

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: How do I use the every-time SEXP?
Not at all. You'll just need to get a little fancy with this one.  :) I've got to run to work but remind me to give you some pointers.

 

Offline SF-Junky

  • 29
  • Bread can mold, what can you do?
Re: How do I use the every-time SEXP?
I already found a solution: I replaced the command message with a notification by the board computer (training msg) which makes sense to be displayed all the time. :p

  

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: How do I use the every-time SEXP?
That works. Personally, I think training messages are ugly and that learning is good. Bonus points if you can create a flashing HUD gauge instead. (Though you'll need a third SEXP to disable it when the player moves back within range.)

As for getting the event to not run continually (again, for learning), you could possibly use another variable to keep track of where you are in the event chain. Something like this, perhaps. Actually, this would still need a third event, so perhaps Battuta's solution is better.

TRACKVARIABLE = is innitialized to 0

Code: [Select]
when (high trigger count, delay=1)
-and
-->
---distance (alpha-escort)
---2500
--not
---is-event-true-delay
----free to go
--is-event-true-delay
---start escort
--==
---TRACKVARIABLE
---0
-send-random-message (or whatever you want to do)
--"Get back here in 10 seconds or the world ends!"
-set-variable
---TIMEVARIABLE = mission-time
-set-variable
---TRACKVARIABLE = 1

when (high trigger count, delay=1)
-and
-->
---distance (alpha-escort)
---2500
--==
---TRACKVARIABLE
---1
--not
---is-event-true-delay
----free to go
--is-event-true-delay
---start escort
-->=
---mission-time
---TIMEVARIABLE + 10
-end-mission

when (high trigger count, delay=1)
-and
--<
---distance (alpha-escort)
---2500
--not
---is-event-true-delay
----free to go
--is-event-true-delay
---start escort
--==
---TRACKVARIABLE
---1
-set-variable
---TRACKVARIABLE = 0
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.