Author Topic: More sexp trouble  (Read 1403 times)

0 Members and 1 Guest are viewing this topic.

Offline ReeNoiP

  • 27
  • I FRED
I am trying to script the following: When the player enters a jumpnode he gets a training message telling him he is in range. The player now has the option to press 1 which will immobilize his ship for 20 sec (a directive with help text should explain this). If the player leaves the node without pressing 1, the training message should reappear once he reenter the node, but if he pressed one it should not appear again.

What I have tried is using three events.
event 1 repeat 999999
when
 -and
 --is event incomplete event 2
 --<
 ---distance alpha 1- waypoint 1
 ---300
 -training message

event 2 chained to event 1 and contains the directive
when
 -key pressed
 --1
 -player use ai
 -ad goal
 --ai play dead - Alpha 1

event 3 chained to event 2
when
-is event true delay
 --event 2
 --20
-player not use ai
-training msg

The message telling me I am in the right place appear as it should, and when I press 1 the directive becomes complete. The ai never takes over (or it is for such a short while that I is not noticed), and I get the message from the last event. After this the message from event 1 still appear when I am in the node.

It seems like the 20 sec. delay is not working and event 2 is not marked as complete, but I can't figure out why.
Uncharted Territory is released. But I still need voice actors

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
I don't have time for a full answer but the solution to this is to use variables rather than checking the state of events or using chains. You should never make a chained event repeat unless you know exactly what you are expecting it to do, cause the behaviour is rather unexpected.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline ReeNoiP

  • 27
  • I FRED
Thanks for the tip of using variables. I got it working now, and the method solved a number of other problems I was having. The only thing I could not fix, was that the play dead sexp activates as soon as the player gets within range if he presses 1 before entering the node. Of cause this come from the key-pressed condition being true, but I don't really see a way around it.
Uncharted Territory is released. But I still need voice actors

  

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Use key-reset right before the player enters range?