IsPCSleeping? I hope so

Post » Sun May 01, 2011 10:36 pm

Can anyone tell why is this causing a CTD?

scn LFQuestScriptbegin gamemode	if player.getincell LFICroom == 1		setstage LFQuest 10	endif	if player.getincell LFBoattCabin == 1		setstage LFQuest 20	endif	if player.getincell LFOTower == 1		setstage LFQuest 60	endifendbegin menumode	if GetStage LFQuest == 20		if IsPCSleeping == 1			setstage LFQuest 30		endif	endifendbegin menumode	if GetStage LFQuest >= 40		if IsPCSleeping == 1			setstage LFQuest 50		endif	endifend

The player should sleep (aboard a boat in this instance) which advances the quest to stage 30, which in turn should move the player to a target ref. Instead, the game crashes on sleeping.
Yay...
This doesn't happen if you use setstage in game to advance the quest, in that instance the player is moved to the target no problem.
Originally the player.moveto command was in this script as well, I moved it out to attempt to solve the crash... apparently to no avail.

So yeah, what am I doing wrong?

(Also, as an extra... any idea how to make Ungrdltraphingedoor actually activate?)
User avatar
Adam
 
Posts: 3446
Joined: Sat Jun 02, 2007 2:56 pm

Post » Sun May 01, 2011 8:15 pm

You wouldn't happen to have a journal entry at stage 30 and 50 would you? The way journal entries just pop up can be the cause of a crash. What you should do instead is have the script be set to some stage without a journal entry or scripting attached, like stage 29. Then within gamemode, based on the condition of stage 29 being present, and the player being near the location, progress the stage to 30 for the journal update.

If the player is sleeping in the interior of a boat, you actually shouldn't be using moveto, but instead just enabling/disabling the door leading out of that interior to decide which exterior it links to. The advantage of this is that everything within that interior (companions, items in containers, ect) is still present and accounted for on the other side.
User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm

Post » Sun May 01, 2011 2:14 pm

You wouldn't happen to have a journal entry at stage 30 and 50 would you? The way journal entries just pop up can be the cause of a crash. What you should do instead is have the script be set to some stage without a journal entry or scripting attached, like stage 29. Then within gamemode, based on the condition of stage 29 being present, and the player being near the location, progress the stage to 30 for the journal update.

If the player is sleeping in the interior of a boat, you actually shouldn't be using moveto, but instead just enabling/disabling the door leading out of that interior to decide which exterior it links to. The advantage of this is that everything within that interior (companions, items in containers, ect) is still present and accounted for on the other side.


I do indeed have journal entries, thanks for that. I'll give it a shot. The other (stage 50) actually works perfectly though... maybe I'll do the same just to be on the safe side.

The reason for using moveto is that the boat is in a separate worldspace when the player is on it, they're 'out to sea' in fact, much like the bloated float afloat! The quest progresses with the player 'waking up' face-down on a beach, so I'm not sure what you suggest would be feasible in terms of story, though I can obviously see the merits. It's also not possible to enter the boat again after the crash so any items left behind are lost anyhow. Luckily this isn't an issue as it's actually likely not going to be released, the whole mod is a thank-you for a friend!

Anyway, thanks for your help.
User avatar
Chloe :)
 
Posts: 3386
Joined: Tue Jun 13, 2006 10:00 am


Return to IV - Oblivion