Jump to content
Sign in to follow this  
CR-4267 Dutch

How to removeallweapons from player when they respawn?

Recommended Posts

I am very new to the editor, so please bear with me a bit as I am still learning. I did some searching on this issue, but i wasn't able to find a solution that worked.

I am working on a mission and as part of it, I want to have the players' weapons all removed and replaced with pistols, so for example I have this for the blufor players in the unit inits:

removeallweapons this; 
this addweapon "hgun_rook40_f";
this addmagazine "16rnd_9x21_mag";
this addmagazine "16rnd_9x21_mag";
this addmagazine "16rnd_9x21_mag";
this addmagazine "16rnd_9x21_mag";
this addmagazine "16rnd_9x21_mag";
this addmagazine "16rnd_9x21_mag";
removeheadgear this;
this additem "H_Cap_brn_SERO";
this assignitem "H_Cap_brn_SERO";
this unassignitem "nvgoggles";
this removeitem "nvgoggles"

The problem is that when they die and respawn they have rifles and what not. Is there a way to fix it so that init repeats when they respawn?

Thank you.

Share this post


Link to post
Share on other sites

You can add an event handler to their init line. Create a new script called 'remove.sqf'

_unit = _this select 0;

removeallweapons _unit;

_unit addweapon "hgun_rook40_f";

_unit addmagazine "16rnd_9x21_mag";

_unit addmagazine "16rnd_9x21_mag";

_unit addmagazine "16rnd_9x21_mag";

_unit addmagazine "16rnd_9x21_mag";

_unit addmagazine "16rnd_9x21_mag";

_unit addmagazine "16rnd_9x21_mag";

removeheadgear _unit;

_unit additem "H_Cap_brn_SERO";

_unit assignitem "H_Cap_brn_SERO";

_unit unassignitem "nvgoggles";

_unit removeitem "nvgoggles"

Now in the init line of each unit add:

this addMPEventHandler ["mprespawn",{_null = [_this select 0] execVM "remove.sqf";}];

Hope that helps!

Share this post


Link to post
Share on other sites
You can add an event handler to their init line. Create a new script called 'remove.sqf'

Now in the init line of each unit add:

Hope that helps!

This looks like exactly what I needed. I won't be able to test it until tomorrow when my friends are on, but thank you very much. I will update if it worked or not.

Share this post


Link to post
Share on other sites

Editing questions don't belong in the User Missions forum, that's for posting completed missions/campaigns for people to download. Moved to ME&S

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  

×