Sarge46 10 Posted July 21, 2009 How can I have weapons save after death, so you don't need to run to the box every time. Share this post Link to post Share on other sites
NeoArmageddon 926 Posted July 21, 2009 Add this to the player (init line or init.sqf): _EHkilledIdx = player addEventHandler ["killed", {_this execVM "playerKilled.sqf"}]; Create a file named playerkilled.sqf in your mission folder and write somethink like this in it: _unit = _this select 0; //the killed unit _weapons=weapons _unit; //get weapons _magazines=magazines _unit; //get mags waituntil {alive _unit}; //waits for the unit to respawn (is alive again) {_unit addweapon _x;}foreach _weapons; //add weapons {_unit addmagazine _x;}foreach _magazines; //add magazines Please note that in MP the old weapons from the body dont get deleted.... so its possible to "cheat" you an infinite amount of weapons/mags with this script. Share this post Link to post Share on other sites
TurokGMT 0 Posted July 21, 2009 isn't there a way to lock a corpse - could've sworn there was a command for that. alternatively you could just deletevehicle on the corpse upon respawn. Share this post Link to post Share on other sites
NeoArmageddon 926 Posted July 22, 2009 clearweaponcargo _corpse; clearmagazinecargo _corpse; Share this post Link to post Share on other sites
xeno 184 Posted July 22, 2009 clearweaponcargo _corpse; clearmagazinecargo _corpse; That doesn't work with units. Save the weapons and magazines in an array and then do removeAllItems _corpse; removeAllWeapons _corpse; Furthermore, in the script above there's an error. If you readd weapons and magazines after the player respawns you have to remove all weapons and items prior adding. Units spawn with a predefined set of weapons and magazines, even civilians respawn with items. Xeno Share this post Link to post Share on other sites
Impavido 0 Posted September 10, 2009 I've added the eventhandler as suggested above, and am using the script below: _unit = _this select 0; //the killed unit _weapons=weapons _unit; //get weapons _magazines=magazines _unit; //get mags waituntil {alive _unit}; //waits for the unit to respawn (is alive again) removeallitems _unit; removeallweapons _unit; {_unit addweapon _x;}foreach _weapons; //add weapons {_unit addmagazine _x;}foreach _magazines; //add magazines The player does not respawn with their pre-death weapons. What am I missing? Share this post Link to post Share on other sites
Rommel 1 Posted October 21, 2009 "_unit" will never become alive again. Change that to player, and you will be set. Share this post Link to post Share on other sites