Jump to content
Sign in to follow this  
Koni

Deleting triggers through a created trigger

Recommended Posts

I'm setting up a simple trigger script that will run once a condition has been met.

TRIG1 = createtrigger ["EmptyDetector", getpos player];
TRIG1 setTriggerArea [0,0,0,false];
TRIG1 setTriggerActivation ["DELTA", "PRESENT", false];
TRIG1 setTriggerText "Extra Man";
TRIG1 setTriggerStatements["this", "nul = execvm 'scriptname.sqf'", "deletevehicle 'TRIG2'"]; 



TRIG2 = createtrigger ["EmptyDetector", getpos player];
TRIG2 setTriggerArea [0,0,0,false];
TRIG2 setTriggerActivation ["ECHO", "PRESENT", false];
TRIG2 setTriggerText "AK47";
TRIG2 setTriggerStatements["this", "nul = execvm 'scriptname.sqf'", "deletevehicle 'TRIG1'"]; 



It's basically meant to be a choice for the player once they have got so far.

Two radio triggers get created, each has a different script that runs depending on which is selected, but when one is selected the other needs to be deleted, but the other isn't getting deleted once the other has been activated.

The deletevehicle using the triggers name isn't deleting the other trigger.

So what am i doing wrong please.

Share this post


Link to post
Share on other sites

Still no joy with this.

I have tried using

TRIG2 setTriggerStatements["this", "nul = execvm 'scriptname.sqf'", "deletevehicle" TRIG1];

it gives me a error missing ] no matter how many extra ] I add, lol, but runs the scripts anyway, but not deleting the other trigger.

TRIG2 setTriggerStatements["this", "nul = execvm 'scriptname.sqf'", "deletevehicle TRIG1"];

Using this runs the scripts propperly with no errors but still dosent delete the other trigger.

Tried the deletevehicle trig2 with no "" but that errors out too ?

It just seems as if the TRIG1 = CREATETRIGGER isn't naming the trigger TRIG1, but it should be doing, shouldn't it, so you can refer back to it again ?

Edited by Koni

Share this post


Link to post
Share on other sites

I cannot tell why you are not able to delete the trigger. It should work. Just for kicks maybe try a ; after the command but inside the string.

Barring that, you can use setRadioMsg to remove the radio trigger as an option.

Example to delete radio delta: 4 setRadioMsg "NULL"

Deletr radio echo: 5 setRadioMsg "NULL"

Dont forget to adjust your quotation marks if using in a code string.

Share this post


Link to post
Share on other sites

Ok, have I put this in correctly with the quotation marks in the string as it's still not removing the option of using the other radio command.

TRIG1 setTriggerStatements["this", "nul = execvm 'spawn\imaratbadguys.sqf'", "5 setRadioMsg 'NULL'"]; 

Tried putting in a ; and it didn't like it :)

Got a work around though, had to place 2 triggers on the map,

triggeractivated trig1 - On Act - 5 setRadioMsg "NULL"

and

triggeractivated trig2 - On Act - 4 setRadioMsg "NULL"

That deletes the unused trigger as I want it to, I'd just like to know why it will not work in the all in one string for the created triggers :confused:

Edited by Koni

Share this post


Link to post
Share on other sites

I've run into a similar problem. I've got an eventhandler on an object that is supposed to remove a trigger if the object takes 50 hits points.

The object hides an IED device and if the players destroy it with a satchel, the trigger that makes the IED go off should be removed... except that it just doesn't work. I've debugged it to hell and back and at the moment I think I am left, like the OP, with the depressing conclusion that the command is broken.

Arse.

Share this post


Link to post
Share on other sites
Ok, have I put this in correctly with the quotation marks in the string as it's still not removing the option of using the other radio command.

TRIG1 setTriggerStatements["this", "nul = execvm 'spawn\imaratbadguys.sqf'", "5 setRadioMsg 'NULL'"]; 

Maybe try it like this instead....

TRIG1 setTriggerStatements["this", "nul = execvm 'spawn\imaratbadguys.sqf';5 setRadioMsg 'NULL'"];

Share this post


Link to post
Share on other sites

Just tried something else.

I changed the hit EH so that instead of deleting the trigger using deleteVehicle, I tried to rewrite it's setTriggerActivation from "ANY" to "NONE", but that doesn't work either.

Share this post


Link to post
Share on other sites

OK, I've sussed this out.

If the trigger object name begins with an underscore, you can't delete it with deletevehicle even if its from within the same script.

Remove the underscore and deletevehicle works on triggers, but there may be locality issues once you do this.

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  

×