OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: FiLL2d on 07 Jul 2006, 02:09:11

Title: A past if statement coming true, even though the script has past it.
Post by: FiLL2d on 07 Jul 2006, 02:09:11
#end
if (fill distance gamelogic1 >= 10) then {goto "dontteleport"} else {goto "teleport"};

#teleport
hint "teleport"
fill setpos getpos gamelogic2
exit

#dontteleport
hint "dont teleport"
exit

Hi can anyone help me here, the script checks how close fill is to gamelogic1 and then makes an outcome, if fill is not in the range of 10m of the gamelogic1 it won't teleport him to gamelogic2 - but if he is in the range it will teleport him to gamelogic2.

The problem is that soon as the script goes to #teleport, the soldier named fill goes out of the range of 10m from gamelogic1 and thus #dontteleport is then ran.

I didn't think this happened, i thought OFP ignored the if statement once an outcome has been excuted, any ideas? thanks.
Title: Re: A past if statement coming true, even though the script has past it.
Post by: Mr.Peanut on 07 Jul 2006, 14:27:42
Very weird. Try deleting the semi-colon at the end of your if statement. It might be preventing the script engine from recognising the #teleport label.


PS this is not an MP topic and should have been posted in Editing/Scripting General
Title: Re: A past if statement coming true, even though the script has past it.
Post by: FiLL2d on 07 Jul 2006, 16:06:39
Hi, thanks for the reply, even without the ; on the end it still does the same thing

edit: ah, the script was activating like this [fill, "attack"] exec "decide.sqs" but their was no #attack, wierd how it made the script do this.