Jump to content

Help with timer script, please


Rhyne13

Recommended Posts

I'm a totally noob scripter and have been working through mods scripts and the Geck wiki.

 

Could someone tell me why this script does not work? (What am I missing or doing wrong?)

 

 

 

.
float AnimationTimer
.
.
.
                                               ;Wait 15 seconds
		set AnimationTimer to 0
  		If ( AnimationTimer < 15 )
			set AnimationTimer to ( AnimationTimer + GetSecondsPassed )
		else
			addItem OutfitPrewarCasualwear 1 1
			equipItem OutfitPrewarCasualwear 0 1
			
		endif

 

 

What I thought it would do: count 15 seconds and cause an NPC to change outfits

 

As far as I can tell, it does nothing.

 

Also, is it necessary to have a DoOnce If clause?

 

:thanks:

Link to comment
Share on other sites

I'm a totally noob scripter and have been working through mods scripts and the Geck wiki.

 

Could someone tell me why this script does not work? (What am I missing or doing wrong?)

 

 

 

.
float AnimationTimer
.
.
.
                                               ;Wait 15 seconds
		set AnimationTimer to 0
  		If ( AnimationTimer < 15 )
			set AnimationTimer to ( AnimationTimer + GetSecondsPassed )
		else
			addItem OutfitPrewarCasualwear 1 1
			equipItem OutfitPrewarCasualwear 0 1
			
		endif

 

 

What I thought it would do: count 15 seconds and cause an NPC to change outfits

 

As far as I can tell, it does nothing.

 

Also, is it necessary to have a DoOnce If clause?

 

:thanks:

 

15 seconds from what? Are you activating an object?

 

You need to have the Begin and End commands.

 

scn [color="#FF0000"]SCRIPTNAME[/color]

float AnimationTimer
short DoOnce
short Next

Begin OnActivate [color="#00FF00"];Runs when object is activated[/color]
if ( DoOnce == 0 )
	set DoOnce to -1
	set Next to 1 [color="#00FF00"];Runs next section[/color]
endif
End

;Wait 15 seconds

Begin GameMode [color="#00FF00"];Runs when game is playing[/color]
if ( Next == 1 ) [color="#00FF00"];Waits until object is activated[/color]
	set AnimationTimer to AnimationTimer + GetSecondsPassed
	set Next to -1 [color="#00FF00"];Prevents this section from looping once object is activated[/color]
		if ( AnimationTimer < 15 )
			"[color="#FF0000"]NPC REFERENCE HERE[/color]".addItem OutfitPrewarCasualwear 1 1
			"[color="#FF0000"]NPC REFERENCE HERE[/color]".equipItem OutfitPrewarCasualwear 0 1
			set AnimationTimer to -1
		endif
endif
End

I'm not entirely sure that is right, but try it.

 

You must add a reference to the NPC you want this to work on, and you must check persistence on.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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