OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Judge856 on 07 Apr 2003, 19:40:12

Title: Bad script???
Post by: Judge856 on 07 Apr 2003, 19:40:12
; **********************************************************************
; **** Shoots a flare up when a trigger is activated.
; ****
; **** 2 parameters needed:
; ****    1. Trigger trap is attached to. (Object)
; ****    2. Color of flare. ("WHITE", "RED", "GREEN", "YELLOW") (String)
; ****
; **** Example how to use:
; ****    TRIGGER:
; ****    Radius: 50
; ****    Name: Trap_1
; ****    Activation: WEST + PRESENT + REPEATEDLY
; ****    On Activation: [Trap_1, "GREEN"] Exec "FlareTrap.sqs"
; ****
; **** By CHenderMan@cableone.net
; **********************************************************************

; Get the parameters given
"Trap_1" = _this Select 0
"Green" = _this Select 1

; Get the position of the trigger
posTrap_1 = GetPos "Trap_1"

; Create the position for the flare to drop (Z + 150 m)
x = posTrap_1 Select 0
y = posTrap_1 Select 1
z = (posTrap_1 Select 2) + 150
posFlare = [x, y, z]

; Create the flare
?("FlareGreen" == "Green"): "Green" = ""
type = "FlareGreen" + "Green"
"FlareGreen" = FlareGreen CamCreate posFlare
CamDestroy "FlareGReen"

Exit

Can anyone tell me whats wrong with this script, because I've no idea what I've done wrong? :-[
Title: Re:Bad script???
Post by: Judge856 on 07 Apr 2003, 20:52:54
Anyone have any clue, I'm not sure how to set up the co-ords so any advice would be appreciated.
Title: Re:Bad script???
Post by: Judge856 on 08 Apr 2003, 00:32:17
I NEED SOME ADVICE HERE
Title: Re:Bad script???
Post by: _hammy_ on 08 Apr 2003, 00:44:04
what errors do you get?
Title: Re:Bad script???
Post by: _hammy_ on 08 Apr 2003, 01:01:08
after looking over it, i found some errors:
it should be:

Code: [Select]
; **********************************************************************
; **** Shoots a flare up when a trigger is activated.
; ****
; **** 2 parameters needed:
; ****    1. Trigger trap is attached to. (Object)
; ****    2. Color of flare. ("green", "white", "yellow", "red") they must be exact and include "
; ****
; **** Example how to use:
; ****    trigger:
; ****    Radius: 50
; ****    Name: Trap_1
; ****    Activation: WEST + PRESENT + REPEATEDLY
; ****    On Activation: [Trap_1, "green"] Exec "FlareTrap.sqs"
; ****
; **** By CHenderMan@cableone.net
; **********************************************************************


; Get the parameters given
_trap_1 = _this Select 0
_green = _this Select 1

; Get the position of the trigger
_posTrap_1 = GetPos _trap_1

; Create the position for the flare to drop (Z + 150 m)
_x = _posTrap_1 Select 0
_y = _posTrap_1 Select 1
_z = (_posTrap_1 Select 2) + 150
_posFlare = [_x, _y, _z]

; Create the flare
?(_green == "green"): _green = "Flaregreen"
?(_green == "white"): _green = "Flare"
?(_green == "yellow"): _green = "Flareyellow"
?(_green == "red"): _green = "Flarered"
_flaregreen = _green CamCreate _posFlare

exit

i think that works, i redid all of the "create flare" section.