Jump to content
avibird 1

Why does respawning units back into a mission does not recognize destroyed units or objects in a trigger function. Help me understand this.

Recommended Posts

I have this code setup for a trigger

REPEATABLE

CONDITION

call {!Alive DT1 || !Alive DT2 || !Alive DT3 || !Alive DT4 || !Alive DT5 || !Alive DT6 || !Alive DT7 || !Alive DT8  || !Alive DisruptorVeh }

 

ON ACTIVATION

call{_units = [DT1,DT2,DT3,DT4,DT5,DT6,DT7,DT8]; _units apply {_x enableAI "PATH"};}

 

 

I have a group of units in a hanger with a empty vehicle inside the hanger.

 

This group will respawn using JEBUS. The group has a disable pathway commode holding them in pace after they spawn into the game. The group has move waypoint followed by a  get in nearest followed by a Guard waypoint.

 

I have a few triggers for this group to enables pathway again.

 

1. if any of the units in this group are killed it enables pathway for the group to moves.

2. If bluefor units get to close to the hanger it enables pathway for the group to moves

3. if you steal date from a research facility  it enables pathway for the group to moves

4. If you destroy the vehicle it enables pathway for the group to moves.

 

 

This group will respawn back into the mission. To stop the group from respawning you must get the date from a research facility and destroy the vehicle.  This all works perfect if the group does not respawn back into the mission.

 

The issue is if you attack the hanger before you attack the research facility and you kill all the units and destroy the vehicle. The units will respawn back into the hanger without the vehicle. (This is by design) The group has the disable pathway and will hold position until 1-3 are completed. 4 is destroyed and there's no longer in the game world. So in theory the group disabled pathway command should be reversed by the vehicle no longer being in the game world destroyed.

 

Here is the issue.

The group will move if 1-3 are met not respawn back since the date is gone from the research facility and the vehicle is destroyed.  The issue and my question is why if the vehicle is destroyed and not alive in the game world why does the  group still hold position when it respawns back into the mission and the vehicle is destroyed. 

 

The groups is acting like vehicle is not destroyed. Is this because the group respawn back in and does not recognize the  vehicle as being destroyed. Is there anyway this can work the way I want it to work.  I know sometimes things are not possible. What do you guys think.  Thanks Avibird.

Share this post


Link to post
Share on other sites

I found this. 

 

Consider an extra variable for a repeatable trigger.

this && isnil "myVariable"     then the trigger wait for 2 conditions this and a non-existing variable (general case as far as you have not yet defined it)

 

On activation:  bla bla (your code) ; myVariable = true       So you set myVariable to true (or else) and then this variable exists.

 

Just kill the variable with your addAction: myVariable = nil   to rearm the trigger.

 

Share this post


Link to post
Share on other sites

*edit* - my suggestion was functionally identical to your solution, so never mind. 

 

Not sure why your vehicle is evaluating as alive when it isn't. Are you SURE it isn't? Just place 

Alive DisruptorVeh

in a watch field in the debug menu and it will show you its current value.

Share this post


Link to post
Share on other sites

What do you mean  Alive Disruptor when it isn't sorry I'm not following

Share this post


Link to post
Share on other sites
2 hours ago, avibird 1 said:

What do you mean  Alive Disruptor when it isn't sorry I'm not following

 

Alive is one of Arma's scripting commands. It checks whether or not a given unit is alive. You are using this command in your trigger condition.

 

If the given unit is alive, the command returns true. If the given unit is not alive, the command returns false.

 

Placing

alive disruptorVeh

in a debug watch field will tell you whether or not disruptorVeh is alive:

 

IPXVTWF.png

 

P3g0pIP.png

Share this post


Link to post
Share on other sites

I'm a little confused I thought this means not alive  

 || !Alive DisruptorVeh }

 

I thought that this means not alive in the condition field. So the trigger condition needs to be if any of the units or the vehicle are dead then the units will be able to move again. ?

 

Share this post


Link to post
Share on other sites

Please read my entire post carefully.

Share this post


Link to post
Share on other sites

Hey harzach 

So I assume in my code when I write this 

|| !Alive DisruptorVeh it means if the vehicle is killed/destroyed ie not alive. I assume this ! Means not alive.  Do if the vehicle is not alive then the units man will be able to move out of the hanger and engage. 

 

So if the units are killed and the vehicle is destroyed the units will still respawn back into the mission after 300 seconds if research date is not taken from the research facility. My question is if the vehicle is not alive it's destroyed why do the group still have the disableAI PATH is still active. No if I take the data the group will move out of the hanger but will not respawn back into the game since the date is taken and vehicle is destroyed. 

 

Sorry I don't understand what you are saying lol please help me understand lol avibird 

 

Share this post


Link to post
Share on other sites

Hey harzach 

So I assume in my code when I write this 

|| !Alive DisruptorVeh it means if the vehicle is killed/destroyed ie not alive. I assume this ! Means not alive.  Do if the vehicle is not alive then the units man will be able to move out of the hanger and engage. 

 

So if the units are killed and the vehicle is destroyed the units will still respawn back into the mission after 300 seconds if research date is not taken from the research facility. My question is if the vehicle is not alive it's destroyed why do the group still have the disableAI PATH is still active. No if I take the data the group will move out of the hanger but will not respawn back into the game since the date is taken and vehicle is destroyed. 

 

Sorry I don't understand what you are saying lol please help me understand lol avibird 

 

Share this post


Link to post
Share on other sites
On 7/22/2023 at 4:47 PM, Harzach said:

Not sure why your vehicle is evaluating as alive when it isn't. Are you SURE it isn't? Just place 


Alive DisruptorVeh

in a watch field in the debug menu and it will show you its current value.

 

This is called "troubleshooting." We are attempting to find the problem by investigating likely sources. Your code is acting as though the vehicle is still alive, so we are checking to see if the vehicle is alive or dead.

Share this post


Link to post
Share on other sites

Your trigger is checking the condition 2 times per second if you didn't modify the interval.

alive nonExistingUnit   or !alive nonExistingUnit    is same for a trigger condition as far as nonExistingUnit is not defined (as object and variable). The trigger doesn't return an error but doesn't fire.

So, I don't really know how your units/vehicle respawn, you probably have a problem with variable names (on respawn, on vehicle or units).

 

EDITED:
Furthermore, if you write as condition:
alive nonExistingUnit or alive player

The trigger will not fire, even if the player is alive, because , as said above,alive (or !alive) nonExistingUnit fails, so the entire condition fails.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I use jebus for most of my respawn needs. 

It carries over individual variable names of units, group call signs, editor placed waypoints and custom unit layouts. The script can be set for one time use, set number of times with a adjustable time for respawning time after the group is killed,  indefinite spawning of a group and my personal favorite a trigger to stop the group from respawn.  

 

The disable and enable pathway commons are setup with different trigger. All works fine but if group is killed and the vehicle is destroyed but the trigger to stop the respawning not completed ie get to a location killing a unit or destroying an object when the group spawn back. I don't understand why if the vehicle is destroyed why the group still has the disable pathway. If any of the units are killed a trigger fires to allow the other members of the group to move again. That trigger works after respawn but vehicle is destroyed so why does it not pick up that the vehicle is not alive and enable the group pathway again.

 

call {!Alive DT1 || !Alive DT2 || !Alive DT3 || !Alive DT4 || !Alive DT5 || !Alive DT6 || !Alive DT7 || !Alive DT8  || !Alive DisruptorVeh } 

 

This works fine if the group is not killed or respawns back. If the group responds back everything works in the trigger except for the vehicle. That is my question why. 

 

I really appreciate the help of trying to make me understand 🙏

 

Let me ask you a question. The group in the hanger that uses jebus respawning script and still works to activate the trigger to enable group pathway again. The vehicle is not spawned. It is a one time object in the mission editor placed.  Do I need to put them in a different trigger. One is a spawn group of units and the other is a editor place asset. I have them in the same trigger and code lines can that cause a conflict? 

 

Share this post


Link to post
Share on other sites

So if the groups respawns back and the vehicle was already destroyed while they were in the process of respawning 300 seconds then the group will not recognize the vehicle as being destroyed? That is what is happen. My assumption is that the group knows about the vehicle  was destroyed because it is no longer in the game world  but that's not how the trigger work right. only if it was placed down at mission strat does the group recognize  the vehicle being destroyed thus enabling their path. So the issue is not really with the trigger setup it's with the respawning groups not recognizing the initial trigger placed down. Because the trigger work fine at mission strat and the trigger if any of the units from the group get killed it enables that pathway because they are back in the game world and the trigger will pick that up since the vehicle is no longer in the game world it does not recognize it as being alive or destroyed. I think I get it now lol. 

 

I know you guys are trying to explain things to me in coding language and logic but in layman's term if the vehicle is no longer in the game world shouldn't the engine recognize the vehicle is destroyed or not alive thus the code should work but it doesn't in reality I guess that's not how the triggers work. 

 

 

Is there any work around for what I want to accomplish. 

Share this post


Link to post
Share on other sites
2 minutes ago, avibird 1 said:

the group will not recognize the vehicle as being destroyed

 

That's not how any of this works.

 

I'll try again.

 

Get your mission to the point where the units respawn and the vehicle is destroyed. 

 

Now, check to see if the vehicle is actually "dead."

  • open the debug console
  • type the following into a watch field (see image)
  • alive disruptorVeh
  • the line below the watch field will say either "true" or "false" (also see image)
  • "true" means the vehicle is alive somewhere

 

3pQzsck.png

 

If this is the case, then there is a problem with your respawns as @pierremgi suggested.

  • Like 1

Share this post


Link to post
Share on other sites

Perhaps try this "lazy" condition:
!Alive DT1 or !Alive DT2 or !Alive DT3 or !Alive DT4 or !Alive DT5 or !Alive DT6 or !Alive DT7 or !Alive DT8  or (isNil disruptorVeh or {!Alive disruptorVeh})

 

just to be sure with your vehicle.
 

Share this post


Link to post
Share on other sites

 @pierremgi it gives a sting error message and does not work. Ty

 

@Harzach at the start of the mission I check and it says true after I killed the group then I destroyed the vehicle it says false. When the group respawns back because I did not take the data from the research facility to stop the group from respawning. The group respawns  back into the hanger but disabled pathway is still active even though it says the vehicle is false. Then I killed one of the units of the group to see if the trigger to enable pathway fires and it does. So I know the units variable names do carry over after respawn or that trigger that allows the group to move if one of its members are killed.  It seems like after the group respawns it does not recognize the vehicle was in the game. Confused 🤔

Share this post


Link to post
Share on other sites

Explain this to me. I took out the vehicle from the mission and I kept all the triggers the way they were set up. So in theory or my assumption once the hanger group spawns into the game world the trigger should be activated because the vehicle is no longer alive  or existing in the game world. Am I wrong to assume that's how it works. The trigger should be fired if it's checking for the vehicle in the trigger and the vehicle is not there. Dead or non existing.   

 

 

Another test I deleted  one of the eight group members that are in the hanger that will move into the vehicle. This is setup with a few trigger. 

1. If any bluefor units get to close to the hanger doors.

2. If the vehicle itself is destroyed

3. If any member of the eight are killed.

 

So when I deleted one of the group members and then started the mission. The triggers will not fire at all if any of the group members are killed.  I am so confused on the reason why this does not work how I think it should.

Share this post


Link to post
Share on other sites

My bad. Missing quote for isNil variable:

!Alive DT1 or !Alive DT2 or !Alive DT3 or !Alive DT4 or !Alive DT5 or !Alive DT6 or !Alive DT7 or !Alive DT8  or (isNil "disruptorVeh" or {!Alive disruptorVeh})

 

Dead or non existing is not same (see my post above). A I wrote, with a non existing unit, so an undefined variable, the condition fails without throwing error in game.

The reason why, I suggested to check for vehicle  something equivalent to: is nil "disruptorVeh", or if not nil (and just in this case) check if not alive.

 

Share this post


Link to post
Share on other sites

Hey pierremgi still not working after respawn of disruptor units in the hanger using your last attempt. if the vehicle was destroyed before the units respawn the units will move. I have a second trigger only with the units and if any of the units are killed before and after respawn   the units will be able to move with the enable pathway command in the trigger. So it's working for the units but not the empty vehicle in the hanger only. 

 

If the vehicle is destroyed before any respawn of the units. The units will movement enabled pathway trigger kicks in. if any of the units are killed in the hanger then the group will move. 

 

The group uses jebus respawning system and the vehicle is an empty vehicle placed on the map with no respawns of that vehicle.

 

In theory when I destroy the vehicle and look at the debug console it says false not alive so the trigger should kick in but does not.  Thanks for the help I just don't understand if the units variable names are carrying over after respawn and the trigger works before and after respawn for the units why not the empty vehicle ? 

 

 

Three separate triggers to allow for the units to move enabling pathway again.

1. Units are killed- works

2. Steal the research data - works 

Both work before and after respawn however 

3. vehicle  only works before respawn of the hanger units. 

 

Just don't understand why. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×