keep getting teleported into NPC house cell in my mod

Post » Tue Jan 26, 2016 11:28 pm

after i complete one of the quests, every time i save, load, or leave a cell, i get teleported into this house cell that i made. it's just an endless abyss and i have to cheat my way out. basically i every time the game loads, i get TPed into this cell. i have a lot of "Player->positioncell" type scripts that lead into that house/are based in that house. idk what's wrong. can anyone help? i'll try to attach a link to the .esp file if someone wants to look at it. thanks.



User avatar
Monika
 
Posts: 3469
Joined: Wed Jan 10, 2007 7:50 pm

Post » Tue Jan 26, 2016 9:11 pm

I can try looking at the esp. :)

User avatar
Elizabeth Davis
 
Posts: 3406
Joined: Sat Aug 18, 2007 10:30 am

Post » Tue Jan 26, 2016 4:00 pm

here you go. my scripts/quests are labeled with the prefixes AA thru AF, in chronological order. the quest scripts that i think i have problems with are the ones with the AC prefix.



https:// drive.google. com/open?id=0B8VbAUhubo3ja2hZQWl3UlNEWnc



delete the space before the // and drive

User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Tue Jan 26, 2016 9:02 am

also delete the space between the . and com

User avatar
yermom
 
Posts: 3323
Joined: Mon Oct 15, 2007 12:56 pm

Post » Tue Jan 26, 2016 7:45 pm

Here's an error log from MWEdit




Spoiler


1) lookoutScript: Failed to compile script!

2) Error: Line 41 (38): Syntax Error: Expected ')' but found 'Unknown' (=)!

Invalid input was received!

3) AF_GoldScript: Failed to compile script!

4) Error: Line 9 (8): Syntax Error: Expected 'end' but found 'elseif' (elseif)!

Invalid input was received!

5) AE_BandLeaderScript: Failed to compile script!

6) Error: Line 10 (8): Syntax Error: Expected 'end' but found 'elseif' (elseif)!

Invalid input was received!

7) AC_VictimTPScript: Failed to compile script!

8) Error: Line 12 (8): Syntax Error: Expected 'end' but found 'elseif' (elseif)!

Invalid input was received!

9) AC_VictimOutsideScript: Failed to compile script!





Some things to be aware of from taking a quick glance at the scripts:


When using "elseif", do not put an "endif" after the preceeding "if" block.


As an example, in "AC_HidingScript" you have this:



if ( GameHour > 23 )
set correcttime to 1
endif
elseif ( GameHour < 6 )
set correcttime to 1
endif

Instead, you should do it as so:



if ( GameHour > 23 )
set correcttime to 1
elseif ( GameHour < 6 )
set correcttime to 1
endif

That quirk seems like it may be what's breaking some of your scripts, so you'll want to go through and fix those in the log above.


Another thing I noticed, that won't get caught by the error log, is that your GetButtonPressed blocks are missing the "-1" button.


As an example, If you have a script like this:



if ( msgBox )
set button to GetButtonPressed
if ( button == 0 )
MessageBox "first button selected!"
elseif ( button == 1 )
MessageBox "second button selected!"
endif
endif
StopScript Example

Despite looking like it may work, it would actually do nothing. That is because the default state of GetButtonPressed is -1. There's no check for "button == -1" here, so when running through the script it'll evaluate both of the other button checks as false and proceed onward to the StopScript command. In this case even though the message box would pop up giving you options, before you could actually click any of them the script would be stopped and the buttons would become useless.


To fix this you would need to do:



if ( msgBox )
set button to GetButtonPressed
if ( button == -1 )
return
elseif ( button == 0 )
MessageBox "first button selected!"
elseif ( button == 1 )
MessageBox "second button selected!"
endif
endif
StopScript Example

Now when the script runs it would recognize when no button has been pressed and if so it'll return to back to the start and repeat until one of the buttons are selected. Since the return happens before the StopScript when we finally do select a button the script is still active and would actually display our message boxes.


I can't guarantee that those changes will solve your teleport problem, but they would likely fix a lot of other bugs you might not be aware of just yet. If the teleporting still persists after the error log is clean then I'll try and help investigate further. :)

User avatar
Vera Maslar
 
Posts: 3468
Joined: Wed Sep 27, 2006 2:32 pm

Post » Tue Jan 26, 2016 10:48 am

Ohhh I haven't tried it yet, but I think the thing about the ( button == -1 ) is the problem. You see, i have a crank on a window with a script (AC_EnterZaHouse) and it has those buttons without the -1, so the script never terminates. When I would teleport, it would be to the coordinates of that script, so I think that is the problem. If it doesn't work I will let you know, but already, you have been a great help to me. Thank you.

User avatar
Dj Matty P
 
Posts: 3398
Joined: Sat Jun 09, 2007 12:31 am

Post » Tue Jan 26, 2016 7:28 pm

okay, so i edited the AC_EnterZaHouse script, adding the changes that u mentioned. it feels smoother, but here is what i found. the game is fine after the quest is over....until you save. if u save, it teleports u into the house, and if u load that save, you're in an endless abyss. i feel like it has something to do with the MenuMode command. when I have if ( MenuMode == 1 ), the teleporting and the [censored] doesn't happen, but the script doesn't run like it's suppose to. it doesn't place you into the house. i'll work with it some more, and if it still doesn't work, i'll tell u.

User avatar
Cameron Wood
 
Posts: 3384
Joined: Wed Oct 31, 2007 3:01 pm

Post » Tue Jan 26, 2016 10:36 pm

I fixed the script. The script that teleported u inside was attached to an object, so when I tried to use StopScript, it wouldn't work (because the script wasn't global) I ended up keeping the script on the object, so that when u activated it, it would start a global script that had all of the buttons and teleportation and stuff on it. Then when the quest was over, I was successfully able to stop that global script, hence I would no longer be randomly teleported. But anyway, I have to say, Thank you for your help. U gave me good advice for the future.
User avatar
lauraa
 
Posts: 3362
Joined: Tue Aug 22, 2006 2:20 pm

Post » Tue Jan 26, 2016 1:25 pm

I fixed the script. The script that teleported u inside was attached to an object, so when I tried to use StopScript, it wouldn't work (because the script wasn't global) I ended up keeping the script on the object, so that when u activated it, it would start a global script that had all of the buttons and teleportation and stuff on it. Then when the quest was over, I was successfully able to stop that global script, hence I would no longer be randomly teleported. But anyway, I have to say, Thank you for your help. U gave me good advice for the future.
User avatar
Prisca Lacour
 
Posts: 3375
Joined: Thu Mar 15, 2007 9:25 am


Return to III - Morrowind