Jump to content
SophionBlack

Position of unit that activates a trigger

Recommended Posts

I'm beyond rusty when it comes to scripting and mission editing; it has been close to a decade since I messed around with things. My problem is this:

 

I'm trying to put into a trigger "on activation" field a simple script that fires two mortar rounds at a detected unit. The trigger is activated by BLUFOR detected by OPFOR and in the script on activation is simply:

 

_BeatenZone = [(getpos _this select 0), (getpos _this select 1), (getpos _this select 2)]; Mortar1 doArtilleryFire [_BeatenZone, "8Rnd_82mm_Mo_shells", 2]

In the process of debugging I added hints to walk through where the code is going off the rails and at the below script it returns "Any, Any, Any":

 

hint format ["triggered %1", _BeatenZone]

which means the old way of doing thins is just that, old and outdated. What is the new way that works? 

Share this post


Link to post
Share on other sites
1 hour ago, beno_83au said:

https://community.bistudio.com/wiki/String

 

By the look of it you need to be using thisTrigger instead of _this if that's all you've got on the triggers onActivaton.

 

And even more simply:

Mortar1 doArtilleryFire [getPos thisTrigger, "8Rnd_82mm_Mo_shells", 2];

 

The actual position of the trigger is returned not the position of the unit that activated the trigger.

Share this post


Link to post
Share on other sites
2 hours ago, SophionBlack said:

the position of the unit that activated the trigger.

Specificity is key. Also, I gave the wrong link (fixed now) - https://community.bistudio.com/wiki/Eden_Editor:_Trigger

 

Scroll down to the On Activation description and you'll see that thisList and thisTrigger exist in the On Activation field, but _this does not. So as you need the position of the one who activated the trigger you're going to need to use thisList to get the unit, keeping in mind that it returns a "list of all objects in trigger area, based on 'Activation'", I.e. it returns an array:

 

_unit = thisList # 0;

Mortar1 doArtilleryFire [getPos _unit, "8Rnd_82mm_Mo_shells", 2];

 

  • Like 2

Share this post


Link to post
Share on other sites

Also remember that the trigger will remain active as long as any activating units is still in the area. Unless you provide a custom condition the trigger will not activate again until all triggering units have left.

 

 

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

×