Jump to content

Script Help


renogaz

Recommended Posts

So basically my script its the next one

 

Scriptname xxxxx extends ObjectReference

{script xxxxxx}

 

float days

float days1

int count

 

Event OnActivate(ObjectReference akActionRef)

count = count+1

if count ==1

Debug.MessageBox("You found a xxxxxx")

else

Debug.MessageBox("You pick up xxxxx")

endif

days = Utility.GetCurrentGameTime()

Debug.MessageBox("xxxxx" + days)

RegisterForSingleUpdate(5)

 

endEvent

 

Event OnUpdate()

days1 = Utility.GetCurrentGameTime()

if days1 >= days + 3.000000

Debug.MessageBox("xxxxx")

UnregisterForUpdate()

else

RegisterForSingleUpdate(5)

endif

 

endEvent

 

 

What i want to do is when i pickup the x object, the days1 variable keeps running and the days variable stay static on the gametime when i picked it up, and after 3 ingame days display a message,

my problem is that when i get to 3 or more days after pickup i keep recieving the message, is there a way to make it so after days1 >= days + 3.000000 the Event OnUpdate stops?

Link to comment
Share on other sites

Scriptname xxxxx extends ObjectReference 
{script xxxxxx}

int count
bool bActivated = False

Event OnActivate(ObjectReference akActionRef)
count += 1
if count == 1
	Debug.MessageBox("You found a xxxxxx")
else
	Debug.MessageBox("You pick up xxxxx")
	If !bActivated
		RegisterForSingleUpdateGameTimeUpdate(72)	; update in 72 hours (3 days)
		bActivated = True
	EndIf
endif
endEvent

Event OnUpdateGameTime()
Debug.MessageBox("xxxxx")
bActivated = False
endEvent

Edited by steve40
Link to comment
Share on other sites

Scriptname xxxxx extends ObjectReference 
{script xxxxxx}

int count
bool bActivated = False

Event OnActivate(ObjectReference akActionRef)
count += 1
if count == 1
	Debug.MessageBox("You found a xxxxxx")
else
	Debug.MessageBox("You pick up xxxxx")
	If !bActivated
		RegisterForSingleUpdateGameTimeUpdate(72)	; update in 72 hours (3 days)
		bActivated = True
	EndIf
endif
endEvent

Event OnUpdateGameTime()
Debug.MessageBox("xxxxx")
bActivated = False
endEvent

 

 

i tried the script but it wont work, nothing shows up after 72 hrs, also the object is a MISC pickable object, not an activator or something like that, that has someething to do with that?

Link to comment
Share on other sites

Ug, I could swear I fixed that typo earlier... it should be:

 

RegisterForSingleUpdateGameTime(72)

 

not

 

RegisterForSingleUpdateGameTimeUpdate(72)

 

oops :facepalm:

 

yeah i noticed that and changed that, but still wont work for some reason, the var active its set to true when i showvars but wont show any box :(

Link to comment
Share on other sites

You need to register for updates inside of a function...

 

taking steve40's example and adjusting it

 

Scriptname xxxxx extends ObjectReference
{script xxxxxx}

int count
bool bActivated = False

Event OnActivate(ObjectReference akActionRef)
       count += 1
       if count == 1
               Debug.MessageBox("You found a xxxxxx")
       else
               Debug.MessageBox("You pick up xxxxx")
               If !bActivated
                       DoMyUpdate()
               EndIf
       endif
endEvent

Function DoMyUpdate()
       RegisterForSingleUpdateGameTime(72)       ; update in 72 hours (3 days)
       bActivated = True
EndFunction

Event OnUpdateGameTime()
       Debug.MessageBox("xxxxx")
       bActivated = False
endEvent

 

Link to comment
Share on other sites

You need to register for updates inside of a function...

 

taking steve40's example and adjusting it

 

Scriptname xxxxx extends ObjectReference
{script xxxxxx}

int count
bool bActivated = False

Event OnActivate(ObjectReference akActionRef)
       count += 1
       if count == 1
               Debug.MessageBox("You found a xxxxxx")
       else
               Debug.MessageBox("You pick up xxxxx")
               If !bActivated
                       DoMyUpdate()
               EndIf
       endif
endEvent

Function DoMyUpdate()
       RegisterForSingleUpdateGameTime(72)       ; update in 72 hours (3 days)
       bActivated = True
EndFunction

Event OnUpdateGameTime()
       Debug.MessageBox("xxxxx")
       bActivated = False
endEvent

 

 

 

Thanks for reply, but its not working yet :/, what im doing its a pickable object, and i want to show the box after beign 3 days in my pocket, but it wont work yet, i dont know why, when i drrop the object and use "showvars" it tells me that bActivated its true, but after 3 days i dont get any message :/

Link to comment
Share on other sites

  • Recently Browsing   0 members

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