OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: silent1 on 21 Sep 2002, 17:38:29

Title: +0.1 dammage
Post by: silent1 on 21 Sep 2002, 17:38:29
  Can anyone tell me how I can add 0.1 damage to a unit over and over, just like a weapon does? I know I would have to set the amount of times to Repeated in a trigger but beyond that I'm completely lost. Any help would be appreciated.
Title: Re:+0.1 dammage
Post by: Gameer_77 on 21 Sep 2002, 18:19:20
To add 0.1 damage to a unit:

Unitname setdammage (getdammage unitname) +0.1

 8)PEACE
Title: Re:+0.1 dammage
Post by: _hammy_ on 21 Sep 2002, 18:40:32
i thought it was

this setdammage 0.1
Title: Re:+0.1 dammage
Post by: silent1 on 21 Sep 2002, 19:30:10
   Thanks Gameer_77. And Hammy - the setdammage command does exactly that - set the damage of a unit to whatever number you want between 0-1. I wanted it to ADD 0.1 damage to a unit, not to SET it to 0.1.
 
   Anyway, I was looking for more of a general command, I want any unit to get + 0.1 damage.  Any ideas? Thanks for your replies everyone.
Title: Re:+0.1 dammage
Post by: Bremmer on 21 Sep 2002, 19:53:48
You could use a script like this:


;adddammage.sqs
_unit = _this select 0
#loop
~1
_dammage = getdammage _unit
_unit setdammage (_dammage + 0.1)
? (alive _unit) : goto "loop"
exit


Call te script using [unitname] exec "adddammage.sqs"
You can adjust the loop delay (~1) to speed up or slow down the rate dammage is accumulated. You might also want to make a get-out clause in the that will allow the loop to end when the unit isn't dead (depends what you need the script for). You could do this simply be adding another line:

? exitloop : exit

then when you want the hurt to stop just make the variable exitloop = true.

Cheers
Title: Re:+0.1 dammage
Post by: silent1 on 21 Sep 2002, 22:21:05
   Thanks, that helps a lot.