Jump to content
Sign in to follow this  
kupcho

Is it possible to link a trigger to the destruction of a map object?

Recommended Posts

I'm trying to set up a mission where my team is tasked with destroying one of the radar buildings.

I've tried to SYNC or GROUP the trigger to a static object, but it still won't trip the trigger.

I've also tried to set up separate objects that might be destroyed when the building falls, but it's real unreliable at best.

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

I would think that grouping the trigger with it would work, could you share your the full setup of the trigger? And the only other way I can think of doing it is to use the object ID (IDs have a toggle on/off in the editor) then use the nearestObject command and attach an event handler to that object that then triggers the task complete.

Something like:

_obj = [0,0,0] nearestObject XXXXXX;//>> where XXXXXX is the object ID

_obj addEventHandler ["Killed",
{
//task completed
}];

Edited by JShock

Share this post


Link to post
Share on other sites
I would think that grouping the trigger with it would work

It doesn't work, I just tried that.

You need to use the object ID's (press ctrl+i in the editor), then use this code for the trigger condition:

!alive ((getPos player) nearestObject MY_ID_NUMBER);

Share this post


Link to post
Share on other sites

You could just place a game logic or something in the middle of the radar, name it pos1 for example and put this in the trigger cond: !alive (nearestbuilding pos1)

edit. lots of ninja replies, or am I just slow? Thanks Dreaded for the ctrl+I, that was a new one for me. :)

And skip the game logic and just place the trigger in the building and: !alive (nearestbuilding thisTrigger)

Edited by Greenfist

Share this post


Link to post
Share on other sites

What building exactly are you trying to destroy? as placing a trigger grouped to a static object set as once, not present works for me on radio towers, military OPs, small houses etc.

Share this post


Link to post
Share on other sites
What building exactly are you trying to destroy? as placing a trigger grouped to a static object set as once, not present works for me on radio towers, military OPs, small houses etc.

Hmm, I can't seem to make this work, I just made a simple trigger, once, not present, as you stated, grouped it to a number of different static objects (Control Tower, radar, house, offices, etc.), and had a hint pop up onAct, and the hint showed up immediately after mission initialization for every object.

Share this post


Link to post
Share on other sites

I use this all the time, just place a gamelogic on map (side is gamelogic) set for objects, unit will be gamelogic, then put this in the initialization box:-

tower=position this nearestObject 69296

Tower is the variable name you want to use and the number after nearestObject is the ID

Then on a trigger size 0,0, in condition box:-

not alive tower

or

!alive tower

And sync this trigger to your set task state module if that's the way your doing tasks, to test without actual tasks, just put this in the on activation box of trigger too:-

hint "objective complete"

Share this post


Link to post
Share on other sites
Hmm, I can't seem to make this work, I just made a simple trigger, once, not present, as you stated, grouped it to a number of different static objects (Control Tower, radar, house, offices, etc.), and had a hint pop up onAct, and the hint showed up immediately after mission initialization for every object.

Works on my end fine. Does your Activation field say "Static object" after grouping?

The target object is in range? :)

Edited by Greenfist

Share this post


Link to post
Share on other sites
Hmm, I can't seem to make this work, I just made a simple trigger, once, not present, as you stated, grouped it to a number of different static objects (Control Tower, radar, house, offices, etc.), and had a hint pop up onAct, and the hint showed up immediately after mission initialization for every object.

Do you actually have some size to your trigger and the trigger positioned so the building is in it?

Share this post


Link to post
Share on other sites
Do you actually have some size to your trigger and the trigger positioned so the building is in it?

Well, actually, out of habit (and lack of using triggers anymore), I zeroed out the radius not even thinking, so disregard what I said :p. Main reason being the only time I use triggers is using the radio triggers, which I normally just take the radius off since it doesn't matter :D.

Share this post


Link to post
Share on other sites

Wow! Thanks for the quick replies everyone.

JShock - I tried to SYNC it and GROUP it too, but it didn't work. One other thing; I've seen the "PHP Code" thingie in several other posts...how is it used? Sorry if it's a real no brainer, I'm one of the older generation, and, although I fool around with the editor, I'm not too great at a lot of it since I don't really wright "code", I just use the tools available in the editor itself.

Greenfist - Your solution works. Thank you.

Larrow - I'm trying to kill a radar building. And as in JShock's reply, as soon as I previewed the mission (before even setting the bomb), the hint popped up. Then, after I gave the trigger a radius, big enough to cover the actual point of the building I had grouped it to, it would trigger after the charge was set off, but...

It didn't even have to actually bring down the building. It set off the trigger as soon as I set off the bombs and broke some windows. Wierd.

BUT, as stated, Greenfists solution seems to work okay.

THANK YOU ALL for your time and patience.

If your ever looking around some Friday night, I run the PIGSTY. Join in and see some of the cheesy missions I put together.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×