OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: greg_t on 10 Dec 2002, 15:12:07
-
It's a modified FlareTrap.sqs from Chris's Script Editor. I've tried to make it loop through all west soldiers in the area and spawn a flare above them. It works but spews back an error and I can't stand things not working 100% so here I am.
The error is " _flare = _type CamCreate _posFlare" l#l error type any, expected number.
The trigger is "west detected by east, repeatedly"
This is the script:
; Get the parameters given
_trigger = _this Select 0
_color = _this Select 1
_height = _this Select 2
; Find targets to light up
_targetList = List _trigger
_numTargets = Count _targetList
_targetNum = 0
; Get the position of the targets
#List
?(_targetNum > _numTargets): Goto "Exit"
_postarget = GetPos (_targetList Select _targetNum)
; Create the position for the flare to drop (Z + 150 m)
_x = _posTarget Select 0
_y = _posTarget Select 1
_z = (_posTarget Select 2) + _height
_posFlare = [_x, _y, _z]
_targetNum = _targetNum + 1
; Create the flare
?(_color == "WHITE"): _color = ""
_type = "Flare" + _color
_flare = _type CamCreate _posFlare
CamDestroy _flare
Goto "List"
#Exit
Exit
;***********
-
I'm not 100% certain, but I think that _x, _y, and _z are reserved variables. Try changing those variable names to see if that solves your problem.
-
nope it appears there is something else at work, i've also found that if the flare is too low then snipers that are found get killed by the flare. is there a way to make the flare drop in a random position within "x" distance of the players?
-
I'm not sure what's causing your error message, but to answer your latest question, use the random command.
_x = (_posTarget Select 0) + random(10) - 5
_y = (_posTarget Select 1) + random(10) - 5
This will place the flare within a random square up to +/- 5 meters from the unit's location.
-
what is the minimum value of the random function?