Jump to content
UnDeaD.

Delayed detection of playable AI's death

Recommended Posts

Hello,

 

I'm doing a conquest style gamemode where sides are equally occupied with playable AI and players can hop in the match or leave it without having team balance issues.

I'm trying to check if a playable unit (AI) is dead or not. The problem is that the commands that I already tried return the unit as dead when it respawned, and not when it was killed.

 

The commands i tried:

alive / damage / in allDeadMen / lifeState / (MP)Killed EH + set/getVariable

 

I had no luck achieving what I want with any of them and the script detects the AI as dead only after it respawned.

 

If anyone has some ideas on how could I achieve it I would really appreciate it.

 

Share this post


Link to post
Share on other sites

I tried it already with Killed EH, I gave a variable to the unit so it changes when the eventhandler is triggered, but it still only triggers after the AI respawned.

The script that I use runs on all AI, and in this case, the living AI is checking for example if the driver is dead or not, and if it's dead he has to get out of the vehicle. Now this only occurs when the dead driver respawned, and not when he died, and that's the problem.

I'll try it in an empty mission to see what will happen.

Share this post


Link to post
Share on other sites

I'm using EntityKilled:

addMissionEventHandler ["EntityKilled", {
    params ["_unit", "_killer", "_instigator", "_useEffects"];
    if ((_unit) isKindOf "CAManBase") then {
        [_unit,-1,true] call bis_fnc_respawnTickets;
        _unit setVariable ["wasKilled", true, true];
    };
}];

Then i check the variable 'wasKilled' but it only returns true after respawn. Fun fact is that ticket bleeding works fine.

 

Also what i noticed is that when playable AI is in a vehicle turret, he has some sort of control over the turret until respawn, so it seems like he is not really killed until the respawn delay runs out.

Share this post


Link to post
Share on other sites

Unless I am mistaken the killed unit and the respawning unit are different units... and what happens at some point (probably at respawn) is that the variables are copied from the dead unit to the respawning one

I could be wrong about that

Share this post


Link to post
Share on other sites

For respawning, a unit is to be killed first. That's the Arma's life.

So, some AIs can be definitely dead (lifeState:  "DEAD") , but the respawnable are "DEAD-RESPAWN" during the time of respawn.

Usually, playable AIS are respawnable by default in Arma MP session.

 

21 hours ago, UnDeaD. said:

I'm doing a conquest style gamemode where sides are equally occupied with playable AI and players can hop in the match or leave it without having team balance issues.

I'm trying to check if a playable unit (AI) is dead or not.

 

 

So, why checking if a unit is dead if he can respawn???

Try to elaborate what you want exactly (balanced sides for players) , at what time (JIP) ...  How do you want to balance (changing last JIP player's side?)

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

For respawning, a unit is to be killed first. That's the Arma's life.

So, some AIs can be definitely dead (lifeState:  "DEAD") , but the respawnable are "DEAD-RESPAWN" during the time of respawn.

Usually, playable AIS are respawnable by default in Arma MP session.

The unit dies, "alive" returns him as false (lifeState as "DEAD-RESPAWN"), but the script runs only after the dead unit respawned, and the script i want to run has alive as condition. It's very strange.

 

1 hour ago, pierremgi said:

So, why checking if a unit is dead if he can respawn???

An example from my mission: a truck is carrying other AI, but the driver gets shot, so passenger AIs have a script running that checks frequently if the driver is dead or not.

 

1 hour ago, pierremgi said:

Try to elaborate what you want exactly (balanced sides for players) , at what time (JIP) ...  How do you want to balance (changing last JIP player's side?)

By this i meant it's a 40 vs 40 conquest mission, in which by default all units are playable AI, but joining players can take over these slots. Players can also leave, and then the AI takes over their unit again.

Share this post


Link to post
Share on other sites

So, when a player dies (EH "killed" on the unit will fire), what do you want to do?

Then the player respawn (EH "respawned" on the unit will fire, and you can act on corpse or on new unit), what do you want to do?

For balanced sides, you can write something on initPlayerServer for counting units on sides and decide to fire the JIP back to the lobby (or change side as in wasteland).

Note: when a player leaves, the unit becomes an AI (if not disabled in the lobby), living its own existence. The unit doesn't die.

Share this post


Link to post
Share on other sites
3 minutes ago, pierremgi said:

So, when a player dies (EH "killed" on the unit will fire), what do you want to do?

AI units to disembark immediately after the driver died (this is the part that works but only after the dead driver respawned).

 

10 minutes ago, pierremgi said:

For balanced sides, you can write something on initPlayerServer for counting units on sides and decide to fire the JIP back to the lobby (or change side as in wasteland).

This part is already done.

 

Share this post


Link to post
Share on other sites

You should have a mod or a script managing this kind of behavior. In Arma vanilla, you can test in MP preview, any playable unit will trigger the EH "killed" as soon as he dies.

bob addEventHandler ["killed", {hint "bob is dead"}];    No delay for hint,... then bob respawn in due delay.

Share this post


Link to post
Share on other sites
6 hours ago, pierremgi said:

You should have a mod or a script managing this kind of behavior. In Arma vanilla, you can test in MP preview, any playable unit will trigger the EH "killed" as soon as he dies.

bob addEventHandler ["killed", {hint "bob is dead"}];    No delay for hint,... then bob respawn in due delay.

Yes i have tested that, it works in my mission, too, because the ticket bleeding I added to EntityKilled subtracts from the team's tickets right after death. There might a problem with the script i am running. I'll try to figure something out.

 

Anyway, thanks for your help guys.

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

×