Author Topic: A SEXP tree doesn't work, but it should  (Read 3454 times)

0 Members and 1 Guest are viewing this topic.

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
A SEXP tree doesn't work, but it should
I've got a mission which involves two Terran cruisers fighting each other at start. This fight gets interrupted by two Vasudan cruisers, and the warring Terran cruisers agree to a cease-fire and engage the Vasudans. They prevail, but the cruiser which comes out from the mission in a better shape will break the cease-fire and blow the other to bits.

I need two events for this: One that comes true if Cruiser #1 has more hitpoints left, the other if it's Cruiser #2. Then, through is-event-true-delay, some more events will come true that makes sure that the breaker of the cease-fire will eventually emerge victorious.

And here's the SEXP tree that should theoretically work, but it doesn't.
Code: [Select]
Cruiser 1 wins
-and
--is-destroyed-delay
---Vasudan cruisers
---0
-->
---hits-left
----Cruiser 1
---hits-left
----Cruiser 2

I figured out that (through temporarily making a directive to it) if I destroy my own cruiser (Cruiser 1), the event will return false. However, in every other scenario, it remains incomplete.

I also tried and-in-sequence, but it doesn't even display the directive.

Can anyone help?
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 dragonsniper

  • 29
  • Master of the Irrelevant
    • Steam
Re: A SEXP tree doesn't work, but it should
Would this by chance work...?

Code: [Select]
-and
--is-destroyed-delay
---Vasudan cruisers
----0
-and
-->
---hits-left
----Cruiser 1
-not
-->
---hits-left
----Cruiser 2

I'm looking at this one and am kinda doubting it, but maybe it'll work... unless it's not what you want at all.
Do or do not, there is no try...
~HLP Member and Modder~
          ~~2008-201x~~

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: A SEXP tree doesn't work, but it should
This one comes true no matter which cruiser emerges victorious.
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 dragonsniper

  • 29
  • Master of the Irrelevant
    • Steam
Re: A SEXP tree doesn't work, but it should
Is it possible that replacing the second "and" with an "or" instead might fix it?
Do or do not, there is no try...
~HLP Member and Modder~
          ~~2008-201x~~

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: A SEXP tree doesn't work, but it should
No, it doesn't.
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 dragonsniper

  • 29
  • Master of the Irrelevant
    • Steam
Re: A SEXP tree doesn't work, but it should
Ok. I'll take a look in FRED, and see if I can pull anything up...
Do or do not, there is no try...
~HLP Member and Modder~
          ~~2008-201x~~

 

Offline Shade

  • 211
Re: A SEXP tree doesn't work, but it should
Too tired to think straight at the moment, so I'm probably missing something important... but aren't you missing a 'when'?
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline dragonsniper

  • 29
  • Master of the Irrelevant
    • Steam
Re: A SEXP tree doesn't work, but it should
His when would obviously be at the beginning of it all... atleast I hope it is.
Do or do not, there is no try...
~HLP Member and Modder~
          ~~2008-201x~~

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: A SEXP tree doesn't work, but it should
It's there. I was assuming people take that for granted.
« Last Edit: April 17, 2010, 11:45:44 am by TopAce »
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 dragonsniper

  • 29
  • Master of the Irrelevant
    • Steam
Re: A SEXP tree doesn't work, but it should
What about this?

Code: [Select]
-and
--is-destroyed-delay
---Vasudan Cruisers
----0
-and
-->
---hits-left
----Cruiser 1
-----(hits left value)
-and
--<
---hits-left
----Cruiser 2
-----(hits left value)

Do or do not, there is no try...
~HLP Member and Modder~
          ~~2008-201x~~

 

Offline Shade

  • 211
Re: A SEXP tree doesn't work, but it should
With FRED, I never take anything for granted :p Accidentally replacing the when with something else is something I've done more than a few times.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
Re: A SEXP tree doesn't work, but it should
I don't understand what is not working, is it that you can't get your directive showing properly or that your cruisers do not engage each other?
el hombre vicio...

 

Offline Shade

  • 211
Re: A SEXP tree doesn't work, but it should
Oh! I *was* missing something. You said you're using is-event-true-delay. Given that, it's quite possible that FRED is smart enough to say "Ok, so Cruiser 1's hits are lower than Cruiser 2's right now, but that may change later. Lets just trigger the event but leave it as incomplete in case he wants to play with it later". So, try using the conditions in this event as part of the triggers for the following event and cut out the is-event-true-delay, and see if that works.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: A SEXP tree doesn't work, but it should
I had to use variables, but I got it working. Thanks for the tips, anyway. :yes:

I don't understand what is not working, is it that you can't get your directive showing properly or that your cruisers do not engage each other?

I needed directives to keep track of the events' states. If the event turns true, the directive turns true.
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 Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: A SEXP tree doesn't work, but it should
Keeping track of the event states is usually better done with messages.  It's generally a good idea to make directive events separate from logic events, unless the event is extremely simple.

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: A SEXP tree doesn't work, but it should
I had a message, too.
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 karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: A SEXP tree doesn't work, but it should
The problem here is that if the ship is already destroyed hits-left won't return zero. Instead it returns SEXP_NAN_FOREVER i.e Not A Number.

You should include

-not
--is-destroyed
---Cruiser 1

-not
--is-destroyed
---Cruiser 2

to make the event work.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Shade

  • 211
Re: A SEXP tree doesn't work, but it should
Knowing you, you're probably almost certainly right, but even so l can't see how that can be the problem given that TopAce specified that none of the cruisers are destroyed at the time this event should run - Rather, the event is used to determine which is going to be destroyed later.

[Edit] Or do you mean the problem is that even after triggering, the event will remain as incomplete due to this? That actually wouldn't surprise me, although it isn't something I would have caught even when mostly awake.
« Last Edit: April 17, 2010, 11:00:18 pm by Shade »
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: A SEXP tree doesn't work, but it should
Ah, I misread the problem and thought the issue was if one of the cruisers was destroyed before the event can trigger.

In that case I'm also somewhat mystified as to why this isn't working.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: A SEXP tree doesn't work, but it should
In that case I'm also somewhat mystified as to why this isn't working.

Me too. Logically, it should work. It's surprising that you need variables as a workaround, which work the same way in the event as hits-left.

And I also needed to use the + operator just to be able to use the variable. The "Replace Variable" option was greyed out. For reference, here's the tree that works now:



Mekhu is the Vasudan cruiser wing (2 ships), the friendly cruiser is the Privateer and the hostile Terran cruiser is the Edward. I also needed to take into consideration the outcome of both cruisers having the same hull percentage, hence the = operator.
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.