Jump to content

Scripting Question


bencebence

Recommended Posts

Edited once again:

scn WakeUpPlayerQuestScript

float time
short aweken

begin GameMode
set time to GameHour
if player.getincell aaaLillyhallCastlePrivateQuarters
	if time == 7
		WAkeUpPC
		set aweken to 1
	endif
endif
if aweken == 1
	bedroomservant01.moveto player
	bedroomservant01.StartConversation player, WakeUpSir
endif
end

Shall this work? (Didn't test it yet.)

Link to comment
Share on other sites

Hmm, maybe let's redesign this a little.

 

While the player is sleeping only MenuMode blocks will get executed.

So put the check for time and cell into the MenuMode block together with WakeUpPC and set this "aweken" variable accordingly.

 

WakeUpPC now should throw you out of MenuMode back into GameMode, as it's waking you up and putting you back into the game.

So put the "if aweken == 1" part into the GameMode block and set "aweken" back to "0" at the end of it, so it additionally acts as a do-once condition for us here, preventing the "moveto" and "StartConversation" stuff to be called over and over each 15 seconds (or what's default for fQuestDelayTime).

 

If this still does nothing, some debug outputs are definitely in order here, to figure out which part of the script never gets reached and why.

Link to comment
Share on other sites

I put some MessageBox-es in it. The one that start when I get in the cell works. But the one that'd only work if it's seven o'clock doesn't... What can be the problem?

Here is the script again.

scn WakeUpPlayerQuestScript

float time
short aweken

begin MenuMode
set time to GameHour
if player.getincell aaaLillyhallCastlePrivateQuarters
	if time == 7
		WAkeUpPC
		set aweken to 1
	endif
endif
end
Begin GameMode
if aweken == 1
	bedroomservant01.moveto player
	bedroomservant01.StartConversation player, WakeUpSir
	set Aweken to 0
endif
end

Link to comment
Share on other sites

Just read up GameHour again, and it is a "float", meaning a condition like "time == 7" is highly unlikely to ever be the case. Your initial condition with the range was the better way to go here.

Imagine how unlikely it is to be exactly "7.000000" while every decimal digit could be anything at any time the script reaches this check again. And this number is already a rounded example to begin with. There are far more fractions than this.

 

Ref: http://cs.elderscrolls.com/constwiki/index.php/Special_variables

This "GameHour is 2.5" output example there made me suspicious. It's only rounded that nicely due to the "%.2f" format specifier. The internal value of this is likely much more fractured. Maybe even down to seconds as fractions of hours? Or even milliseconds? "==" will likely never work, ever, considering this.

Edited by DrakeTheDragon
Link to comment
Share on other sites

Your problem is your time varible. Time and Gamehour are floats, so they will most likely never be EXACTLY equal to 7. Gamehour includes fractions of an hour.

 

So you would have to check if time is ">=7" after it was "<7" the last time.

 

EDIT: ok, someone was faster than me :thumbsup:

Link to comment
Share on other sites

scn WakeUpPlayerQuestScript

float time
short aweken

begin MenuMode
set time to GameHour
if player.getincell aaaLillyhallCastlePrivateQuarters
	if time >= 7 && time <= 8
		WAkeUpPC
		set aweken to 1
	endif
endif
end
Begin GameMode
if aweken == 1
	bedroomservant01.moveto player
	bedroomservant01.StartConversation player, WakeUpSir
	set Aweken to 0
endif
end

So something like this would work?

Link to comment
Share on other sites

So something like this would work?

 

No. At least not when the player does another menumode operation during this time (like inventory)

 

You should restrict this to the "sleepwait" menumode ("begin MenuMode 1012")

 

EDIT: you did it again, drake ... :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

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