OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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.
-
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
-
Thanks a lot. I'm going to try it out and tell you if it works.
-
no wait i found a problem it should be
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
-
ah ok. I noticed it didnt work so I'll try this :P!
-
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.
-
sorry for triple post
No it does not seem to be working. It says something about cardam to be an unkown operator.
-
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.
_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.
-
Yay it works! Thanks all!
@bedges
Strangely enough its not
_cardam = getdamage car
_howfast = speed car
? _howfast > 200 : car setdamage (_cardam + 0.05)
but its
_cardam = getdammage car
_howfast = speed car
? _howfast > 200 : car setdamage (_cardam + 0.05)
(notice the extra M in getdammage)