Jump to content

Papyrus Scripting


sagittarius22

Recommended Posts

Hi,

 

I've a script here; I'd like it to be run during gamemode, never stopping; but for some reasons it does not seem to work, even if the script compiles without errors... Here it is:

 

Scriptname SAGPlayerInChargenMyScript extends Quest

Quest Property MyProperty  Auto
Spell Property Rested Auto
SPell Property WellRested Auto
Spell Property MarriageRested Auto
Function SomeFunction()              
 registerForUpdate(0.5) ; Before we can use onUpdate() we must register.
EndFunction

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

 

No message appear, so that means something is done wrong...

Edited by sagittarius22
Link to comment
Share on other sites

Meh, I was only asking because this seems to be the exact thing I was trying to accomplish with my mod. I need to know when the payer has slept, but I wasn't sure if it was more effective to have a continuously running script or script the beds themselves. I still am not sure which is more efficient. :psyduck:

 

EDIT: But I agree w/ philip. Something needs to be using a function. Better to have an event which starts it. :thumbsup:

Link to comment
Share on other sites

I made this:

Scriptname SAGPlayerInChargenMyScript extends Quest  


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

Function SomeFunction()                
 registerForUpdate(0.5) 
EndFunction


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


But it does not have any effect :psyduck:

Edited by sagittarius22
Link to comment
Share on other sites

  • Recently Browsing   0 members

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