Author Topic: How do I into having a SEXP involving resetting the SEXP's critera when it fires  (Read 1734 times)

0 Members and 1 Guest are viewing this topic.

Offline aeon48m

  • 26
  • Trying to make SGWP3
    • Minecraft
How do I into having a SEXP involving resetting the SEXP's critera when it fires
So, dilemma. I have a mission in the works. Said mission requires me to make a SEXP that:

Fires when a certain ship has a certain order
Protects all of a group of ships
Resets the orders of said certain ship
Sends a message
Unprotects a certain ship
And repeats itself when said certain ship gets said certain order again?

I have tried solutions involving arguments, variables, and some other solutions, but so far I haven't managed to find a way that does all of the above, only fires once per time you give said order, and doesn't repeat the message 99 times.
"Hell, ultra-AAA's are more powerfull than the sgreen, but then again, those are meant ot literaly sodemise fighters with their long powerfull shaft."

 

Offline Black Wolf

  • Twisted Infinities
  • 212
  • Hey! You! Get off-a my cloud!
    • Visit the TI homepage!
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
Are you using trigger count or repeat count? I think that may be relevant here. Try trigger if you're not already using it. But for more help, we'll need more detail. Can you post a screenshot of the expanded sexp?
TWISTED INFINITIES · SECTORGAME· FRONTLINES
Rarely Updated P3D.
Burn the heretic who killed F2S! Burn him, burn him!!- GalEmp

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
From what I see here, your SEXP is fairly straightfoward. When ai-order is X, do Y, Z, ETC. The protecting, resetting of orders, sending messages, and unprotecting are all pretty easy. For repeating, you need to simply give it a trigger count higher than 1.

Unfortunately, there's no good way to check when a ship receives specific orders. (I'm assuming this is your problem) What order are you checking for? How is the order given? If the order is give in other sexps, you can set a bit-variable and use that to trigger this sexp. If you are checking for other types of orders, like player orders.. things get much more hairy. The best you can do is check for the symptoms of that ai-order.
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 aeon48m

  • 26
  • Trying to make SGWP3
    • Minecraft
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
Are you using trigger count or repeat count? I think that may be relevant here. Try trigger if you're not already using it. But for more help, we'll need more detail. Can you post a screenshot of the expanded sexp?
I am using trigger count set to 99, and here's my current setup. I have had previous setups, but the problem with those setups is that they either only worked once, only worked once and sent 99 messages every time, and only worked once, sent 99 messages every time, and took 3 SEXPs and 2 variables per ship.

My current setup simply unprotects everything and doesn't work, but gets it condensed into one SEXP, which is not really that important.


(Oh, yeah, and the thing in the not is-destroyed-delay box which I forgot to expand was <argument>.)
From what I see here, your SEXP is fairly straightfoward. When ai-order is X, do Y, Z, ETC. The protecting, resetting of orders, sending messages, and unprotecting are all pretty easy. For repeating, you need to simply give it a trigger count higher than 1.

Unfortunately, there's no good way to check when a ship receives specific orders. (I'm assuming this is your problem) What order are you checking for? How is the order given? If the order is give in other sexps, you can set a bit-variable and use that to trigger this sexp. If you are checking for other types of orders, like player orders.. things get much more hairy. The best you can do is check for the symptoms of that ai-order.
Actually, my problem is getting it to repeat every time it has a certain order, stopping it from firing 99 times once it has gotten the order, allowing it to fire again, and not sending the message 99 times.

And the setup is that the player needs to give the order which is to attack a certain ship, thus fulfilling the query-orders, and unprotecting that ship so that everything only shoots at that.

Edit: And yes, there is a SEXP that resets the orders of the ship that must be ordered to attack the other ships whenever it gets an ai-chase order, which is the only order it can receive.
"Hell, ultra-AAA's are more powerfull than the sgreen, but then again, those are meant ot literaly sodemise fighters with their long powerfull shaft."

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
Oh derp, I forgot about query-orders... I should opened FRED before responding.
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 Axem

  • 211
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
I think you're so very close to getting it to work, there's just one little change you need to make.

In your setup you have your query orders, your third argument is zero.

Code: [Select]
3: Maximum length of time since order was given. Use 0 for any time in the mission.
This certainly explains why its constantly firing, you gave the order once and since it will look at any time in that regard, its now valid all the time. Try making that argument a 1 or 2 so the sexp will then ask "was attack my target given in the last few seconds?" instead of "was attack my target given at all?"

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
Yep, was just typing what Axem said.

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: How do I into having a SEXP involving resetting the SEXP's critera when it fires
If that fails, the reset-order SEXP will clear the list of orders that have been given without actually affecting the AI in any way. But Axem's solution really should be enough.

Oh derp, I forgot about query-orders... I should opened FRED before responding.

Hey, I sometimes forget about non-retail SEXPs too. Occasionally ones I added. :p
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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