Jump to content
Sign in to follow this  
CarlGustaffa

addAction "Serch Body" to scripted units

Recommended Posts

Hi

I have tried to add an action so that players can search a dead body before it is buried automatically. The "remove bodies" function (automatically) seem to work, but not the "search body" action (user started). It works fine while testing in singleplayer, but in multiplayer the action doesn't show up, at least not for JIP players. I didn't think JIP would be an issue since it is added to "server units". These are put in the mission via script and not via the editor.

The action is done at the same place where the spawned units have their weapons loadout changed, which *does* work.

What on earth am I doig wrong here?

Example code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

       if (typeOf _one_unit == "TeamLeaderE") then

       {

           _one_unit addAction ["Search Body", "bat\search_body.sqf", [], 5, true, true, ""];

           _one_unit addMagazine "SmokeShell";

           _one_unit addMagazine "SmokeShell";

           if (floor random 2 > 0.8) then

           {

               _one_unit removeWeapon "AK74";

               _one_unit addWeapon "AKS74PSO";

           };

       };

Share this post


Link to post
Share on other sites

http://community.bistudio.com/wiki/addAction

Quote[/b] ]This icon symbolizes, that arguments of the given scripting command must be local to the client (computer) on which the command is executed. Check Locality in Multiplayer for more information about locality of objects.
Quote[/b] ]This icon symbolizes that the effects of the given scripting command are not broadcasted over the network and remain local to the client the command is executed on. Check Locality in Multiplayer for more information about locality of objects.

I am no MP scripting expert, yet it seems that you need to

ensure that the addAction is added on each client and the

server.

So how/here is your script that has this code executed?

Share this post


Link to post
Share on other sites

Bah, dammit! Locality issue again, I should have guessed. Maybe I will try something like:

searchbodyunit = _one_unit;

publicVariable "searchbodyunit";

and aa addPublicVariableEventHandler "searchbodyunit" on the clients which adds the needed addAction to the enemy squad leaders etc.

Thanks for pointing me in another direction.

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  

×