cougarxr7 1 Posted January 11, 2013 Hello, I used the search, no luck. I am trying to set the enemy officers up with god mode. They are getting killed by their own men. Here is what I have, _unit = _officerE; for [{_loop=0}, {_loop<1}, {_loop=_loop}] do { if(officerE_godmode==1)then { _unit addeventhandler["hit",{_unit setdammage 0}]; _unit addeventhandler["dammaged",{_unit setdammage 0}]; sleep 0.01; hint "OFFICER GOD MODE IS ON"; sleep 2.00; } else { _unit removeEventHandler ["hit",0]; _unit removeEventHandler ["dammaged",0]; sleep 0.01; hint "OFFICER GOD MODE IS OFF"; sleep 2.00; }; sleep 1.00; }; I get the hint "OFFICER GOD MODE IS ON", but you can kill him with 1 shot. I hope there are some scriptors around. Thanks! Share this post Link to post Share on other sites
Foxy 1 Posted January 11, 2013 _unit addeventhandler["hit",{_unit setdammage 0}]; should be _unit addeventhandler["hit",{(_this select 0) setdammage 0}]; same with the other eventhandler. But why not just use allowDamage instead of the eventhandlers? Share this post Link to post Share on other sites
cougarxr7 1 Posted January 11, 2013 (edited) Thanks for helping! I am interested in the best way to do this. This is just a way I hoped would work. I am going to test your scripting. I run the "ULTIMATE COMBAT", join sometime when you are playing and you see the server, be glad to show you everything else I've done. UPDATE: It is still not working. I checked on that command "allowDammage", this link says it is obsolete. http://www.ofpec.com/COMREF/index.php?action=details&id=17&game=All Thanks, I will keep at it! Edited January 11, 2013 by Cougarxr7 Share this post Link to post Share on other sites
ToxicMuffin 1 Posted January 16, 2013 (edited) not quite sure if this would work for you but here goes nothing :D this allowdamage false; or possibly this: [color=#000000][font=Verdana]addEventHandler ["HandleDamage", {false}];[/font][/color] Hope i could help! Edited January 16, 2013 by ToxicMuffin Share this post Link to post Share on other sites
cougarxr7 1 Posted January 16, 2013 The following code works on my dedicated server. My server name is "ULTIMATE COMBAT", I run the ECS mod only. All others crash my server! You can get it here, http://www.ecsteam.online.fr/index.php?watch=downloads Download: ECS Client version 10150 ECS Client patch version 10151 Try it, you'll be glad you did! I am still in the testing phase with this. "officerE_godmode.sqf" sleep 1; counttowns = (count MissionTowns); currentprog = MissionProgress; OfficersE = [parso2,somso2,cayso2,dolso2,ortso2,corso2,obrso2,bagso2,eposo2,masso1,pitso2]; unit = (OfficersE select currentprog); hint format["%1 %2","MissionTowns =",counttowns]; sleep 3; hint format["%1 %2","MissionProgress =",currentprog]; sleep 3; hint format["%1 %2","OfficerE Name =",unit]; sleep 3; officerE_godmode = 1; unit addeventhandler["hit",{unit setdammage 0}]; unit addeventhandler["dammaged",{unit setdammage 0}]; sleep 3; for [{_loop=0}, {_loop<1}, {_loop=_loop}] do { if(officerE_godmode==1)then { unit setdamage 0; hint "OFFICER GOD MODE IS ON"; sleep 3; }else{ _loop=1 } }; unit removeEventHandler ["hit", 0]; unit removeEventHandler ["dammaged", 0]; hint "OFFICER GOD MODE IS OFF"; sleep 3; Any and all are welcome to check out and play at "ULTIMATE COMBAT"! Share this post Link to post Share on other sites
JetlinerX 1 Posted January 24, 2013 This is what I use for testing, and it works perfectly all the time. No need for this insane code. ;) this allowdamage false; Share this post Link to post Share on other sites
cougarxr7 1 Posted January 28, 2013 So this is what I should do? officerE_godmode.sqf" this allowdamage false; But how does the game engine know which Officer to run that line of code on? Share this post Link to post Share on other sites
Desrat 0 Posted January 30, 2013 add it to units init field in editor.. Share this post Link to post Share on other sites
cougarxr7 1 Posted February 18, 2013 If I did that then the Officer will always be in god mode! That is not what I am doing, God mode is to be removed from the officer when certain vars are met. As far as JetlinerX calling my code insane, he has no clue as to what I am doing. Thanks! Share this post Link to post Share on other sites
clawhammer 10 Posted February 21, 2013 Then give the unit a name and use: *NAMEOFTHEUNIT* allowdamage false; To switch godmode on *NAMEOFTHEUNIT* allowdamage true; To switch godmode off Share this post Link to post Share on other sites