Jump to content
ufopilot

How to hide Backpack permantently on dedicated Server

Recommended Posts

Greetings,

 

for a smaller "catch the spy" type of mission,i have a playable OPFOR slot that blends in with the Civilian AI trough clothings. To give that player more carrying capability,i have used a Backpack on the Unit and hide it via 

if (side player == opfor) then { unitBackpack player setObjectTextureGlobal [0,""]} ;

either in the units init box OR in the init.sqf of the map. However,if the Player decided to switch backpack with pre-placed things on the map OR Bluefor players that he managed to take out,the Backpack is visible again.

What would be the best way to ensure that the Backpack is hidden at all times,no matter if it gets switched or not? 

 

Share this post


Link to post
Share on other sites

Maybe add a Take eventHandler to the unit, when he takes an item check to see if its a backpack and if so reapply the objectTexture. e.g

player addEventHandler [ "Take", {
    _unit = _this select 0;
    _item = _this select 2;
    
    if( getNumber( configFile >> "CfgVehicles" >> _item >> "isBackpack" ) isEqualTo 1 ) then {
        backpackContainer _unit setObjectTextureGlobal [ 0, "" ];
    };
}];
  • Like 2

Share this post


Link to post
Share on other sites

Thanks for answering,greatly appreciated.

I thought about eventhandler but with using "player" and "addEventhandler" i would run into locality-issues if i am not mistaken. Obviously,i could swap it with "addMPEventHandler" but how to replace the "player" on a server. Giving those units a name like "spy 1,spy 2" ,packing them in an array and check against that should work,right?

 

edit: man thanks for your help,got it sorted after your suggestion.you got that scripting game going,many 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

×