Author Topic: Escort directive becoming true/false  (Read 1420 times)

0 Members and 1 Guest are viewing this topic.

Escort directive becoming true/false
Hello, it's me again :) I'm stuck on a very specific topic.

I have a convoy, seven ships.
I have a KillCount Variable, becoming +1 when one of the seven convoy ships gets destroyed.
I have a JumpCount Variable, becoming +1 when one of the seven convoy ships jumps out (jump out when distance smaller than 500m to a jumpgate).

I want to make a directive that becomes a success (blue) when at least 4 of the ships have jumped out and becomes a failure (red) when at least 4 ships have been destroyed...

But I can't manage to create one. Any ideas? Something like if then else or so? But that didn't work for me...

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Escort directive becoming true/false
Since you have 7 ships and 4 must either escape or be destroyed, why are you using variables at all? has-departed-delay will take care of all of that for you internally. If 4 ships have been destroyed it will know that the SEXP can't ever come true and mark the directive as failed.

There are some cases where you do need variables to do this sort of thing, but this isn't one of them. :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Escort directive becoming true/false
Sorry but that's not working. If I put the 7 ships under has-departed-delay, it becomes red the very moment the first ship goes down... Or am I not getting your thoughts?

I tried the percent-ships-departed and set the threshold to 50 % (which should work), it still doesn't turn red when 4 transports go down.
« Last Edit: January 18, 2017, 09:09:16 am by bomb3rman »

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Escort directive becoming true/false
Sorry, I meant percentage departed and I'm surprised that didn't work. I'll have a look at the code in a bit and see where I went wrong.

But if you do want to use variables in the meanwhile the easiest method is to simply have two events which comes true when KillCount and JumpCount become 4 and then test for those events in the directive.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Escort directive becoming true/false
The variant with the 2 events that become true when KillCount and JumpCount become 4 works fine. It's ok for the "Protect Convoy" order which is fullfilled if 4 freighters have jumped out. But with the KillCount, it's the opposite of what I want. I want the directive to be failed (red) if KillCount reaches 4. I don't know how to deal with this problem. But If I use a counter like KillCount and say "true if less than 4" it becomes true at the beginning because the counter starts at 0.

I wanted to check a second condition like "KillCount below 4 AND has time elapsed" to stop the directive from becoming true at the beginning. But now she doesn't become true (or false) at all... I think I don't know anymore options.

I might just let the "Protect at least 4 ships" directive out and just tell you to to this in the briefing room...

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Escort directive becoming true/false
When
-and
-- not
--- is-event-true-delay
---- Killcount
-- is-event-incomplete
--- killcount
-- is-event-true
--- Jumpcount


Should work. You will need to set the optional true / false argument to the event-true-delay SEXPs in order to make the directive appear though. If you don't, the directive will only appear when it actually I complete.

I actually should FRED it is check but I'm not my phone at the moment.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Escort directive becoming true/false
Working  :yes: :yes: :yes:

Thank you for that, now I know how to use this goddamn directive as I wanted it :)

Still strange though, that the percentage-departed doesn't work...

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Escort directive becoming true/false
Like I said, I'll look at the code when I get a chance, cause it should work.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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