Jump to content

Timer Script won't work


Nightfox3

Recommended Posts

I am trying to make a script for a vendor machiene. When the activation-Object is activated, I want to receive an item 10 seconds afterwards.(I know, a bit long)

But when I activate the object with the script in-game, nothing happens.

After hours of looking for a solution on the web, I still don't know what I am doing wrong.

So I decided to ask here.

 

 

 

 

 

 

Here is my script:

 

ScriptName MyTimer
int timer
int temp123
Begin OnActivate player
set temp123 to 1
End
Begin GameMode
if(temp123 == 1)
if (timer < 10)
set timer to timer + GetSecondsPassed
else
player.additem 000340b5 1
set temp123 to 0
endif
endif
End
Any kind of help is appriciated.
Link to comment
Share on other sites

GetSecondsPassed returns a float value, which will be rounded if it's added to an int variable, causing it not to increment. Change your timer variable to a float and it will work.

 

Also, you don't need to use the hexadecimal form ID in scripts, the editor ID ShotGlass01 will work just fine and you will know what it is at a glance without having to look it up.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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