Jump to content
Sign in to follow this  
ylguf

Working Stun script

Recommended Posts

Hello. I have recently been working on the startis life mission which is being released publicly http://forums.bistudio.com/showthread.php?151285-Multiplayer-ArmA-3-Stratis-Life-W-I-P-Release-this-weekend

This is the script I created to handle stunning with a weapon it will be implemented in the mission soon. I am making this post because I thought people might want to add a stun function to weapons in other missions.

right now it is set so only west can stun civilians with the P07. almost any setting can be produced with a little editing. I tried to keep it simple.

/*-to control who can stun add the event handler from west.

-to control who can be stunned add the the lines from civ to the respective side

-go to firedEH.sqf to control which weapons can stun for which team.

weapons still do damage atm

just create sqf files with the following names and place the info in it. it should work MP for non-ai units. doesn't work SP

animation can be a little buggy but all the base is here

*/

init.sqf

stunned = 0;

stunshooter = 0;

if(side player == west) then{

Player addEventHandler ["Fired","shooter = (_this select 0); weapon = (_this select 1); execVM 'firedEH.sqf'"];};

if(side player == civilian) then{

"stunned" addPublicVariableEventHandler {if(player == stunned)then{execVM 'stun.sqf';};};

Player addEventHandler ["hit","victim = (_this select 0); shotby = (_this select 1); execVM 'hitEH.sqf'"];};

if(isServer)then{

"shotby" addPublicVariableEventHandler {execVM "stunEH.sqf"};};

firedEH.sqf

if((side player) == west)then{

if (weapon == "hgun_P07_F")then{

publicVariableServer shooter;};};

if((side player) == east)then{

shooter = null;

publicVariableServer "shooter";};

hitEH.sqf

publicVariableServer "victim";

publicVariableServer "shotby";

stunEH.sqf

if(isServer)then{

if(shooter == shotby)then{

stunned = victim;

victimid = (owner victim);

stunshooter = shooter;

victimid publicVariableClient "stunshooter";

victimid publicVariableClient "stunned";

hint format["%1 has been stunned by %2", stunned, stunshooter];};};

stun.sqf

player switchmove "AinjPfalMstpSnonWnonDf_carried_fallwc";

sleep 7;

player switchmove "";

Edited by ylguf

Share this post


Link to post
Share on other sites

Thanks so much, im really looking hard for the restrain script. tho i got it from youre mission Stratis life, still have no clue to find out how to add it in my mission.

Share this post


Link to post
Share on other sites
Thanks so much, im really looking hard for the restrain script. tho i got it from youre mission Stratis life, still have no clue to find out how to add it in my mission.

Same would be able to do alot with the restrain and search scripts

Share this post


Link to post
Share on other sites

Thank you for this script, i have been searching for something like this for a time now. However i cannot get this to work using the method you have written above. I guess this was written during the beta, is there anything that might have changed since then?

//Ultradeth

*Update* I got a screenshot of the script error.

jZ0Rgjw

http://imgur.com/jZ0Rgjw

Edited by Ultradeth

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  

×