OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: OFPfreak on 26 Jun 2005, 08:54:54

Title: setdammage command question
Post by: OFPfreak on 26 Jun 2005, 08:54:54
Just like in the setvelocity question of mine, is it possible to add damage instead of setting it?
e.g. in my nitro loop, if the car passes it's top speed I want it to damage 0.05 every time it goes over the top speed.
Title: Re:setdammage command question
Post by: 456820 on 26 Jun 2005, 09:01:58
yep thats possible first of all you will need to find out the speed its going there might be a function the function libary for this then you can use

cardam = getdammage car

? speed > 200 : setdammage cardam + 0.05

that will add 0.05 dammage on the original cars health, that should do the trick but im still quite unshore about it
Title: Re:setdammage command question
Post by: OFPfreak on 26 Jun 2005, 09:04:02
Thanks a lot. I'm going to try it out and tell you if it works.
Title: Re:setdammage command question
Post by: 456820 on 26 Jun 2005, 09:15:09
no wait i found a problem it should be

Code: [Select]
cardam = getdammage car
_howfast = speed car

? _howfast  > 200 : setdammage cardam + 0.05

that should work this time you need to change the name of car to waht you need same with the speed 200 then it should work
Title: Re:setdammage command question
Post by: OFPfreak on 26 Jun 2005, 09:17:04
ah ok. I noticed it didnt work so I'll try this :P!
Title: Re:setdammage command question
Post by: OFPfreak on 26 Jun 2005, 09:37:35
I dont really know if its working right now. Im creating a speed checker. Im too lazy to just lower the speed since a speed checker would also be useful.
Title: Re:setdammage command question
Post by: OFPfreak on 26 Jun 2005, 10:27:27
sorry for triple post

No it does not seem to be working. It says something about cardam to be an unkown operator.
Title: Re:setdammage command question
Post by: bedges on 26 Jun 2005, 10:32:47
Code: [Select]
cardam = getdammage car
_howfast = speed car

? _howfast  > 200 : setdammage cardam + 0.05

this is what happens when posters don't know about what they're posting. the setdamage command is incorrectly used.

Code: [Select]
_cardam = getdamage car
_howfast = speed car

? _howfast  > 200 : car setdamage (_cardam + 0.05)

is the correct usage.

and yes, i am beginning to frown upon your multiple posts - modify your most recent post if it's the last in the thread to keep things tidy.
Title: Re:setdammage command question
Post by: OFPfreak on 26 Jun 2005, 10:47:07
Yay it works! Thanks all!

@bedges
Strangely enough its not

Code: [Select]
_cardam = getdamage car
_howfast = speed car

? _howfast  > 200 : car setdamage (_cardam + 0.05)

but its

Code: [Select]
_cardam = getdammage car
_howfast = speed car

? _howfast  > 200 : car setdamage (_cardam + 0.05)

(notice the extra M in getdammage)