OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Knight Trane on 22 Apr 2008, 18:02:27

Title: Triggers, help please
Post by: Knight Trane on 22 Apr 2008, 18:02:27

  Hi there,

I have a Mission I making, that involves targets materializing as u walk through an area.

I have set up my "Targets" and named them.  Condition of presence : False

I've set up my "Triggers" but, I don't know the proper command to put in the "On Activation" field.

I thought it would something like      TargetName setCondition True

I've checked the CommandRef, looked at the Tuts, and don't see anything that helps.

Please, if u respond;  include any links that may help with just the basic commands.   Everything I'm finding is script related.  I just need to learn the editor right now.

Thank you.
Title: Re: Triggers, help please
Post by: Mandoble on 22 Apr 2008, 18:10:11
What do you mean with "target materialization"?
Title: Re: Triggers, help please
Post by: Knight Trane on 22 Apr 2008, 18:19:25
Go from no presence to present.

Make presence = true.  Maybe the term is "Spawn".
Title: Re: Triggers, help please
Post by: Denz on 22 Apr 2008, 18:47:34
I think I know what you are trying to do. CreateVehicle (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=c#86) is what you are looking for.
Off the top of my head
Try something like this in the init line of a trigger
Quote
target = "TargetEpopup" createVehicle getmarkerpos  "trig1"

This uses a marker called trig1 for the target to appear in.

Also check the Comref for the class name for the targets (http://www.ofpec.com/COMREF/armavehicles.php#Thing) you want to use.
Title: Re: Triggers, help please
Post by: Knight Trane on 22 Apr 2008, 19:12:40
Thank you,

I have already positioned my target right where I want it with setPos [xxxx,yyyy,zzzz]  with a certain azmith.

Isn't there a setting for the presence, that the trigger can switch to make the presence True.

Forgive my ignorance with the Code.  The CommandRef is helpful if you know what you're looking for.  I will try your suggestion though.

Thanks.   

Title: Re: Triggers, help please
Post by: Cheetah on 22 Apr 2008, 20:45:27
Quote
A unit with a Condition of Presence that returns false will not exist in the mission
source: biki

So, best might be to spawn the targets.

Alternatively, you can place them in the editor and give them a name. Then, have a script which saves their position and puts them somewhere far far away on some island for example. If they should be 'up' you can then setpos them back to their original (and saved) position.
Title: Re: Triggers, help please
Post by: Rommel92 on 22 Apr 2008, 21:25:42
Code: (TRIG#) [Select]
ANYBODY - PRESENT
Condition: this
OnAct: target = "TargetEpopup" createVehicle [x,y,z]

You claim you already have [x,y,z] coordinates you wish to use, well good on ya, wack em in there, put there trigger you want them to go off when someone walks through it, and voilah. Your set.

 :good:
Title: Re: Triggers, help please
Post by: Knight Trane on 22 Apr 2008, 23:56:49
Rommel92 You are a god!
I may make you a rifleman in my Corps.
works great.  Thanks.

Is there anyway to put the azmith in there?

Denz and Cheeta, thanks for the replies but I couldn't get a simple trigger to work.  Let alone figure out what getPos is or whats it for.   

I'm going low and slow, but I'll be cruisin soon.


Thanks, :cool2:
Title: Re: Triggers, help please
Post by: johnnyboy on 23 Apr 2008, 02:12:45
User setdir for azimuth:

Code: [Select]
ANYBODY - PRESENT
Condition: this
OnAct: target = "TargetEpopup" createVehicle [x,y,z]; target setdir 90
Title: Re: Triggers, help please
Post by: Knight Trane on 23 Apr 2008, 16:11:28
Thanks johnnyboy,

I found that in the CommandRef.  Put it in same line and "Bobs your uncle".  But another problem has cropped up.  When I put several targets in the "On Activation" field, I get one target spawning for every instance that the Trigger is tripped. 

For instance:

I placed a trigger with something like this in On Activation:TargetA= "abc" creatVehicle [xx,yy,zz]; TargeA setDir 45;TargetB= "abc" creatVehicle [xx,yy,zz]; TargeB setDir 45;.  I thought that would give me 2 Tartgets at different locations at the same time.  But, it doesn't.  I gives me one Target per intance that the trigger is tripped. 
So my next question is this:   Should the command in the On Activation field for this Trigger be createGroup, or some sort of string, or an array?

I have to say that I am very greatefull for the help you guys give.  I know you all must have better things to do. 
Thanks,
Title: Re: Triggers, help please
Post by: johnnyboy on 23 Apr 2008, 17:46:54
All code in the On Activation field should execute, so it should create 2 targets.  Be sure that each target has a different name (i.e., TargetA and TargetB, like you stated). Be sure that the positions for each are where you want them.  Maybe it created a target, but it put in BF Egypt so you can't see it.  Be sure the type of object ("TargetEpopup") is typed correctly for each.

You have other options:

1. Put your object creation code in a script, and call the script from the On Activation field.

2. Instead of using createVehicle, you can actually place all the targets via the editor.  Then in your init.sqs, move them all to position [0,0,0].  Your triggers would then be simpler, they would setpos targets where you wanted them.