Jump to content

[LE] Triggers - performance and trigger lists?


sornan

Recommended Posts

Hey everyone :smile:

 

 

I've become pretty reliant on the GetDistance command for working out quest content in scripts, yet it comes with its random issues due to cell borders.

 

I'm looking at the triggers to possibly simplify and refine things on occasion, but there are a few things about triggers I'm not sure of despite web searches. Let me ask a few questions regarding triggers that I have not found an answer to:

 

 

Trigger Performance Impacts

 

I've read that triggers should be limited in their width distance to reduce performance impacts... In exterior areas would performance impacts of triggers only be limited to the cell they are in, or can they impact game play in the entire exterior world space? I would be wanting to replace distance checks with triggers that could be covering areas of 300 to 400 or more (not sure if the distance command uses feet), but the same distances.

 

 

Trigger Lists

 

I would like to use some fairly large width (radius) triggers to detect when a number of certain actors are within the borders of those triggers - yet so far I only have found a command to get a count of the total actors within a trigger, not a way to actually gain a list (array) of all of the actors within the triggers where you can then see if certain actors are within the trigger area (via array check?).

 

 

I'm used to modding Armed Assault 3 in the past where triggers can give you a list of whom is in those borders, but I don't know if this game can do that, and don't know about the performance impacts of potentially large radius triggers as well.

 

 

Any input would be appreciated. :smile:

Link to comment
Share on other sites

1) Placing massive 'Trigger Boxes' in exterior cells is something i don't know, i have never been forced to do so.

I can tell you thought that in interior cells the size of the 'Trigger Boxes' plays no role, some of my massive cells have groups of massive trigger boxes.


2) "Trigger Performance Impacts":

Ok, here the answer is YES and NO, to be a little more detailed the whole thing has to do with what "EVENT" you will use.


a - EVENT OnTrigger()

The advantage with this event is the same with its disadvantage, the event will fire 'Multiple Times' when the actor / object is inside of it and it will keep firing for as long as the object or objects remain inside of it.

So yes, this can definitely cause performance impact on a large scale.


b - EVENT OnTriggerEnter()

This event will fire only one time whenever the actor enters it or / and whenever another one also enters it, and that's it. The same applies for its opposite "OnTriggerLeave()".

So if you want / need to do something on a massive scale and count a large amount of actors and continuously, then this is the way to go since the whole thing has nearly "0" performance impact.



"I'm used to modding Armed Assault 3 in the past where triggers can give you a list of whom is in those borders,"

Yes it can be done, i haven't but there is already a vanilla script that does something similar, as a matter of fact now that i thought of it, is more easy to do than i original thought, it only neds some simple common logic.


Have a happy modding.

Link to comment
Share on other sites

Thanks maxarturo :smile:

 

The information helps indeed.

 

Yes, the OnTriggerEnter would also present some complexities in script, where one would be keeping track of each actor that entered, rather than using OnTrigger where the list of actors in the trigger is updated automatically.

 

May I ask, is there a way to shut down one of these events? Like, supposing I use the OnTrigger event, and then once the conditions are satisfied for something to happen, the event is shut down and therefore essentially removed?

 

I'm confident with the events one can incrementally build a list of their own in script as to whom is in a trigger area, yet without an actual command to just get the list the code could become a bit lengthy and somewhat complex for something that would be done regularly, at least in my quest, where GetDistance is tons simpler (one liner check), yet a little buggy due to cell borders.

 

I was hoping that maybe some other people have done this with triggers, but if not, I'll probably stick with GetDistance. I could only imagine if I wanted to get the triggers to do this would require either a custom function or copy and paste code system, and really not wanting to go that far with it.

 

Thanks :smile:

Edited by sornan
Link to comment
Share on other sites

If by 'Shut Down' you mean to not use again that "Event" after it has done its job, then the answer is:

a) You can not Shut Down a script and keep using it, always taking what you say literally just in case to cover the circumstance that you have misunderstood or miswrote what you were thinking.


The only way to Shut Down a script is to either:

- Delete the script and alongside the object that it's living in.

- Or use "States" and call an "AllDone" state that will be "Empty" = No Events inside of it.


b) To have an "Event" disabled / Inactive in your script, and for your script to keep functioning / doing its "NEXT" things, is to use "States".

For Example:

AUTO STATE Sequence01

EVENT SomeEvent.....

If ...... Your condition has been met

GoToState("Sequence02") ;It now jumps to the next "State" / Event

or group of Event inside that State

EndIf

; If the condition has not been met, then it will stay in this "State" > Sequence01

ENDEVENT

ENDSTATE



STATE Sequence02

EVENT SomeEvent..... or a group of Events

For now on your script will only execute the Event / Events that are living inside

this State, as long as a change of 'State' is not called, or change the 'State' if you call it to.

ENDEVENT

ENDSTATE


* I don't know what you are trying to do, but there is also the "OnLocationChange()" event that can easily be used on exterior cells, the only thing that's needed is to have those exterior cells to own / have a their location.


Have a nice weekend.

Link to comment
Share on other sites

Thanks :)

 

Yea, that's some kind of funky stuff with the events. But I do understand, likely for simplicity I would just go for shutting down the script.

 

The command .Stop () , is that what ends a script - i.e. - MyScript.Stop () ?

I've noticed that when a quest is stopped, it looks like the quest scripts still continue to run.

 

Have a good weekend too :)

Link to comment
Share on other sites

There is absolutely nothing wrong admitting that you don't know or that you don't comprehend something, admitting something is the only way that others can actually understand your modding level and they can provide the apropriate necessary assistance, we are all here just to help and not to judge.


Calling the most powerful tool that papyrus has "funky stuff" could easily be misinterpreted by others and you can easily be marked as a 'Wanna Be' and a 'Show Off' by the way you write things and the vocabulary you choose to use, i'm saying all of this with the best intentions.


I've already explained you that scripts can not be shut down the way you have it in your head.


The "Stop()" function is used only for stopping:

- EffectShaders

- VisualEffects

- Sound Functions

- Scenes

- Quests


And that's it !!, you can not use this function beyond the above, it will do absolutely nothing !, except printing an error on the papyrus log !!.


* If you learn only methods you will be tied to those methods, but if you learn principles you can device your own methods.


Have a happy modding.

Link to comment
Share on other sites

To me, it is funky with the way controlling the usage of multiple events in a script works, there nothing wrong with saying that, it's my opinion, I could have said that's 'odd', or whatever. It's surprising to me there isn't an on/off switch for individual events.

 

I'll try the delete function, sounds like that will work to shut down scripts.

 

Thanks for the help.

Link to comment
Share on other sites

I didn't mean to upset you, all was just wrote only with the best intentions.


Keep in mind that the "Delete()" function will also delete the object that the script is living in when the "Delete()" is called.


Have a happy modding.

Link to comment
Share on other sites

At very least I should have thanked you for the code example, regardless of my opinion of how the game handles event usage in code.

 

Thank you for the help, and happy post-Thanksgiving :smile: (all of our leftovers are gone now :sad: )

 

Take care

Edited by sornan
Link to comment
Share on other sites

  • Recently Browsing   0 members

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