Freezes caused by PositionCell?

Post » Tue Aug 16, 2011 10:30 pm

I have a simple script attached to a ring. When the player equips the ring, the player is asked whether or not they want to be teleported to a certain location (in this case, the tower that I created for this mod). The function I use to perform the teleportation is PositionCell.

During testing, I've noticed that the game will randomly freeze during the load screen after the player has been teleported into the cell specified by the script. Changing the "zRot" parameter seems to cause the freezing to go from random to every single time.

Here's the script:

scn WTtpRingScrBegin OnEquip	MessageBox "Would you like to be transported to the Forsaken Watchtower?", "Yes", "No"EndBegin GameMode	If ( GetButtonPressed == 0 )		player.PositionCell 0,0,64,0, WTsunroom	Else		Return	EndIfEnd


What am I doing wrong?
User avatar
adame
 
Posts: 3454
Joined: Wed Aug 29, 2007 2:57 am

Post » Tue Aug 16, 2011 11:26 pm

I can't find anything to support this, but I think the problem is that the script keeps calling the PositionCell function. Try changing your script to this:

scn WTtpRingScrshort menushort choiceBegin OnEquip	set menu to 1	MessageBox "Would you like to be transported to the Forsaken Watchtower?", "Yes", "No"EndBegin GameMode	if (menu)		set choice to GetButtonPressed		if (choice == -1)			Return		elseif (choice == 0)			Player.PositionCell 0,0,64,0, WTsunroom		endif		set menu to 0	endifEnd


If that doesn't work, I suggest just creating an X marker in the cell and using the MoveTo function.
User avatar
Lauren Dale
 
Posts: 3491
Joined: Tue Jul 04, 2006 8:57 am

Post » Wed Aug 17, 2011 7:59 am

It's probably not quite that simple an explanation, as GetButtonPressed should reset to -1 after your test.

But you do need the extra code, as otherwise your Player will get moved any time you press the first button on ANY menu. The capture of the value of GetButtonPressed into a local value is also good practice, as it lets you check the local copy as many times as you need to without it changing. The last advice is probably the best bet. Place an XMarkerHeading (so the character gets pointed in a consistent direction) and drop it onto the floor. I'd suspect that your problem might be due to the position being invalid - the player can't stand there - and that could prevent the command completing. If you take a look at the position of the marker after you place it, you probably won't find many zeros in it.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm


Return to IV - Oblivion