Jump to content
IGNORED

How to force exit an event or function (papyrus)


Recommended Posts

Hi,

 

Is there a function to break/end an event or function? Something like (conceptually):

Event OnActivate() / Function whatever()

if actor == game.getplayer()

   endevent / endfunction... (?)

endif

<rest of event/function code to happen if the actor is not the player>

EndEvent / EndFunction

 

For sure I can embed the whole code into an if, but at some point it becomes unnecessarily complicated, whereas a simple event / function break would be a lot easier

 

TY

 

 

Link to comment
3 hours ago, SAC said:

Hi,

 

Is there a function to break/end an event or function? Something like (conceptually):


Event OnActivate() / Function whatever()

if actor == game.getplayer()

   endevent / endfunction... (?)

endif

<rest of event/function code to happen if the actor is not the player>

EndEvent / EndFunction

 

For sure I can embed the whole code into an if, but at some point it becomes unnecessarily complicated, whereas a simple event / function break would be a lot easier

 

TY

 

 

Just use "return". You can place it several times, as many, as needed, and first one encountered on code execution will end your function.

Link to comment
9 hours ago, DeWired said:

Just use "return". You can place it several times, as many, as needed, and first one encountered on code execution will end your function.


Thank you very much! Would that work to exit an event too? I realize I should just test but I’ll be AFK for a while, I’m just reading now from my phone :) 

 

TY!!

Link to comment
On 11/27/2019 at 7:45 AM, SAC said:


Thank you very much! Would that work to exit an event too? I realize I should just test but I’ll be AFK for a while, I’m just reading now from my phone :) 

 

TY!!

 

Tested and it works on events too. Thank you again!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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