Page MenuHomeFeedback Tracker

!alive check for multiple playable units does not work when slot not filled
Closed, ResolvedPublic


The game does not correctly detect a playable unit isn't alive if it was never slotted with either a Player or AI to begin with. {F18640} {F18641}


Legacy ID
Not A Bug
Steps To Reproduce

Create a mission with 3 playable units
Name the units p1, p2, p3 respectively
*Create a trigger that gives a hint when !alive p2
Repeat * for p3
Create a trigger that gives a hint when !alive p2 && !alive p3
Set various timers on each trigger so you are able to see each hint in turn while testing
Play the mission, kill p2 and p3, watch the hints (works as expected...)
Quit out, play the mission again, except this time turn off one of the AI, doesn't matter if it's for p2 or p3
Kill p2 or p3 depending on which one you left AI in

The trigger fires for the unit that dies, but the 3rd trigger which should fire when both units aren't alive doesn't do anything.

Additional Information

Demo mission attached.

Event Timeline

Phalanx edited Steps To Reproduce. (Show Details)Apr 3 2013, 8:31 PM
Phalanx edited Additional Information. (Show Details)
Phalanx set Category to Scripting.
Phalanx set Reproducibility to Always.
Phalanx set Severity to Major.
Phalanx set Resolution to Not A Bug.
Phalanx set Legacy ID to 3771487641.May 7 2016, 1:24 PM

You could also use isNull.

Phalanx added a subscriber: Phalanx.May 7 2016, 1:24 PM

Doesn't work either, try it out.

isNull p2; in the condition of the trigger does nothing on activation, or simply.. the condition isn't met because p2 isn't considered nothing when dead.

!alive should apply to both units that don't exist because they haven't spawned, but are an object on the map, and also to units that exist but have been killed. I can't see any other way to get this to work. Should be a simple thing.

You should probably attach an easy repro mission that would help for a quick fix by the developers.

How does work in your situation?

Demo mission uploaded.

@ViperMaul: Not sure how to use lifeState, so I couldn't say

Doesn't need a fix. A mission with working triggers is attached.


Player (or AI) that is not spawned is 'nil', hence if you disable AI on p2 then (isNil "p2" == true).

Thing is only, that e.g. a trigger condition (!alive p3 || isNil "p3") will never return true for some reason, so I made separate triggers. These kind of conditions might be easier to handle within scripts or even better, FSMs.

Thanks for looking into the issue Fireball. I'm testing isNil now and I'm getting the same problem with: (!alive p3 || isNil "p3") not returning true.

I'm having the same thing happen with: (!alive p2 && isNil "p3") || (!alive p3 && isNil "p2");

(!alive p2 && isNil "p3") works on its own, but as soon as you make it an OR statement it doesn't work properly.. Something's going wrong somewhere.

I respect you think it'd be easier to use a different method; "within scripts or even better, FSMs." but from my POV as a novice mission maker and scripter checking if a pre-placed object is present in a mission should be one of the easiest things to do! I don't really fancy learning about FSMs just to do that..

Would it be possible to make !alive encompass both its current return + the return from isNil when referencing an object?

Or at least, can the coding be looked to so that (!alive p3 || isNil "p3") returns the expected result?

*EDIT* I didn't mean to change the status from feedback to new..

Thanks for your feedback, please open a different ticket and add repro for exactly that problem (!alive p2 || isNil "p2",one trigger suffices).

The"!alive object name" in a trigger is now not working in many old missions or showing errors