Jump to content

Joining trigger boxes?


Recommended Posts

Hi,

 

If there are multiple discontiguous trigger boxes but they will all have the same scripts attached to them with the same properties, then is it possible to 'join' them in some way so that I only have to add the script and properties once?

When editing the esp this would help avoid missing out some of the trigger boxes! :smile:

 

I'm wondering if the 'Enable Parent' and 'Activate Parents' tabs are relevant?

 

diziet

Link to comment
Share on other sites

You can not "Join" trigger boxes the way you can join "Roombounds", each trigger box is an independent existence.

What you can do if you have multiple trigger boxes that they will all fire the same script only once,

For example: enableing an enemy from different entering points of the player in your doungeon.


Is to make 2 different scripts:

1) The first script will be living in the trigger boxes and it will have a simple script that when entering it will send an "Activate(Self)" to your "Master Controller Script", the trigger box script after Activating the "Master Controller Script" will "Self.Disable() & "Self.Delete()", and optionaly you can add Disable() & Delete() with the number of your trigger boxes, so that when one is triggered will disable & delete the other trigger boxes.



2) Make a "Master Controller Script" that will be living on an "xMarkerActivator".


* If you won't be adding disable() - delete() pointing to the other trigger boxes (in your trigger box script), then you will need to make your "Master Controller Script" with STATES, so after first activation it will stop listening for a "Activate(Self)" called from the other trigger boxes to the xMarkerActivator.


Your "Master Controller Script" can handle and do whatever function you want upon getting activated by any of the trigger boxes.

Your "Master Controller Script" can also handle the disable() - delete() of all the trigger boxes after it has been Activated.

Edited by maxarturo
Link to comment
Share on other sites

 

You can not "Join" trigger boxes the way you can join "Roombounds", each trigger box is an independent existence.
What you can do if you have multiple trigger boxes that they will all fire the same script only once,
For example: enableing an enemy from different entering points of the player in your doungeon.
Is to make 2 different scripts:
1) The first script will be living in the trigger boxes and it will have a simple script that when entering it will send an "Activate(Self)" to your "Master Controller Script", the trigger box script after Activating the "Master Controller Script" will "Self.Disable() & "Self.Delete()", and optionaly you can add Disable() & Delete() with the number of your trigger boxes, so that when one is triggered will disable & delete the other trigger boxes.
2) Make a "Master Controller Script" that will be living on an "xMarkerActivator".

 

Okay this is interesting, I don't want to disable the trigger boxes, just edit one script rather than 2 or three. Can a 'master controller script' have access to the triggerref when the boxes are activated?

Link to comment
Share on other sites

"Can a 'master controller script' have access to the triggerref when the boxes are activated?"


I don't really understand you here...

But, the whole point of making a "Master Controller Script" is to have all the functions that otherwise would be living in your trigger boxes living in the "Master Controller Script".

If you a trying to say that, if the "Master Controller Script" can activate back each trigger box, that depends on how and what are you trying to do.

Posting your script or adding more detail to what you are trying to do would be much more helpful for the ones that are trying to assist you, i don't know your mod and i'm shooting blind here...

Link to comment
Share on other sites

 

"Can a 'master controller script' have access to the triggerref when the boxes are activated?"
I don't really understand you here...
But, the whole point of making a "Master Controller Script" is to have all the functions that otherwise would be living in your trigger boxes living in the "Master Controller Script".
If you a trying to say that, if the "Master Controller Script" can activate back each trigger box, that depends on how and what are you trying to do.
Posting your script or adding more detail to what you are trying to do would be much more helpful for the ones that are trying to assist you, i don't know your mod and i'm shooting blind here...

 

Ordinarily the script i attach to a trigger box has a line like:

Event OnTriggerEnter(ObjectReference triggerRef)

Actor akactionRef = triggerRef as Actor

 

If I attach the script to the xMarkerActivator will it still be activated as if it were attached directly to the trigger box?

Link to comment
Share on other sites

This line is used in the "Trigger Box" script, so that any Actor can trigger it when entering it = followers, foes, animals... etc.


So it won't make any sense having this line/condition on an "xMarkerActivator".


For what you are trying to do a correct approach is something like this.

Here is a simple script structure example of the use of a "Master Controller Script":


1) Script living on ALL trigger boxes and they are all pointing towards the xMarkerActivator.


ObjectReference Property MasterActivator Auto

{The xMarker Activator that has your Master Controller Script}


EVENT onTriggerEnter(objectReference triggerRef)

Actor triggerActor = triggerRef as Actor

if triggerActor

MasterActivator.Activate(Self)

EndIf

ENDEVENT


2) The script living on the xMarkerActivator "Master Controller Script" and that has the execution of the same functions that previously were living on all trigger boxes.

And it will execute them whenever it gets Activated by any of the trigger boxes.


Sound Property MyAlarmSFX Auto

{The Sound FX to play when this gets triggered by any of the Trigger Boxes Pointing to this xMarker Activator}


Event OnActivate(ObjectReference akActionRef)

MyAlarmSFX.Play(Self)

; And any other functions you may want

EndEvent



I hope that is simple and clear enough, if not, just shout...

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...