Jump to content

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

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use