Jump to content
Freghar

Check whether player JIPed into an existing AI unit

Recommended Posts

Hello,

is there any way to determine if a player Joined In Progress into a slot which had "AI Enabled", therefore joining as an existing (AI) unit, not spawning a new one?

I know I could use the missionConfigFile command to get global disabledAI value, but I don't know how to do that per-slot when disabledAI=0.

One way would be to set some variable for each existing playable unit at a mission start, however that wouldn't persist through respawns of that unit + would need to be a publicVariable (which is what I'm trying to avoid).

Is there something simple like didJIP for checking if a new unit was spawned on JIP?

Thanks.

Share this post


Link to post
Share on other sites

Hello,

is there any way to determine if a player Joined In Progress into a slot which had "AI Enabled", therefore joining as an existing (AI) unit, not spawning a new one?

I know I could use the missionConfigFile command to get global disabledAI value, but I don't know how to do that per-slot when disabledAI=0.

One way would be to set some variable for each existing playable unit at a mission start, however that wouldn't persist through respawns of that unit + would need to be a publicVariable (which is what I'm trying to avoid).

Is there something simple like didJIP for checking if a new unit was spawned on JIP?

Thanks.

 

Add "Local" EH to unit, where unit is local (probably server). If player takes control of this unit, it will change locality and EH will fire.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/Event_Scripts

 

initPlayerLocal.sqf

params ["_playerObject","_didJIP"];

if (_playerObject in playableUnits && _didJIP) then
{ 
    //stuff
}; 

Or, for respawns you could also use the onPlayerRespawn.sqf.
That doesn't really work - player is always going to be in playableUnits.

 

Add "Local" EH to unit, where unit is local (probably server). If player takes control of this unit, it will change locality and EH will fire.

Thanks, I did consider that, but it seemed like a heavy solution to a simple problem. Still better to copy a state variable between two sides than export a publicVariable to everyone, I guess.

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

×