OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Gruntage on 19 Feb 2010, 17:48:04

Title: Setdamage error
Post by: Gruntage on 19 Feb 2010, 17:48:04
G'day all

For some reason when i execute setdamage from the init of a unit like this:

Code: [Select]
this setdamage -10
and then put this in front:

Code: [Select]
this addeventhandler ["hit", {this setdamage -10}];
i get an error 'type bool expected object' whenever i shoot the unit. Why does this happen  ??? Ive tried it on other units on different maps and i dont get an error.

Im using an addon island do some commands not work on addon islands?
Thx in advance

Gruntage

Title: Re: Setdamage error
Post by: Planck on 19 Feb 2010, 18:22:46
Damage goes from 0 to 1, 0 being no damage and 1 being full damage.

http://www.ofpec.com/COMREF/index.php?action=details&id=291&game=All


Planck
Title: Re: Setdamage error
Post by: Gruntage on 19 Feb 2010, 18:33:34
in arma setdammage can have negative values as well.
Title: Re: Setdamage error
Post by: Wolfrug on 23 Feb 2010, 14:17:39
Because there is no "this" inside the eventhandler, but rather a local _this which is an array that contains all the data for the eventhandler (who was hit, who hit him, the amount of damage, I think):

Code: [Select]
this addeventhandler ["hit", {(_this select 0) setdamage -10}];
That should work.  :good:

Wolfrug out.