Jump to content

[LE] Basic Papyrus Question


Recommended Posts

Hey everyone,

 

I'm fairly new to modding so forgive my noobness and I can't find the answer to this particular question on the wiki although it's probably right under my nose.

 

Let's say I have a script with a bunch of events:

 

Event OnEventA()

Do stuff

EndEvent

 

Event OnEventB()

Do stuff

EndEvent

 

Event OnEventC()

Do stuff

EndEvent

 

etc

 

 

When I trigger the script to run in game, does the game read once through the script top to bottom checking for each event and if none of the events occur then that's it, the script is over, the script has gotten to the bottom and those events missed their window of opportunity since they did not occur when the script ran?

 

Or does the script sit waiting for each event to occur?

If they sit waiting for the event to occur can they occur in any order?

 

Or does it all depend on what the script is attached to?

Or does it depend on the particular event?

 

I hope the explanation of my question was clear enough. Please let me know if I need to elaborate further on what is confusing me.

Thank you so much for your help guys and girls!

Edited by shatsnazzle
Link to comment
Share on other sites

Depends mate. An event can be called in a script in various ways. Attached to an object reference the OnActivate events attached to it's scripts are called. That's in the engine.

 

You can call any event manually by calling the function name.

 

Events/functions will usually fire in the order they are called. And functions will wait for another function to finish before it moves on with the flow.

Edited by B1gBadDaddy
Link to comment
Share on other sites

While events can be called like functions from other scripts, the Event type exists specifically because each one corresponds to some activity (i.e. event) that can occur in the game. So when you activate an object the game calls the OnActivate event for that object (if it's defined in some script attached to the object). When you take an item from a container there are three events and the item that was moved gets OnContainerChanged, the player gets OnItemAdded, and the container gets OnItemRemoved.

Technically you can have the same event defined in multiple scripts all attached to the same object and they will all be called if the action that triggers the even happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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