Home   Help Search Login Register  

Author Topic: Condition in a trigger  (Read 1468 times)

0 Members and 1 Guest are viewing this topic.

Offline edge2

  • Members
  • *
  • Ha!
Condition in a trigger
« on: 01 Aug 2008, 16:34:30 »
Hey, I'm having a problem with conditions. As far as I know, its possible to define something like thatcondition = true/false in a script... well anyway the point is that I have a trigger that I don't need to be activated unless another script has activated. I just thought that writting mycondition = false in init.sqs and in the triggers condition field writting mycondition = true. And in the second script there is mycondition = true, so when that script is activated, it's possible to activate the trigger... Im quite new with conditions and my technique just looked too simple to work,
Please help  :)
Thanks
Turning CS kiddies into OFP grunts

Offline Gcfungus

  • Members
  • *
Re: Condition in a trigger
« Reply #1 on: 01 Aug 2008, 20:57:52 »
I don't know if this will work as a solution, but I know that I don't like the true/false system and instead replace it with numbers. So you could change it to mycondition = 1.
Also, it may be important to remember the difference between = and ==.
Heres the two in examples to clear up what they mean:
Code: [Select]
mycondition = 1This means that mycondition is set to a value of 1

Code: [Select]
mycondition == 1This checks if mycondition equals 1.

You could try this, and if it doesn't work then maybe someone else could have a solution.
-=GC=-Funguns1999
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline edge2

  • Members
  • *
  • Ha!
Re: Condition in a trigger
« Reply #2 on: 03 Aug 2008, 00:33:29 »
Thanks for the help, but when I use this method... when mycondition = 1 the trigger starts even without my presence. Although that might be useful later, but not exactly what I need now. Or I'm doing it incorrectly?  ???
Turning CS kiddies into OFP grunts

Offline Optik

  • Members
  • *
Re: Condition in a trigger
« Reply #3 on: 03 Aug 2008, 02:10:17 »
I don't know if I got it right but AFAIK in the condition field, when using true/false system, you should only type mycondition (withouth the "=true")

So I think it should work

in init.sqs:

mycondition=false (but i'm not sure if this is needed at all, i use it always - newbie)

in the script somewhere

mycondition=true

and in the trigger's condition field:
mycondition

Offline edge2

  • Members
  • *
  • Ha!
Re: Condition in a trigger
« Reply #4 on: 03 Aug 2008, 02:24:09 »
Nope, the trigger automatically starts when the script is executed   >:(
Turning CS kiddies into OFP grunts

Offline Optik

  • Members
  • *
Re: Condition in a trigger
« Reply #5 on: 03 Aug 2008, 02:29:41 »
Yes, that's what I had in mind  :D

Sorry, I still don't understand the problem, a bit tired here

Quote
well anyway the point is that I have a trigger that I don't need to be activated unless another script has activated.

So, you want a trigger to remain silent until the script with trigger's condition "trues" the condition?

Could you give an example


« Last Edit: 03 Aug 2008, 02:31:28 by Optik »

Offline edge2

  • Members
  • *
  • Ha!
Re: Condition in a trigger
« Reply #6 on: 03 Aug 2008, 02:40:37 »
I thought that it'll sound with no sense. :-[
I have a trigger, which has to be activated by the player. Problem is that I need that trigger to be idle for a while and then active. Because if it is possible to activate the trigger at any time, it'll most likely mess up the mission. (Active as I can activate it by walking close to it, because with that method I can be 5 km away from the trigger and it will still start.) Hope you get the idea
« Last Edit: 03 Aug 2008, 02:44:55 by edge2 »
Turning CS kiddies into OFP grunts

Offline Optik

  • Members
  • *
Re: Condition in a trigger
« Reply #7 on: 03 Aug 2008, 02:52:34 »
Okay this is what I'd do

in init.sqs put

mycondition=true

in trigger - say you put a radius and you want to activate it when West is present, so
west/present
in condition field
this
in On activation field
[] exec "check.sqs"

make check.sqs in mission folder

and in check.sqs try this

#loop
?not mycondition : goto "execute"
goto "loop"


#execute
t1 setdammage 1 (or some other consequence)

exit
THEN make another trigger which will set, say on RadioAlpha
mycondition=false

What this does:

I made a small mission to test it. Placed a Shilka with a name t1 and a player nearby.
Placed the trigger with a radius and activation west/present, so that the player would activate it.
Placed another trigger with RadioAlpha as a condition and a mycondition=true in on activation field.

When i touched the radioalpha, shilka exploded

Summary:

check.sqs tests for mycondition=false using the loop
when it gets false it executes something

Hope this helps
« Last Edit: 03 Aug 2008, 03:09:27 by Optik »

Offline edge2

  • Members
  • *
  • Ha!
Re: Condition in a trigger
« Reply #8 on: 03 Aug 2008, 02:58:49 »
I'll Test it a little later, but before you test something like that... well from my experience, it's best to be out of the triggers activation field to see if the shilka will explode... if yes - fail if no - success  :D
Turning CS kiddies into OFP grunts

Offline Optik

  • Members
  • *
Re: Condition in a trigger
« Reply #9 on: 03 Aug 2008, 03:19:43 »
Yes it should also work with the player out of the trigger's radius, since the mycondition=true is in the init.sqs.

Offline edge2

  • Members
  • *
  • Ha!
Re: Condition in a trigger
« Reply #10 on: 03 Aug 2008, 15:34:15 »
That is what I don't need, might as well use a script if the trigger acts like that :dry:

EDIT: Right, all I needed was to write
Code: [Select]
this AND mycondition = true in the condition field  :banghead:
Thanks for the help though  :good:
« Last Edit: 04 Aug 2008, 09:25:59 by edge2 »
Turning CS kiddies into OFP grunts