I've been scouring the forms for the past couple days and can't for the life of me figure out how to create an Addon that runs a script whenever a player character spawns or respawns.
The code in question is:
// Loop through all players (SP and MP)
{
// Establish player
plyCh = _x;
// Set Death Handler
plyCh addEventHandler["killed",{
// Check if trigger backpack is equipped
if(typeOf(unitBackpack plyCh) == "B_FieldPack_oucamo") then {
// Detonate player
bomb = "DemoCharge_Remote_Ammo_Scripted" createVehicle (getPos plyCh);
bomb setDamage 1;
};
}];
} forEach allPlayers;
This code works great inside of the "init" box for a specific mission, but I would like to convert it into an Addon that applies this handler in all cases to be run on a dedicated server.
Any pointers or general assistance would be great as it turns out Arma 3 modding is actually way more difficult than originally thought.