Jump to content
Sign in to follow this  
Helmut_AUT

First alive unit in a group?

Recommended Posts

Sorry for this most basic question, but I can't find it in any search here or at OFPEC.

I have a group called hgroup intializing with "hgroup = group FTL1" where FTL1 is the primary player character in a mission for both single and multi player.

Later in the mission, I want to attach a Harrier to this group, but chances are that FTL1 may be dead, player may have teamswitched or respawned in multi. So I can't "joinsilent FTL1", what I need is a short script to pick the first unit still alive from that hgroup.

Alternatively, it would work if the radio trigger that attaches the Harrier would return the unit firing it, but this only seems to work reliable with "presence" type triggers.

Thanks for your help.

This will also be handy in other places.

Share this post


Link to post
Share on other sites

you could combine the radio and presence-trigger...

like radio-trigger on activation: harrier = true

present-trigger-condition: this && harrier

i hope you know what i mean

Share this post


Link to post
Share on other sites

Interesting work-around. Basically it would create a new array at the time of the radio message with only the currently "live" units in it.

Share this post


Link to post
Share on other sites

Just check if the leader of hgroup is alive.

ie in the condition of the trigger,

alive(leader hgroup) && whatever other condition

then put your join silent in the activation field.

Cheers

GC

Share this post


Link to post
Share on other sites

Thanks, but that doesn't solve my problem. I need to join the Harrier to the group, to put it under the command of whatever unit is currently leader in that group. If the primary leader is dead, I can not just "not" join the harrier in there, I need the next alive guy.

Share this post


Link to post
Share on other sites

I think I tried that yesterday and failed with the message "must be object or group" and hgroup is an array.

Maybe my mistake is defining hgroup as units FTL1 instead of groupFTL1...I have to look that up.

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
Sign in to follow this  

×