Ajira 10 Posted October 25, 2009 I'm trying to clean up the junk that is left on the floor when you change weapons at an ammo box. But somehow it's not working.. In the player's "init': this AddEventHandler ["LoadOutChanged",{{deleteVehicle _x} forEach ((getPos player) nearObjects ["WeaponHolder",20])}]; anybody got an idea ? :confused: Share this post Link to post Share on other sites
Bon 12 Posted October 25, 2009 New to me that there's an Eventhandler called "LoadOutChanged": http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers Where did u get it from? Share this post Link to post Share on other sites
ProfTournesol 952 Posted October 25, 2009 It's a VBS2 eventhandler, don't know much more. Share this post Link to post Share on other sites
Ajira 10 Posted October 26, 2009 Well if you guys know another way to clean up the junk that is left behind when using an ammobox, then i'm all ears :) Share this post Link to post Share on other sites
Benny. 15 Posted October 26, 2009 Try a global nearsObject like: _list = getpos player nearObjects 20; then substract the common types ("Air","Car","Structure"...). Share this post Link to post Share on other sites
Bon 12 Posted October 26, 2009 Well, to delete the nearest Weaponholder is no problem: _weaponholders = nearestObjects[player,["WeaponHolder"],5]; deleteVehicle _weaponholders select 0; This would delete the nearest WeaponHolder. Your problem atm is to detect when the players loadout changed. Have no idea how to do that without hax0ring. Share this post Link to post Share on other sites
Ajira 10 Posted October 26, 2009 Would it work if I set a loop on the ammobox like this ? while {alive _this} do { _return = _this execVM "scripts\misc_loadammo.sqf"; //refill the ammobox. _weaponholders = nearestObjects[_this, ["WeaponHolder"], 5]; { deleteVehicle _x; } foreach ( _weaponholders select 0); sleep 60; } Share this post Link to post Share on other sites
Wastelander 10 Posted October 27, 2009 Not putting enough detail in the title of the tread? Share this post Link to post Share on other sites
chris330 0 Posted October 27, 2009 That last post about the topic title is likely to attract an argument mate, prob best edit it out, we're all good people here afterall so be friendly ;) Ajira The code looks good to me very nice and tidy solution you've taught me some stuff. Variable _weaponholders becomes and array full of nearestobject(s) of type "WeaponHolder"(s) and then you delete the first entry which is obviously the junk on the floor. It looks ok to me how did it get on in testing? Share this post Link to post Share on other sites
Rommel 1 Posted October 27, 2009 (edited) Not putting enough detail in the title of the tread? lol Wastelander. while {alive _this} do { _return = _this execVM "scripts\misc_loadammo.sqf"; //refill the ammobox. _weaponholders = nearestObjects[_this, ["WeaponHolder"], 5]; { deleteVehicle _x; } foreach ( _weaponholders select 0); sleep 60; } That should work fine. Edited October 27, 2009 by Rommel Share this post Link to post Share on other sites
Ajira 10 Posted October 27, 2009 Yep it works just fine. Stuff stays on the ground for about a minute and then poofs. :D Share this post Link to post Share on other sites
chris330 0 Posted October 27, 2009 Nice job mate ;) Share this post Link to post Share on other sites