Page MenuHomeFeedback Tracker

Missing of scripting command : damageAllowed object
Acknowledged, WishlistPublic

Description

We need a scripting command to know if an object has been "allowDamage false" or true.

The suggested command is :
Syntax: damageAllowed object
Parameters: object: Object
Return Value: Boolean

The command is needed because we want to set temporary invulnerable an object.
But when finished, we want to restore the vulnerability only if no other script make it invulnerable too.

Details

Legacy ID
2471361863
Severity
None
Resolution
Open
Reproducibility
N/A
Category
Scripting
Steps To Reproduce

Example :

_was_damage_allowed = damageAllowed object; // <= the requested command
_my_object allowDamage false;

Doing my stuff
...

// Restoring the initial vulnerability
_my_object allowDamage _was_damage_allowed;

Event Timeline

madbull edited Steps To Reproduce. (Show Details)Jun 16 2014, 1:46 PM
madbull edited Additional Information. (Show Details)
madbull set Category to Scripting.
madbull set Reproducibility to N/A.
madbull set Severity to None.
madbull set Resolution to Open.
madbull set Legacy ID to 2471361863.May 7 2016, 6:45 PM

Note :
Using (then removing) the event handler HandleDamage to return 0 is not a viable solution.
Because returning 0 doesn't only make it invulnerable, but also do a "setDamage 0".
In addition, the missing of the "getHit" command makes difficult/impossible to keep the health status properly.

Although I personally don't see the need for such command, if added, the name should be

isDamageAllowed

to keep with Arma SQF commands names convention.

Also allowdamage takes local argument, this means isDamageAllowed would query only local instance of the object. This would be pretty awkward.

Thanks for your comments. I'm agree for the command name, isDamageAllowed is clearer.

Although I personally don't see the need for such command

What do you suggest ? :) You have a better solution to make temporary an object indestructible (without "corrupting" its current damage state) ?

I need an example of practical problem to answer that. Not sure if the example you provided makes a compelling case for such command, well at least I'm not sure why do you need to use it there.

Well fine, there might be a case when you might want to know if after changing locality the object is allowed to take damage on particular client, maybe. I'm not against new commands, was just curious about the usefulness of this particular one.

Couldn't you use the setVariable command when changing the damage allowance in the provided example?

@Killzone_Kid :
I had two different needs about the invulnerability :

  • Be invulnerable when a condition NOT depending of the future damage events is true -> I succeed easily with allowDamage
  • Compute a condition depending of the damage event context to know if the current Damage Event has to be ignored -> I succeed hardly with HandleDamage EH.

The two needs have been fullfilled. So I'm personnaly OK :)
The first need is not perfect because doing "allowDamage true" at the end may do vulnerable an object which has been set invulnerable by another script or by the mission maker.
The second need was hard due to the getHit missing but never mind.
I used some tricks and it is not 100% perfect.

@SilentSpike :

Couldn't you use the setVariable command when changing the damage allowance in the provided example?

Of course if there is only my script running on Arma. But we need the command to ensure compatibility between other scripts and with the mission maker choices in the initialization line (if he adds "allowDamage false" on specific objects).