Author Topic: Choosing/ignoring an event  (Read 3366 times)

0 Members and 1 Guest are viewing this topic.

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Choosing/ignoring an event
Hello,

I have a small problem (again :) ) and honestly, I'm to lazy to figure it out in hours of painful trying (I always have to play 10 minutes before I reach the part where I need to test).

That's the situation :

I have a training exercise where the player is told to attack a bigger ship. He wins, when he reduces the enemies hitpoints to 95 %, but he looses when he has his own shield-strength reduced to more than 50%.

Player wins plays Event/Message A, Player looses plays Event/Message B.

Now my problem is, that I very often get the situation that I fire the enemy down to 95% and the winning-messages is played, and while that happens the last laserbolt that is still flying towards me, hit my shields and I "loose" ( because I reached the 50% shieldstrength in that very moment). It is interesting how often this happens (in either one way or the other).

So my question is, how can I script it in a simple way that once one condition is met, the other will be completly ignored ? I suppose it has something to do with the "not" condition (that's what Goober told me a while back), but sofar it isn't working the way I want it.

I would appreciate any advice :)

Starman©
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
Choosing/ignoring an event
have event one (the win one) be true ONLY if event 2 (the lose one) is incomplete. Then do the same for the other, but swapped. That way, only one can possibly become true.
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Choosing/ignoring an event
and
-[event]
-not
--is-event-true
---[event2]
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
Choosing/ignoring an event
that won't work, because its incomplete untill it is true or false, which will trigger immediately...
use:

Code: [Select]

Win event:
and
-[win condition]
-is-event-incomplete
--[lose event]

Lose event:
and
-[lose condition]
-is-event-incomplete
--[win event]
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Choosing/ignoring an event
An incomplete event would register as not being true but it still has to wait for the other trigger SEXP to occur so TopAce's suggestion should work.

I prefer the way Hippo did it though (In fact I gave out an almost identical solution to a different problem yesterday).

But it does have an inherent danger in it though which you should watch out for.

If you do
Code: [Select]
Win event:
and
-[win condition]
-is-event-incomplete
--[lose event]

Lose event:
and
-[lose condition]
-is-event-incomplete
--[win event]


Then you have to be careful that neither event can ever be false. If that happens then neither event can come true (This may be exactly what you want though).

You should be fine using it here but if the events depend on a  certain ship being alive in one case and not in the other then you have an inherent danger in the fact that the destruction of the ship would prevent both events from working.

TopAce's suggestion doesn't carry the same danger.
« Last Edit: June 11, 2005, 02:34:00 pm by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
Choosing/ignoring an event
*re reads*

Hm... I read TopAce's one wrong the first time :p... Mine won't work though, if theres a way for either event to become false...

EDIT: Heh... Nice edit timing kara... ;)
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Choosing/ignoring an event
Yeah. :) And then I made a second edit and made it look I edited it after you :D
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Choosing/ignoring an event
TopAce's solution is best.  It covers all possibilities. :)

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
Choosing/ignoring an event
Well, either works, thugh they both behave slightly differently, so it depends on what the nescessity is. :nod:
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Choosing/ignoring an event
Hm, thanks for the comments guys, but I'm still not sure I got it (maybe it's already to late for me :) ) I have to write that a little more detailed.

1) Event (Victory)

true
___hitpoints left
___corvette
___95


2) Event (loose)

true
__shield quad low
__alpha 1
__50

( I made a "corvette invincible" in this event before, two avoid the error at least in one way)

3) New Event (according to Topace's suggestion)

and
-[Event(Victory)]
-not
--is-event-true
---[Event(loose)]
------send message
------Message 1 (Victory)

4) Another new Event according to Topace, but this time for the opposite effect

and
-[Event(loose)]
-not
--is-event-true
---[Event(victory)]
------send message
------Message 2 (loose)


Is that the way you want to explain here ? (Btw, there is not a danger of the corvette getting destroyed, so if that's any problem...)
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Choosing/ignoring an event
No need to have 4 events. You can do this in 2.

Victory
-when
--and
---hitpoints left
----corvette
----95
---not
----is-event-true-delay
----lose
----0

and


Lose
-when
--and
---Shield quad low
----alpha 1
----50
---not
----is-event-true-delay
----Victory
----0
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
Choosing/ignoring an event
you know... not that its hard or anything, but i just realised that its even easier to build the event in fred, and copy it from the file... (easier as in, you're not going to forget a part of the event (like a number))... Meh... :p
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Choosing/ignoring an event
O.K, now I did it this way :



I have to test it now of course, I hope I can reproduce the situation where both actions (win and loose) come true the same time, that's not so easy.

However, I still don't see why this kind of event will prevent the second event from executing just by using the "not" command. Is it really prevented for all time then? What happens when the flying laserbolt hit me 1 second after the win-event is true, and I loose. Must they be chained or something ?
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Choosing/ignoring an event
It's really prevented.  There's absolutely no way both events can come true.

They shouldn't be chained... chaining makes it not work.

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
Choosing/ignoring an event
o.K. Btw, sofar the test-results look good too. :)

Thanks again for your help friends.
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Choosing/ignoring an event
Quote
Originally posted by Starman01
However, I still don't see why this kind of event will prevent the second event from executing just by using the "not" command. Is it really prevented for all time then? What happens when the flying laserbolt hit me 1 second after the win-event is true, and I loose. Must they be chained or something ?


The game is only ever checking one event at a time. As soon as one of those two events becomes true the other one never can.

If both events come true in precisely the same millisecond then it is possible that either one can play but even then only one of them will occur because when the computer then tries to evaluate the second one it will find that it no longer evaluates to true.

The game checks the list of SEXPs more than 20-30 times a second though so even that is an unlikely possibility.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Hippo

  • Darth water-horse
  • 211
  • Grazing.
    • All Hands to War
Choosing/ignoring an event
unless they were triggered by the same thing...
VBB Survivor -- 387 Posts -- July 3 2001 - April 12 2002
VWBB Survivor -- 100 Posts -- July 10 2002 - July 10 2004

AHTW

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Choosing/ignoring an event
I've never actually run a test to see which event would trigger first if two events have the same trigger. :) If I get bored later I might give it a try :)

I suspect that you would always see the first one on the list trigger but it depends on how the game processes the events list.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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