Author Topic: Use Cloaking device as long as primary doesn't fire  (Read 2001 times)

0 Members and 1 Guest are viewing this topic.

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Use Cloaking device as long as primary doesn't fire
Well,

I got the SEXP working on AI. However, for unknown reason, the mission crash after several minutes.
I use "Every-time" sexp to engage cloak and decloak. I'm suspecting the "every time" sexp conditional to be the cause of this behavior. If so, how to add some sort of permanent cloak as long as the AI ship doesn't open fire ?

Here, the mission file. Don't forget to open the file with notepad to replace ship by Freespace 2 one.
 

[attachment deleted by ninja]

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Use Cloaking device as long as primary doesn't fire
I haven't looked at the mission yet, but try this.

Quote
When-Argument (trigger count 999999999999999999999999999999999999999999999999 and interval 0)
  • any-of
    • list of ships
  • or
    • has-primary-fired
      • <argument>
      • 0
      • 50
    • has-primary-fired
      • <argument>
      • 1
      • 50
    • decloak sexp
      • <arguemnt>

When-Argument (trigger count 999999999999999999999999999999999999999999999999 and interval 0)
  • any-of
    • list of ships
  • or
    • not
      • has-primary-fired
        • <argument>
        • 0
        • 7000
    • not
      • has-primary-fired
        • <argument>
        • 1
        • 7000
    • cloak sexp
      • <arguemnt>

No idea if this will work as I just wrote it real quick here.. but worth a shot?
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 MetalDestroyer

  • Starwars reborn!
  • 210
Re: Use Cloaking device as long as primary doesn't fire
The AI doesn't cloak at all. Perhaps, I mess somewhere since I really don't know how to use the value of "any-of" sexp operator

Code: [Select]
$Formula: ( when-argument
   ( any-of "Alpha 2" "Alpha 3" )
   ( not
      ( primary-fired-since
         "<argument>"
         0
         6000
      )
   )
   ( ship-effect
      "Cloak"
      2800
      "<argument>"
   )
   ( ship-stealthy "<argument>" )
)
+Name: AI Cloak
+Repeat Count: 1
+Trigger Count: 999999
+Interval: 0

$Formula: ( when-argument
   ( any-of "Alpha 2" "Alpha 3" )
   ( primary-fired-since
      "<argument>"
      0
      50
   )
   ( ship-effect
      "Decloak"
      2800
      "<argument>"
   )
   ( ship-unstealthy "<argument>" )
)
+Name: AI Decloak
+Repeat Count: 1
+Trigger Count: 999999
+Interval: 0

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Use Cloaking device as long as primary doesn't fire
If you don't have an answer by the time I get home tonight (like 12 hours from now).. I'll actually open up FRED and see what I can figure out.
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 MetalDestroyer

  • Starwars reborn!
  • 210
Re: Use Cloaking device as long as primary doesn't fire
Ok, thanks.

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Re: Use Cloaking device as long as primary doesn't fire
Ok, I found out why the mission crash with "every-time" sexp conditional. I forgot to add a condition if the ship is alive. When, the AI is destroyed, the game crashed when trying to execute the cloak script.

Now, the script works perfectly.

However, since you made me discover the when-argument/everytime-argument. It will be really cool if I can use this sexp conditional instead of everytime. I tried but no success. The AI won't cloak.

Code: [Select]
$Formula: ( every-time
   ( and
      ( not
         ( is-destroyed-delay 0 "Alpha 2" )
      )
      ( not
         ( primary-fired-since
            "Alpha 2"
            0
            6000
         )
      )
      ( = @Alpha2CloakStatus[0] 0 )
   )
   ( ship-effect "Cloak" 2800 "Alpha 2" )
   ( ship-stealthy "Alpha 2" )
   ( modify-variable
      @Alpha2CloakStatus[0]
      1
   )
)
+Name: AI Cloak v2
+Repeat Count: 1
+Interval: 1

$Formula: ( every-time
   ( and
      ( not
         ( is-destroyed-delay 0 "Alpha 2" )
      )
      ( primary-fired-since "Alpha 2" 0 50 )
      ( = @Alpha2CloakStatus[0] 1 )
   )
   ( ship-effect
      "Decloak"
      2800
      "Alpha 2"
   )
   ( ship-unstealthy "Alpha 2" )
   ( modify-variable
      @Alpha2CloakStatus[0]
      0
   )
)
+Name: AI Decloak v2
+Repeat Count: 1
+Interval: 1

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Use Cloaking device as long as primary doesn't fire
Basic bug fixing steps, try adding a message to that event to see if it's triggering and the problem actually lies with the cloaking. At least that way you know whether the problem is your event or the SEXP itself. :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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