Jump to content

Making a timer for a day


Imrinfected

Recommended Posts

I'm guessing I can't use getsecondspassed since.. That's a lot of seconds.

 

I need a certain part of a script to run only after a day has passed, but I'm not sure how to go about it. I don't use timers much.

 

See, I'm making a mod that adds an ability to npcs who have less than 10 or so health, that damages their fatigue by like 100000, so they're on the ground, "unconcious." Could be useful for knocking people out instead of killing them, and doing it seemlessly without equipping some special weapon or something. I plan on adding a new item, "Smelling Salts" that remove the ability from npcs that it's used on. I got this great idea. Instead of making it an item or a spell or anything like that, I'll make it a misc inventory item that you click, which adds a spell to your spell list that is then equipped. It's on touch, so you have to be right next to them, and when you use it, instead of casting a spell, the player plays the searching animation(Where he leans down to search a body. NPCs do it, you've probably seen it before) when they press the cast spell key, because it detects of that action button is being pressed, and thus applies the smelling salts in a very cool way. Of course, it still works like a spell(The npc that the spell was supposed to be cast on has the fatigue damaging ability removed, play is returned to idle after animation is completed, smelling salts and spell is removed from inventory.)

 

This way, NPCs can be knocked unconscious without the use of any special weapon, and left for dead, or to execute later in whatever way they please. After a day has passed, that npc will have the fatigue damaging ability removed from them, everything is cool. Friendly npcs can be brought back once they're healed(Otherwise they'll fall right back into unconsciousness, if below 10 health) making for a very cool way of doing things. I'm thinking adding some other thing, like shaking them or something, to wake them up less efficiently would be cool.

 

The main advantage of this is to make fighting enemies more immersive. Being attacked by bandits may leave the player with a few unconscious khajiits to do whatever they want to. I could add a special addon that makes Essential NPCs work off of this, but instead of dying, they're unconscious indefinitely until woken up by smelling salts/shaking, or waiting a day.

 

This won't apply to the PC for obvious reasons.

 

I.. Just need to figure out how to make the timer count a day, instead of seconds. Or if I have to use seconds, how many to count, and the most reliable way to do this.

Link to comment
Share on other sites

This is part of a script from the Shivering Isles that makes you hear a rumor about a door in Niben Bay one day after the Shivering Isles Expansion is installed. It sounds quite a bit like what you are looking for. All you would have to do is remove all the dead code, and change a few things to match your purpose.

 

I don't think it is very accurate as far as making something happen exactly 24 hours after the first event, but even if it came out to 16 to 32 hours, that might work for you. It seems reasonable that people might be unconscious for different and random lengths of time.

 

I may be wrong, but Oblivion does not seem to have a function for counting hours elapsed. The designers only wanted to count seconds elapsed for spell effects, and days elapsed for certain quests.

 

scn SE01DoorScript

short doOnce
short doOnce2
short startday

short BelmyneStart
short BelmyneDead
float timer
short gatespeechVAR

short goAway
float timer2
short metroOnce

short weatherOnce
float weathertimer

Begin GameMode

;this times the weather transition
if ( weatheronce == 1 )
	set weathertimer to ( weathertimer + GetSecondsPassed )
	if ( weathertimer >= 3 )
		sw SEClearTrans
		set weatheronce to 2
	endif
endif

;this section sets a journal to let the player know a door has appeared to the Shivering Isles
if ( GetStageDone MQ01 90 == 1 )
	if ( doOnce2 == 0 )
		set startday to GameDaysPassed
		set doOnce2 to 1
	endif
endif

if ( doOnce2 == 1 )
	if ( GameDaysPassed >= ( startday + 1 ) )
		if ( GetStage SE01Door == 0 )
			SetStage SE01Door 10
		endif
	endif
endif  

Link to comment
Share on other sites

This is part of a script from the Shivering Isles that makes you hear a rumor about a door in Niben Bay one day after the Shivering Isles Expansion is installed. It sounds quite a bit like what you are looking for. All you would have to do is remove all the dead code, and change a few things to match your purpose.

 

I don't think it is very accurate as far as making something happen exactly 24 hours after the first event, but even if it came out to 16 to 32 hours, that might work for you. It seems reasonable that people might be unconscious for different and random lengths of time.

 

I may be wrong, but Oblivion does not seem to have a function for counting hours elapsed. The designers only wanted to count seconds elapsed for spell effects, and days elapsed for certain quests.

 

scn SE01DoorScript

short doOnce
short doOnce2
short startday

short BelmyneStart
short BelmyneDead
float timer
short gatespeechVAR

short goAway
float timer2
short metroOnce

short weatherOnce
float weathertimer

Begin GameMode

;this times the weather transition
if ( weatheronce == 1 )
	set weathertimer to ( weathertimer + GetSecondsPassed )
	if ( weathertimer >= 3 )
		sw SEClearTrans
		set weatheronce to 2
	endif
endif

;this section sets a journal to let the player know a door has appeared to the Shivering Isles
if ( GetStageDone MQ01 90 == 1 )
	if ( doOnce2 == 0 )
		set startday to GameDaysPassed
		set doOnce2 to 1
	endif
endif

if ( doOnce2 == 1 )
	if ( GameDaysPassed >= ( startday + 1 ) )
		if ( GetStage SE01Door == 0 )
			SetStage SE01Door 10
		endif
	endif
endif  

That's genius!

 

Thank you, this will work perfectly.

 

EDIT: Wait wait, no it won't. With this, if a person is knocked unconscious at 11:59 in-game, they will get back up in one minute, very predictably, at midnight. That's not what I want.

 

EDIT: I think I'll just use the Gamehour variable for this. I think I've figured out a way for it to work.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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