Home   Help Search Login Register  

Author Topic: Setdamage error  (Read 2003 times)

0 Members and 1 Guest are viewing this topic.

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Setdamage error
« 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

« Last Edit: 19 Feb 2010, 18:08:22 by Gruntage »
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Setdamage error
« Reply #1 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
I know a little about a lot, and a lot about a little.

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Setdamage error
« Reply #2 on: 19 Feb 2010, 18:33:34 »
in arma setdammage can have negative values as well.
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Setdamage error
« Reply #3 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.
"When 900 years YOU reach, look as good you will not!"