Jump to content

Papyrus Scripting


sagittarius22

Recommended Posts

Your "Event OnInit()" is what needs to invoke your RegisterForUpdate().

 

Then, the "meat" of your script needs to go inside an "Event OnUpdate()" block. So it should be something like this:

 

Event OnInit()
   RegisterForUpdate(0.5)
EndEvent

Event OnUpdate()
   ; Everything you want to do goes here
EndEvent

 

Disclaimer: I'm offering this snippet without the benefit of having any Papyrus compiler or tools of any kind in front of me, but I'm as near as I can tell this is what you need to be doing. Don't take this code as gospel, though -- if there are errors, well, fix them. :)

Link to comment
Share on other sites

Your "Event OnInit()" is what needs to invoke your RegisterForUpdate().

 

Then, the "meat" of your script needs to go inside an "Event OnUpdate()" block. So it should be something like this:

 

Event OnInit()
   RegisterForUpdate(0.5)
EndEvent

Event OnUpdate()
   ; Everything you want to do goes here
EndEvent

 

Disclaimer: I'm offering this snippet without the benefit of having any Papyrus compiler or tools of any kind in front of me, but I'm as near as I can tell this is what you need to be doing. Don't take this code as gospel, though -- if there are errors, well, fix them. :)

 

exactly why I gave him the link :P

Link to comment
Share on other sites

Your "Event OnInit()" is what needs to invoke your RegisterForUpdate().

 

Then, the "meat" of your script needs to go inside an "Event OnUpdate()" block. So it should be something like this:

 

Event OnInit()
   RegisterForUpdate(0.5)
EndEvent

Event OnUpdate()
   ; Everything you want to do goes here
EndEvent

 

Disclaimer: I'm offering this snippet without the benefit of having any Papyrus compiler or tools of any kind in front of me, but I'm as near as I can tell this is what you need to be doing. Don't take this code as gospel, though -- if there are errors, well, fix them. :)

 

exactly why I gave him the link :P

In my defense, I was already typing my post before you had posted the link. ;)

Link to comment
Share on other sites

New script, but still doesn't work :( I appreciate your help guys!

Scriptname SAGPlayerInChargenMyScript extends Quest  


Quest Property InChargen  Auto  
Spell Property Rested Auto
SPell Property WellRested Auto
Spell Property MarriageRested Auto


Event OnInit()
registerForUpdate(0.5)
EndEvent

Event OnUpdate()

if Game.GetPlayer().HasSpell(Rested) || Game.GetPlayer().HasSpell(WellRested) || Game.GetPlayer().HasSpell(MarriageRested)
	Debug.MessageBox("Its okay")
else
	Debug.MessageBox("Not Okay")
Endif
EndEvent


Edited by sagittarius22
Link to comment
Share on other sites

In my defense, I was already typing my post before you had posted the link. ;)

no defense needed. I liked your explanation enough to note it down. :P

 

sag's script is useful to determine if the player has just slept (and got the bonus). Which is probably a useful script in certain situations. I need to make a script that grabs the player before they sleep.

 

as for sag, you're just going to have to spend the time playing with different functions. Idk what else to suggest, and there is like 40 some functions O.o

Link to comment
Share on other sites

Of course, if you want to detect if the player has just slept, why not RegisterForSleep() and then use the event OnSleepStop()? That method has the added benefit of firing immediately when the player stops sleeping (not up to half a second later), as well as optionally letting you determine the difference between sleep ending and sleep being interrupted.

 

The event OnSleepStart() can let you grab the player as they start to sleep...

 

 

(Why didn't I mention this sooner? Well, I forgot -- still new to Papyrus myself. :confused: )

Edited by kromey
Link to comment
Share on other sites

  • Recently Browsing   0 members

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