Jump to content
axonmagnus

how do i go about disabling fall damage ?

Recommended Posts

This is what I use. i dont know if its perfect but it works...

 



nolandDamage =
{
_damage = 0;

if((_this select 4) != "") then
{
_damage = _this select 2;
};

_damage
};


{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];  } foreach (units (group player));

  • Thanks 1

Share this post


Link to post
Share on other sites

 

This is what I use. i dont know if its perfect but it works...
 
nolandDamage =
{
_damage = 0;

if((_this select 4) != "") then
{
_damage = _this select 2;
};

_damage
};


{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];  } foreach (units (group player));

 

thanks buddy I will try it out :D , just to clarify do I add this to the ini also how would I go about implementing it as a mod so that it works with wat ever scenario I play ?

am guessing using ares ?

Share this post


Link to post
Share on other sites

 

This is what I use. i dont know if its perfect but it works...
 
nolandDamage =
{
_damage = 0;

if((_this select 4) != "") then
{
_damage = _this select 2;
};

_damage
};


{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];  } foreach (units (group player));

 

thanks buddy it works :D , also can you explain to me every line , I truly appreciate it :D

Share this post


Link to post
Share on other sites

thanks buddy I will try it out :D , just to clarify do I add this to the ini also how would I go about implementing it as a mod so that it works with wat ever scenario I play ?

am guessing using ares ?

 

yes put the code in init.sqf. as for making it mod I'm sorry I cannot help you because I've never make a mod.

Share this post


Link to post
Share on other sites

thanks buddy it works :D , also can you explain to me every line , I truly appreciate it :D

 

ok here's commented version:

nolandDamage =
{
_damage = 0;

// if this damage has no projectile string, then it's fall damage. if its not fall damage (but getting shot damage) then set the _damage variable to hold the actual damage amount and return that
if((_this select 4) != "") then
{
_damage = _this select 2;
};

// return the damage dealt to this unit
_damage
};


// make all units in players group call nolanddamage function when damaged by something:
{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];  } foreach (units (group player));
Edited by gc8
  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Always helpful to explain why something works.  Good to ask for the explanation, and great to provide it!  It helps everybody learn. :)

  • Like 1

Share this post


Link to post
Share on other sites

 

ok here's commented version:

nolandDamage =
{
_damage = 0;

// if this damage has no damage string such as head,torso etc then it's fall damage. if its not fall damage (but getting shot damage) then set the _damage variable to hold the actual damage amount and return that
if((_this select 4) != "") then
{
_damage = _this select 2;
};

// return the damage dealt to this unit
_damage
};


// make all units in players group call nolanddamage function when damaged by something:
{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];  } foreach (units (group player));

brilliant thanks you very much sir , you indeed deserve 10 internet points :D

​"doubt kills more dreams than failure ever will"

unkown

  • Like 1

Share this post


Link to post
Share on other sites

Always helpful to explain why something works.  Good to ask for the explanation, and great to provide it!  It helps everybody learn. :)

indeed sir , have a good day gentlemen

Share this post


Link to post
Share on other sites

Extra fact, this script will also disable vehicle collision damage I am pretty sure.

 

Yes it will actually disable a lot of things because this 

 

 

// if this damage has no damage string such as head,torso etc then it's fall damage.

is wrong. 

 

the function nolandDamage will be executed multiple times in 1 frame. Once for the head, once for the legs, hands ..... and once for ""

 

From my experiments, 

You can have "" even when you receive a bullet. So setting damage to 0 could even heal players if the part "" is checked after the other parts.

And, in case of fall damages, you 'll most likely be hit in the legs too, so setting damage to 0 for "" will not disable damages for "legs". 

Share this post


Link to post
Share on other sites

Yes it will actually disable a lot of things because this 

is wrong. 

 

the function nolandDamage will be executed multiple times in 1 frame. Once for the head, once for the legs, hands ..... and once for ""

 

From my experiments, 

You can have "" even when you receive a bullet. So setting damage to 0 could even heal players if the part "" is checked after the other parts.

And, in case of fall damages, you 'll most likely be hit in the legs too, so setting damage to 0 for "" will not disable damages for "legs". 

 

actually I made mistake commenting that. the nolandDamage function does not check the body part hit but it tests bullet type that was hit. Now if the bullet type string is empty then its fall/collision damage.

 

not sure about the heal issue though. from my experiments it does not heal because I put damage 0.7 on the unit before falling to ground and the damage stayed at 0.7.

Share this post


Link to post
Share on other sites

 

ok here's commented version:

nolandDamage =
{
_damage = 0;

// if this damage has no projectile string, then it's fall damage. if its not fall damage (but getting shot damage) then set the _damage variable to hold the actual damage amount and return that
if((_this select 4) != "") then
{
_damage = _this select 2;
};

// return the damage dealt to this unit
_damage
};


// make all units in players group call nolanddamage function when damaged by something:
{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];  } foreach (units (group player));

hey buddy it seems to not be working any more I have no idea why :(

​I get invalid number in expression

​line 14

Share this post


Link to post
Share on other sites

hey buddy it seems to not be working any more I have no idea why :(

​I get invalid number in expression

​line 14

 

hi

 

then you must have changed something. Please post your code that has the error.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×