Doodle 10 Posted January 16, 2014 Currently the enemy are taking a vast amount of bullets to kill them. Is there a peice of code I could put maybe in init.sqf that will make the enemy take more damage from each round? Maybe something using the handledamage EVH but I have no idea how to implement it. Thanks in advance Share this post Link to post Share on other sites
IndeedPete 1036 Posted January 16, 2014 Maybe this (untested) will help: { if ((side _x) == East) then { _x addEventHandler [ "HandleDamage",{ _unit = _this select 0; _selection = _this select 1; _passedDamage = _this select 2; _source = _this select 3; _projectile = _this select 4; _oldDamage = 0; switch(_selection)do{ case("head"):{_oldDamage = _unit getHitPointDamage "HitHead";}; case("body"):{_oldDamage = _unit getHitPointDamage "HitBody";}; case("hands"):{_oldDamage = _unit getHitPointDamage "HitHands";}; case("legs"):{_oldDamage = _unit getHitPointDamage "HitLegs";}; case(""):{_oldDamage = damage _unit;}; default{}; }; _return = _oldDamage + ((_passedDamage - _oldDamage) [color="#FF0000"][b]* 2[/b][/color]); _return } ]; }; } forEach allUnits; You can change the red marked multiplier in order to let them get more or less damage. Share this post Link to post Share on other sites
Doodle 10 Posted January 16, 2014 WOW Quick reply many thanks - will give this a test and report back - Any idea if this is DEDI and JIP compatible? And am I correct that *2 means my rounds will do twice as much damage to the enemy as vanilla - so I am guessing *4 would mean my rounds would be four times more lethal? Once again thanks Share this post Link to post Share on other sites
champ-1 40 Posted January 16, 2014 This one is better because it doesn't increase damage from environment (fall damage, fire damage, etc) and it works only on infantry. Also it updates every minute so any new spawned units/players start to take more damage after a minute. while {true} do { { if (_x isKindOf "Man") then { _x removeAllEventHandlers "HandleDamage"; _x addEventHandler ["HandleDamage",{ _unit = _this select 0; _selectionName = _this select 1; _damage = _this select 2; _source = _this select 3; _projectile = _this select 4; if (_projectile != ("")) then { _return = _damage * 2; _return }; }]; }; } forEach allUnits; sleep 60; }; Share this post Link to post Share on other sites
Doodle 10 Posted January 16, 2014 Cool another option - will try them both out over the next few days and see what one best suits the mission Thanks guys ---------- Post added at 12:46 PM ---------- Previous post was at 12:32 PM ---------- This one is better because it doesn't increase damage from environment (fall damage, fire damage, etc) and it works only on infantry.Also it updates every minute so any new spawned units/players start to take more damage after a minute. while {true} do { { if (_x isKindOf "Man") then { _x removeAllEventHandlers "HandleDamage"; _x addEventHandler ["HandleDamage",{ _unit = _this select 0; _selectionName = _this select 1; _damage = _this select 2; _source = _this select 3; _projectile = _this select 4; if (_projectile != ("")) then { _return = _damage * 2; _return }; }]; }; } forEach allUnits; sleep 60; }; Previewing from editor When I copied this into my init.sqf for some reason the init failed to complete - Is copying it into the init the way to run this? or am I doing something wrong? Share this post Link to post Share on other sites
IndeedPete 1036 Posted January 16, 2014 Maybe you should spawn it into a separate thread, e.g.: _nul = [] spawn { while {true} do { { if (_x isKindOf "Man") then { _x removeAllEventHandlers "HandleDamage"; _x addEventHandler ["HandleDamage",{ _unit = _this select 0; _selectionName = _this select 1; _damage = _this select 2; _source = _this select 3; _projectile = _this select 4; if (_projectile != ("")) then { _return = _damage * 2; _return }; }]; }; } forEach allUnits; sleep 60; }; }; Share this post Link to post Share on other sites
champ-1 40 Posted January 16, 2014 I just execute it via separate script. Works just fine. Share this post Link to post Share on other sites
tryteyker 28 Posted January 16, 2014 Having loops in the init is probably not the best idea. Try running it in a second script with a waituntil time > 0 and player == player just to be extra safe. Share this post Link to post Share on other sites
Doodle 10 Posted January 16, 2014 Copied this into init,sqf and it worked perfectly - 6 or us just tested for 5 hours and all agreed it was much better, made the game enjoyable again as having to pump a magazine into a guy to kill him was getting depressing! Thnak for your help Maybe you should spawn it into a separate thread, e.g.: _nul = [] spawn { while {true} do { { if (_x isKindOf "Man") then { _x removeAllEventHandlers "HandleDamage"; _x addEventHandler ["HandleDamage",{ _unit = _this select 0; _selectionName = _this select 1; _damage = _this select 2; _source = _this select 3; _projectile = _this select 4; if (_projectile != ("")) then { _return = _damage * 2; _return }; }]; }; } forEach allUnits; sleep 60; }; }; Share this post Link to post Share on other sites
toxicsludge 12 Posted January 17, 2014 Wow, looking at the above responses, I feel like such a noob! I just change their damage value in the editor and remove their first aid kits so they can't heal themselves when they spawn :/ Share this post Link to post Share on other sites