OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Captain Winters on 06 Apr 2003, 02:45:02

Title: Get Damage And Play Music?
Post by: Captain Winters on 06 Apr 2003, 02:45:02
 ;D ;DWell I have a problem. You see i have a small piece of code inside of a trigger that reads:

(sn) getDammage if > 0.1 == playMusic "signs"

Now this doesn't work... Can you help me out with this? What I need is a little script that starts to play music once this guy's (sn) dammage is greater than 0.1? Help? Please? I know there's tons of scripting smarties out there!  8) ;D

Tanks!  8) ;D
Title: Re:Get Damage And Play Music?
Post by: _hammy_ on 06 Apr 2003, 05:19:28
I dont really know how to use the getdammage command, but if you could tell me what error you get when you run that line, then maybe I could help you.

EDIT:
after looking at the command reference...
you could maybe try this:

Code: [Select]
damage = getdammage player
? (damage >= 0.1):playmusic "blubber"

i dont know if the second line is correct...
Title: Re:Get Damage And Play Music?
Post by: _hammy_ on 06 Apr 2003, 05:26:16
(sn) getDammage if > 0.1 == playMusic "signs"
found a little error in that line.

it should be (if thats how you use getdammage...?)
(sn) getdammage if > 0.1:playmusic "signs"
Title: Re:Get Damage And Play Music?
Post by: Captain Winters on 06 Apr 2003, 05:30:10
Damn, for all of the errors I get an "Unknown Operator"... Lemme See. G2 jet to bed. Nighty night, i'll sleep on it... PLEASE HELP!  8) :o ??? :-\ :-[

Tanks!  :o 8) ;D
Title: Re:Get Damage And Play Music?
Post by: Knut Erik on 06 Apr 2003, 12:22:13
I think you must put this in a script....
Not all commands are suported in the editor, so just try that...
 :P
Title: Re:Get Damage And Play Music?
Post by: Captain Winters on 06 Apr 2003, 17:47:55
 :o ;D I'll give a whack at it Erik! Thanks!

Tanks!  8) ;D :D :)
Title: Re:Get Damage And Play Music?
Post by: MorMel on 06 Apr 2003, 19:26:02
? getdammage MyUnit > 0.1 : playmusic "signs"
Title: Re:Get Damage And Play Music?
Post by: Captain Winters on 06 Apr 2003, 23:23:14
Mhm. That doesn't work either. Thanks thouigh guys.  I found a work around for my problem! Thanks for the help! You're all going into the credits!  8) ;D

Tanks!  8)
Title: Re:Get Damage And Play Music?
Post by: Der_Richter on 07 Apr 2003, 00:44:48
actually:

if(getDammage _Unit  > 0.1){playmusic "signs"};

is correct. i believe.
Title: Re:Get Damage And Play Music?
Post by: Sui on 07 Apr 2003, 02:50:17
LOL! ;D

The only correct syntax in this whole thread has been in MorMel's post :)

Not trying to put anyone down here, but all you need to do is check out the official command reference if you're after correct syntax.

You can do this using either a trigger:

Trigger

Radius: 0,0
Condition Field: (getdammage unit) > 0.1
OnActivation Field: playmusic "signs"

or with scripting commands:
Sorry guys, I probably shouldn't have stuck my oar in here. It just frustrates me to see someone with a question getting (slightly) wrong advice.
Not meaning to rub anyone up the wrong way, I'm sure as hell not god's gift to scripting... ;D

But if you are ever in doubt about syntax, all you need to do is have a quick peek at the Official Command Reference ;)
Title: Re:Get Damage And Play Music?
Post by: Der_Richter on 07 Apr 2003, 08:31:24
hehe. no need to worry. i forgot to put "then" in. i wrote this up about 00:30 AM, here, after a days work... hehe. kinda gets that way some times. itÂ's good to get it pointed out for u when u forget something...
Title: Re:Get Damage And Play Music?
Post by: Captain Winters on 09 Apr 2003, 23:55:56
lol... Thanks for the help guys!   ;D

Tanks 8-)