Jump to content
dlegion

mp give control of a unit to player

Recommended Posts

Hello!

I ve a weird problem....in a dedicated mp jip and respawn environment, after an action, player loses the control over its character...and A.I. seems to take its place, by shooting and turning, while player can still move head around but not body or aim.

I need to give control back to player !

The script is R3F logistic, but way too complex for me...probably an external script, like an action to take back control anytime would be easier....any ideas ?

Thanks !!

Share this post


Link to post
Share on other sites

I found and tried "selectplayer " command....but dont seem to work ?

 

EDIT

i made a trigger (activated by radio )

On activation :

SelectPlayer blue1

(Blue1 is the name of the test unit i wish to retake control )

Seems to work....so i need a kind of generic script or code that will detect actual player unit (not named ) and give back control of it with selectPlayer !

Any idea ? Thanks !

 

Edited by dlegion
updated

Share this post


Link to post
Share on other sites

ok i tested it with another human, and "selectPlayer" command seems to solve the problem !! yeah !!
so now basically i need help with the script to have this effect:

when player lose the control of his own body (replaced by A.I.), i wish to give control back to it (only to that specific body).

so somehow i need to detect what "body" unit is the player and somehow name it locally or rememeber it to recall it in later in the script,
where i probably just need to put:
                  selectPlayer nameOFplayerUNIT;
to give back the control to player of his own body !

help please !
thanks !
 

Share this post


Link to post
Share on other sites

i got very lucky, and looking at a script i found the problem !!
there is a setOwnerTo that screw the things,
so i need to use it only if target is a "man" class!
here is the relevant part of the script:

Spoiler

            if (!local _objet) then                                                                                                  // D edited, added && ...
                {
                    private ["_time_demande_setOwner"];
                    _time_demande_setOwner = time;
                    [_objet, "setOwnerTo", _joueur] call R3F_LOG_FNCT_exec_commande_MP;                                                  // i discovered that commenting this line solve the AI problem!! 
                    waitUntil {local _objet || time > _time_demande_setOwner + 1.5};
                };

 


i wish to keep the "setOwnerTo" for everything excluding the "man" class!
suggestion how make this ?
thanks for the help guys!

Share this post


Link to post
Share on other sites

If (!local _object && !(_object isKindOf "CAManBase")) then {...};

 

Share this post


Link to post
Share on other sites

Awesomeeee ! Really thanks man, it works perfectly !!

Thanks thanks thanks !!!

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

×