ggxjimmy 0 Posted February 28, 2007 http://community.bistudio.com/wiki/addEventHandler what does the EHkilled = mean?? example : EHkilled = player addEventHandler ["killed",{(_this select 1 )setdamage 1}] Share this post Link to post Share on other sites
iLL 0 Posted February 28, 2007 EHkilled is to just assign a name to the eventhandler so in another script u can refer to the event handler EHkilled - its basically an ID. Share this post Link to post Share on other sites
crashdome 3 Posted February 28, 2007 more specifically... it is used to remove an eventhandler if so desired. The value is usually a number from 0 and up. You won't know what the number is and you cannot assume that when you add an event handler that it is always the first one (or value of 0). Because another addon, script, etc... might add another eventhandler at some point, you must save the value given when added for use later. For example: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> EHkilled1 = player addEventHandler ["killed",{hint "You have been killed!"}]; EHkilled2 = player addEventHandler ["killed",{hint "You have been killed!"}]; EHkilled3 = player addEventHandler ["killed",{hint "You have been killed!"}]; //The above code would cause three hints on the players screen when they are killed. //This code below will remove one of them player removeEventHandler ["killed", EHkilled2]; Share this post Link to post Share on other sites
Banzai! 0 Posted March 1, 2007 http://community.bistudio.com/wiki/addEventHandlerwhat does the EHkilled = mean?? example : EHkilled = player addEventHandler ["killed",{(_this select 1 )setdamage 1}] I'm sorry if I'm hijacking this thread but will EHkilled = player addEventHandler ["killed",{(_this select 1 )setdamage 0}] revive you if you are killed? If not is there another mechanism to revive dead players/AI dudes? Share this post Link to post Share on other sites
Asuriel 0 Posted March 1, 2007 could work, but should be (_this select 0) not (_this select 1) Share this post Link to post Share on other sites
charonos 0 Posted March 1, 2007 No, dead means dead, once the player unit is dead, setdammage won't have an effect. You could do that in the HIT EH though to prevent death. There is OFP respawn scripts out to handle "reviving" AI units. Share this post Link to post Share on other sites
loophole_62ndff 1 Posted April 6, 2007 I have been experimenting with reviving players, without the use of the "respawn" function (i.e. with Respawn=NONE). Â So far I have been able to bring players back to life, by doing something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> typeOf player createUnit [ position player, group player, "newPlayer=this", 1.0, rank player ]; &2; setPlayable newPlayer; selectPlayer newPlayer; newPlayer=nil; I put this in onPlayerKilled.sqs. Â It works, but I still find that the mission ends automatically about 10 seconds later, even though I have "respawned". Â I have only tried it with just one human player connected, though. Share this post Link to post Share on other sites
michaelgr12 0 Posted April 9, 2007 ok, in what script (and file) i have to put it and where exactly? can you write maybe script for unlimited health and ammo? Share this post Link to post Share on other sites
shuko 59 Posted April 9, 2007 ok,in what script (and file) i have to put it and where exactly? can you write maybe script for unlimited health and ammo? Ammo is doable, but health script wont be 100% since sooner or later you will be one-shotted instead of wounded. Share this post Link to post Share on other sites
Metal Heart 0 Posted April 9, 2007 I've never died using: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler["Hit",{(_this select 0) setDamage 0;}]; this addEventHandler["Dammaged",{(_this select 0) setDamage 0;}]; You can take the player's magazines and weapons and then return them to him with an action for example. plrWeps=+weapons player; plrMags=+magazines player; player addaction["Rearm","rearm.sqf"]; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//rearm.sqf removeallweapons player; {player addmagazine _x}forEach plrMags; {player addweapon _x}forEach plrWeps; Share this post Link to post Share on other sites
Big Dawg KS 6 Posted April 9, 2007 You can take the player's magazines and weapons and then return them to him with an action for example.plrWeps=+weapons player; plrMags=+magazines player; player addaction["Rearm","rearm.sqf"]; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//rearm.sqf removeallweapons player; {player addmagazine _x}forEach plrMags; {player addweapon _x}forEach plrWeps; Not entirely an effective solution, not when the player can and likely will pick up different weapons and ammo during the mission. Share this post Link to post Share on other sites
Metal Heart 0 Posted April 10, 2007 Sigh... You can set the arrays again at any point you wish if it really fucking matters. Share this post Link to post Share on other sites