roguetrooper 2 Posted February 16, 2017 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
killzone_kid 1331 Posted February 16, 2017 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
Midnighters 152 Posted February 16, 2017 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
Larrow 2822 Posted February 17, 2017 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
roguetrooper 2 Posted February 19, 2017 Thank you very much! :-) Share this post Link to post Share on other sites
Midnighters 152 Posted February 19, 2017 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