Need help with a timer script

Post » Sat May 28, 2011 3:10 am

hi, i want to make a local script which ( if possible ) uses only local variables, that runs every random 1-7 days.
so, when the player enters the cell, it should check if enough days since the last visit have passed,
and if this is true, the rest of the script should be executed.

i don't know how to count the days passed when using a local script.

hope, someone can help!
User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Sat May 28, 2011 8:54 am

I'm not sure if I'm understanding you correctly. Are wanting the script to possibly run at least one day after and if at least 7 days have passed the script must run when the player enters?
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Sat May 28, 2011 6:47 am

short localdayshort randumbshort doonceshort targetdayif ( doonce == 0 )        set localday to day        set randumb to ( ( random, 6 ) + 1 )        set targetday to ( day + randumb )        set doonce to 1endifif ( localday != day )      set localday to dayendifif ( getpccell == "name of cell you are checking" )        if ( localday >= targetday )                ;do stuff        else                return        endifendif


something like this?

edit, script rewrite, i dont know what i was thinking earlier.
User avatar
abi
 
Posts: 3405
Joined: Sat Nov 11, 2006 7:17 am

Post » Fri May 27, 2011 8:18 pm

[edit]

it works now, thanks RAKninja
User avatar
Tammie Flint
 
Posts: 3336
Joined: Mon Aug 14, 2006 12:12 am

Post » Sat May 28, 2011 1:56 am

[deleted]
User avatar
Leah
 
Posts: 3358
Joined: Wed Nov 01, 2006 3:11 pm

Post » Sat May 28, 2011 6:29 am

what was wrong the first time?

oh, by the by, this is kinda a "barebones" version of the backbone of a lot of things i add in my own mod. i too often need to enforce a variable delay on the player.
User avatar
Zualett
 
Posts: 3567
Joined: Mon Aug 20, 2007 6:36 pm


Return to III - Morrowind