Jump to content
roguetrooper

Eventhandler MPrespawn not executed on respawn

Recommended Posts

When I put

this addMPEventHandler ["MPRespawn", {[this] exec "equip.sqf"}];

into the init line of a unit (soldier), it does not execute the file equip.sqf at respawn.

 

The file equip.sqf is only executed when I use the proper name of the unit:

UNITNAME addMPEventHandler ["MPRespawn", {[UNITNAME] exec "equip.sqf"}];

 

Why does the first example not work? With 100 units on the map, I would like to use a code that I can simply copy and paste (i.e. just by copying the unit in the editor). I don't want to edit the init lines of all units seperately.

 

Share this post


Link to post
Share on other sites

why not use mission EH "EntityRespawned" and add it tot the mission once instead of adding it for every unit and jip?

Share this post


Link to post
Share on other sites
1 hour ago, killzone_kid said:

why not use mission EH "EntityRespawned" and add it tot the mission once instead of adding it for every unit and jip?

doesn't that eh account for vehicles as well..?

Share this post


Link to post
Share on other sites

This in the event code is undefined so maybe failing silently. Should be _this and without [ ] as its already an array of passed variables from the event.

this addMPEventHandler ["MPRespawn", { _this exec "equip.sqf" }];

Share this post


Link to post
Share on other sites
On 2/16/2017 at 5:05 PM, Larrow said:

This in the event code is undefined so maybe failing silently. Should be _this and without [ ] as its already an array of passed variables from the event.

 


this addMPEventHandler ["MPRespawn", { _this exec "equip.sqf" }];

 

couldn't you make the variable "public" but not "public" ?

_variable 

vs

variable

?

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

×