Jump to content
Sign in to follow this  
Valixx

addMPEventHandler MPRespawn

Recommended Posts

Hey guys.

1. Could someone explain how to use the addMPEventhandler MPRespawn? I got pre-configured gear.sqf files and i want them to execute everytime the unit respawns.

2. Is it possible to target the class of the soldier too? squadleader.sqf for the Squadleader, at.sqf for the Rifleman(AT) and so on?

Cheers,

Valixx

Share this post


Link to post
Share on other sites

1. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPRespawn < Does that leave any questions?

Personally I haven't seen that much use for MPRespawn, I'm fine with the regular respawn-event.

2. For that you can either use

https://community.bistudio.com/wiki/typeOf

or

https://community.bistudio.com/wiki/isKindOf

...whichever you prefer. (they behave somewhat differently, so be aware of how the parent/child structure of the unit-config looks.)

See here: http://browser.six-projects.net/cfg_vehicles/tree?utf8=%E2%9C%93&version=72&commit=Save

Here are two possible examples with pretty much the same result:

if ((typeOf _unit) in ["B_diver_F","B_diver_TL_F","B_diver_exp_F"]) then {
// do something
}

if ( _unit isKindOf "B_Soldier_diver_base_F") then {
// do something
}

Edited by Tajin

Share this post


Link to post
Share on other sites

I'm asking to use the MPRespawn because when i respawn in my mission, my soldiers have over 120 Watches in their inventory. Could be =BTC=Revive.. don't know yet. Therefor i want the files to execute everytime.

Thanks for the answer.

Share this post


Link to post
Share on other sites

I haven't used BTC so far, so I can't help you there.

In general though, make sure whatever gear-script you're using is only executed where the unit is local.

Share this post


Link to post
Share on other sites

I'm using my script like this:

_unit = _this select 0;

if(!local _unit) exitWith{};

removeallweapons _unit;
removeHeadgear _unit;
removeVest _unit;
removeUniform _unit;
_unit addbackpack "B_TacticalPack_blk";
_unit addHeadgear "H_Shemag_khk";

and so on :)

Share this post


Link to post
Share on other sites

if ((typeOf _unit) in ["B_diver_F","B_diver_TL_F","B_diver_exp_F"]) then {

Something that was noticed the other week but in this case above in is case sensitive since it's checking an array so don't get lazy and type b_diver_exp_f and expect it to work. :)

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  

×