Jump to content
Sign in to follow this  
Chance536

Creating guarded points and deleting them via script

Recommended Posts

So I'm trying to create a couple guarded points with a script. I can create them with createGuardedPoint,  but I can't seem to delete them. I tried deleteVehicle which did not work at all. My thinking is that it is not a vehicle so I can't delete it this way. I need to delete them after that portion of the mission is over so that other guard units that spawn later don't try and go to them.

test1 = createGuardedPoint [east, getPosATL testM3, -1, objNull];
sleep 20;
deleteVehicle test1;

So next I tried just creating the trigger guarded by opfor because I know deleteVehicle works on them and couldn't seem to get the trigger working at all. It doesn't produce errors it just doesn't work. This is the first time I've ever tried spawning a trigger because I've had no need to before, so I've probably just screwed this up. 

_trg = createTrigger ["East G", getPos testM3];

I also tried putting them down in the editor and using enableSimulation but that throws errors that the variable is not defined even with a sleep to make sure it's created before the code runs, if that's even a thing. That may not cancel the guard status anyway just something else I had tried. If anyone knows a better way to do this or a way to get one of my three methods I've failed at working it would be greatly appreciated.

Share this post


Link to post
Share on other sites

createGuardedPoint has no return value, so your handle "test1" is nil. They can not be deleted or changed.

 

Your trigger:

_trg = createTrigger ["East G", getPos testM3];

is not being created due to syntax error, as you are trying to set the trigger type in the wrong place. The first param is labeled "type" in the Biki, but for the purposes of creating a trigger, it should be "EmptyDetector."

 

_trg = createTrigger ["EmptyDetector", getPos testM3]; 

 

Use setTriggerType to make it a guarded point.

_trg setTriggerType "EAST G";

 

But then, I can't get a scripted "Guarded by" trigger to work at all. Maybe I'm missing something.

 

  • Like 3

Share this post


Link to post
Share on other sites
13 hours ago, Harzach said:

createGuardedPoint has no return value, so your handle "test1" is nil. They can not be deleted or changed.

 

Your trigger:


_trg = createTrigger ["East G", getPos testM3];

is not being created due to syntax error, as you are trying to set the trigger type in the wrong place. The first param is labeled "type" in the Biki, but for the purposes of creating a trigger, it should be "EmptyDetector."

 


_trg = createTrigger ["EmptyDetector", getPos testM3]; 

 

Use setTriggerType to make it a guarded point.


_trg setTriggerType "EAST G";

 

But then, I can't get a scripted "Guarded by" trigger to work at all. Maybe I'm missing something.

 

Ok this makes more sense. I incorrectly assumed type could be any of the types listed in setTriggerType, even though it says it usually should be "EmptyDetector". I'll try this out and see if I can't get it working somehow. If not it's not going to ruin the mission or anything. For this particular scenario the guarded by triggers were just causing the AI to behave much better than normal, without heavily scripting them.

Share this post


Link to post
Share on other sites
4 hours ago, Chance536 said:

incorrectly assumed type could be any of the types listed in setTriggerType

 

In the description section of the createTrigger entry:

Quote

The type must be a class name in CfgNonAIVehicles or CfgVehicles with simulation = detector

 

But it's an easy assumption to make as the "type" parameter is not well-explained in the syntax section.

 

Good luck!

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  

×