OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BaKaRa on 17 Mar 2003, 23:05:40
-
Hi again!
I want to use this " morphine script " in a mission ( East01 is the name of the unit ;D ) :
------------------------------------------------------------------------------------------
#Drug
Player removeaction 0
East01 setbehaviour "safe"
_health = getDammage East01
East01 switchMove "LyingToTreatedLying"
_health = getDammage East01
_newhealth = _health - 0.20
East01 setDamage _newhealth
East01 setbehaviour "aware"
Exit
#Exit
Exit
------------------------------------------------------------------------------------------
But the problem is that the script must not run if the player's health > X and it could be run ( by the " addaction " command ) if player's health < X
So if someone could modify that by adding a command who do a jump to "Exit" if Health < X and another jump to "Drug" if Health > X
I hope you understand and see what i mean ;D
-
The syntax you are looking for is known as "if ... then". In OFP script it looks like this
? condition is true: do this
For example:-
? East01 getdammage <0.1:exit
or
? East01getdammage>0.7: goto "Drug"
PS - the line
_health = getDammage East01
appears twice in the script for no obvious reason.
-
Don't work :'(
Please type me the full script
Thanks
-
No, I won't type you the full script.
Apart from the fact that you are giving the impression that you expect somebody to create your mission for you, rather than doing it yourself, you obviously haven't read the sticky topic at the head of this board.
I can tell, because contrary to instructions you haven't told us ANYTHING AT ALL about your problem. So how are we supposed to help you?
What do you mean, "it doesn't work"? Do you understand what I mean by "if ... then"? Have you checked my syntax in the command reference? What have you tried? What happened?
We'll help you, but a) you have to do some work and b) you have to tell us what's wrong. ;)
-
I found the problem :
---------------------------------------------------------------------------------------
?(GetDammage East01 > 0.1): goto "Drug"
#Exit
Exit
#Drug
Player removeaction 0
East01 setbehaviour "safe"
_health = getDammage East01
East01 switchMove "LyingToTreatedLying"
_health = getDammage East01
_newhealth = _health - 0.20
East01 setDamage _newhealth
East01 setbehaviour "aware"
Exit
---------------------------------------------------------------------------------------
Yeah, i searched in the command referance, you syntax with " GetDammage " was false, has you can see up
Thanks you MacGuba for try to help me :-* ;D
-
:) :) :)
NEVER trust my syntax. Or anyone else's come to that. Always check the command ref.