Home   Help Search Login Register  

Author Topic: Need help for a simple script  (Read 1017 times)

0 Members and 1 Guest are viewing this topic.

BaKaRa

  • Guest
Need help for a simple script
« 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

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Need help for a simple script
« Reply #1 on: 17 Mar 2003, 23:31:31 »
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.  



« Last Edit: 17 Mar 2003, 23:33:32 by macguba »
Plenty of reviewed ArmA missions for you to play

BaKaRa

  • Guest
Re:Need help for a simple script
« Reply #2 on: 17 Mar 2003, 23:47:45 »
Don't work  :'(
Please type me the full script
Thanks

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Need help for a simple script
« Reply #3 on: 18 Mar 2003, 00:02:45 »
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.   ;)
« Last Edit: 18 Mar 2003, 00:06:31 by macguba »
Plenty of reviewed ArmA missions for you to play

BaKaRa

  • Guest
Re:Need help for a simple script
« Reply #4 on: 18 Mar 2003, 00:07:33 »
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

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Need help for a simple script
« Reply #5 on: 18 Mar 2003, 00:09:29 »
 :) :) :)

NEVER trust my syntax.    Or anyone else's come to that.     Always check the command ref.
Plenty of reviewed ArmA missions for you to play