Jump to content
Sign in to follow this  
kiptanoi

How to use this code?

Recommended Posts

How to use this code?

Do I put it in my init file, or do I use it with a trigger or do I use it with my player initfield?

/* (C)Rommel Von Richtofen // http://creativecommons.org/licenses/by-nc-sa/2.5/au/ */

RMM_f_weaponsRespawn = {
  _this spawn {
     private ["_unit", "_weapons", "_magazines","_hasruck","_ruckType","_ruckMags","_ruckWeps"];
     _unit = _this select 0;
     _weapons = weapons _unit;
     _magazines = magazines _unit;
     _hasruck = player call ACE_Sys_Ruck_fnc_hasRuck;
     if (_hasruck) then
     {
        _ruckMags = _unit getVariable "ACE_RuckMagContents";
        _ruckWeps = _unit getVariable "ACE_RuckWepContents";
     };
     waituntil {alive player};
     _unit = player;
     removeallweapons _unit;
     _magDiff = [_magazines, (magazines _unit)] call CBA_fnc_getArrayDiff;
     {_unit removeMagazine _x} foreach (_magDiff select 1);
     {_unit addMagazine _x} foreach  (_magDiff select 0);
     _wepDiff = [_weapons, (weapons _unit)] call CBA_fnc_getArrayDiff;
     {_unit removeMagazine _x} foreach (_wepDiff select 1);
     {_unit addMagazine _x} foreach  (_wepDiff select 0);

     _unit setVariable ["ACE_RuckMagContents", _ruckMags, true];
     _unit setVariable ["ACE_RuckWepContents", _ruckWeps, true];
  };
};
[] spawn {
  waituntil {RMM_initdone};
  player addEventHandler ["killed", "_this call RMM_f_weaponsRespawn"];
};

Share this post


Link to post
Share on other sites

I try to put it inside my initfile, but nothing happened, in multiplayer, I hope the code should work in multiplayer to?

Share this post


Link to post
Share on other sites

Removing the line

waituntil {RMM_initdone};

Should do it...

Or at least setting

RMM_initdone = true;

Somewhere in your init.sqf

Share this post


Link to post
Share on other sites

Now I have put in: RMM_initdone = true; in my init.sqf

And now I got back my starting magazine only when I respawn, got not back weapon and not rucksack...

And I think the code should get back all when I respawn, so what is wrong?

Share this post


Link to post
Share on other sites

Oh good, what is the name of this code (What are I going to look after when code is done and ready)

Or you could write here in this thread when done?

Thanks =)

Share this post


Link to post
Share on other sites
Oh good, what is the name of this code (What are I going to look after when code is done and ready)

Or you could write here in this thread when done?

Thanks =)

It should appear in the @ACE\store folder, I imagine. In that folder is an archive called function_library. I'm thinking that's where it should appear when ready.

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  

×