Jump to content
johnnyboy

AI won't obey setUnitPos script command after player commands stance of unit

Recommended Posts

After a player commands a unit to "Go Prone",  a script command on that unit to setUnitPos "UP" or setUnitPos "MIDDLE" will have no effect on that unit.  The unit remains prone until player commands unit again to "Copy my Stance" (AUTO), "Stand Up" (UP), or "Stay Crouched" (MIDDLE).

 

Is there a way to clear this player commanded condition without player commanding unit again?  Or is there another way to force unit stance to crouch via script after player commands prone?

 

I'm modifying my own copy of PierreMGI's excellent medic script, where if Player is hit he goes unconscious and an AI buddy will run to him and heal him.  While player is unconscious he can't command units any longer.  So if player commands units to go prone, then gets hit, the medic script tries to get unit to crouch (via setUnitPos "MIDDLE"), and run to player.  But in this case the unit is stuck in prone and crawls to player.  This sucks if medic is 100M away.

 

I tried having medic join grpNull hoping that would clear the condition, but it does not (he is still stuck in prone).   I also tried playActionNow "Crouch", but that makes him stand up for a second and immediately go prone again.

Share this post


Link to post
Share on other sites
23 minutes ago, sarogahtyp said:

U could try to delete and recreate the ai

True, my last resort.  Thanks.  I'm still hoping for a cleaner solution though.

 

I'm also considering disabling ANIM on player, and playing the unconscious animation on him. This way he won't truly be unconscious and can still control his squad (thus allowing him to order medic back up, and do any orders on squad).  But this would allow him to call in airstrikes, etc.  Maybe that's good.  You're injured and can't move but can still call an airstrike to save you.

Share this post


Link to post
Share on other sites

maybe it is a problem where your script orders get overriden by engine with the last player stance command.

if thats the case then a EachFrame event handler could help which executes setUnitPos on each frame until player is healed or something...

  • Thanks 1

Share this post


Link to post
Share on other sites
18 minutes ago, sarogahtyp said:

maybe it is a problem where your script orders get overriden by engine with the last player stance command.

if thats the case then a EachFrame event handler could help which executes setUnitPos on each frame until player is healed or something...

Another good idea.  I hate it when frickin' ARMA makes me resort to eachFrame!  Haha.

  • Haha 1

Share this post


Link to post
Share on other sites
4 minutes ago, panther42 said:

@johnnyboy without testing, does the last note in setUnitPos help at all via setUnitCombatMode?  It mentions setCombatMode, but that is for group.

Thanks!  Good catch.  I will try that and report back.

 

Note that I recently discovered the setUnitCombatMode command.  Another problem I found, is that after player commands units to Hold Fire, their combatMode is set to BLUE, but the units will still fire on near enemies before I give the command.  This is because their unitCombatMode is still YELLOW.  The solution to this is for me to detect a difference between unit's combatMode and unitCombatMode, and auto-set them to match combatMode.  Then unit will truly hold fire until player commands them to fire.  This is important to me in Prairie Fire jungle when trying to ambush.  Enemy does not see my prone team until close, but my stupid team fires too early.  I plan to release a script for this later.  It will also feature an idea I got from @froggyluv where my AI team will start firing (switch to combatMode RED) automatically when player fires first shot.  This saves player from having to do clumsy actions to order team to fire.

 

  • Like 1

Share this post


Link to post
Share on other sites

Yes, setUnitPos... is not really a fine command as far as you're trying to override the engine (AI FSMs). If that works (unit in aware mod, no enemy), you have to script for resuming auto stances, if that doesn't work, in combat mode, due to engine, the on each frame is not a fine solution.

 

So, let the AIs reacting as they should but give them specific behavior in combat:

I'm testing with success  setCombatBehaviour for a script about making AIs rearming on crates/corpses ( for mag or even weapons..)... WIP.

Share this post


Link to post
Share on other sites
4 hours ago, johnnyboy said:

where if Player is hit he goes unconscious and an AI buddy will run to him and heal him.  While player is unconscious he can't command units any longer.  So if player commands units to go prone, then gets hit, the medic script tries to get unit to crouch (via setUnitPos "MIDDLE"), and run to player.  But in this case the unit is stuck in prone and crawls to player.  This sucks if medic is 100M away.

Other option @johnnyboy, DON'T GET HIT.  😁

May be other options with selectLeader, setLeader, etc., to move command away from player, then back quickly so your AI units don't blow everything.
However, If you've been hit, you're cover is already probably blown...

 

I really only use a homebrew mod of Psycho's medical.  I never noticed the same issue as you have, but should try it.
I should also try @pierremgi medical, as he has some good stuff / well versed coder.

  • Like 1

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

×