Home   Help Search Login Register  

Author Topic: Using a trigger to execute a variable  (Read 369 times)

0 Members and 1 Guest are viewing this topic.

Offline Arctic

  • Members
  • *
  • In Utero
Using a trigger to execute a variable
« on: 19 Jun 2004, 20:58:26 »
Ok, i have finally started touching OFP again after an extended break. ...Feels good  :P

Anywho. I am (or was) constructing a claymore mine trap for the player in some burned buildings. I wrote this simple script to lopp until the player walks into the area and sets off a trigger:

Code: [Select]
#minetrap1.sqs

#Start
?mine1: goto "blow"

~2
goto "Start"

#blow
mine1 setdammage 1

~0.05
mine2 setdammage 1

~0.05
mine3 setdammage 1
exit

Ok. Now I have a trigger that is set to execute with west-once. In the 'On Activation' line, I put:

Code: [Select]
mine1=true
In game, when I run into the area, I get the following error message:

Code: [Select]
'mine1|#|=true; reserved variable in expression'

I know the error is being produced off of the '=true' portion of the code. And I kind of remember there being a 'truevariable' command that I am supposed to use, however I can't remember and have tried it already to no avail.

Thanks ahead!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Using a trigger to execute a variable
« Reply #1 on: 19 Jun 2004, 21:06:41 »
Mine1 is off course a reserved variable - just look at the
first thing you want to blow up.

mine1 setdammage 1

Why do you need your script looping until the player enters
the trigger area anyways?

Instead of saying in the onActivation field: mine1 = true,
you could simply say: [] exec "minetrap1.sqs"

And your script should then only look like below:

Code: [Select]
mine1 setdammage 1

~0.05
mine2 setdammage 1

~0.05
mine3 setdammage 1
exit

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Arctic

  • Members
  • *
  • In Utero
Re:Using a trigger to execute a variable
« Reply #2 on: 19 Jun 2004, 21:19:23 »
Geeze I never even thought about the variable-name conflicts! Thank you for your quick response! I had it looping because I feared that the script would run anyways unless if I had a variable that would start it.