Bug in MWCP? GetPos X goes wrong

Post » Tue Mar 01, 2011 4:12 pm

EDIT: See below - this seems to be a bug in the original Morrowind scripting.

In the "Rescue Jocien Ancois" quest, I am escorting Assaba-Bentus to the witches, and he has a script on him that checks for "getpos x" and "getpos y" every 2 seconds. Unfortunately, it seems that his "getpos x" value is wrong - this means it is seriously different from the value one would get by typing "getpos x" in the console (which is the right one, as the script shows).
PS. "getpos y" is correct.
User avatar
Lloyd Muldowney
 
Posts: 3497
Joined: Wed May 23, 2007 2:08 pm

Post » Tue Mar 01, 2011 3:56 am

Are you sure it's the MCP? Have you tried the original Morrowind.exe without MCP and see if it works correctly?
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Tue Mar 01, 2011 9:51 am

OOPS. It does. I didn't think of trying this since I believed that MWCP changes some DLL files. But as it changes only the exe and the older exe has the same bug, this must be an original Morrowind bug.

OH, wait. I got it. The xPos variable in assabaScript should not be a short but an integer. I guess this should be reported to the Unofficial Patch crew?
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Tue Mar 01, 2011 4:48 pm

The xPos variable in assabaScript should not be a short but an integer. I guess this should be reported to the Unofficial Patch crew?

Good catch. Yes, the MPP would be a good place to fix it as it already has that script in there. Not sure when that will be updated though.
User avatar
Princess Johnson
 
Posts: 3435
Joined: Wed Feb 07, 2007 5:44 pm

Post » Tue Mar 01, 2011 3:53 pm

Is the MPP being updated at all? 1.6.4 somehow disappeared, and 1.6.5 hasn't made it out of beta in over a year.

For the sake of completeness: when I said "integer", I didn't mean Morrowind's integers. I meant something that can go up to 90000. Probably "float" is optimal since it's the type returned by GetPos (or so I hope). And for the profit of a few nanoseconds of computation, the script could be optimized as follows (getPos y is only being called when the x-position is right):

Begin assabaScriptshort noLoreshort followNowshort distanceCheckfloat timer;global NPCVoiceDistancefloat xPosfloat yPosif ( MenuMode == 1 )    returnendifif ( OnDeath == 1 )    Journal B4_ErabenimsunKill 1endifif ( GetJournalIndex IL_RescueHermit >= 30 )    returnendifif ( GetJournalIndex IL_RescueHermit < 25 )    returnendifif ( GetHealth <= 0 )    returnendifif ( GetCurrentAiPackage == 3 );if follow is the current package, set followNow and continue...    set followNow to 1    SetHello 0    if ( GetAIPackageDone == 1 )        ;original conditions, and in case something funky happens...        Journal IL_RescueHermit 30        set followNow to 0        AiWander 256 0 0 40 20 20 0 0 0 0 0 0        Say "Vo\D\M\Flw_DM004.mp3" "Thank you."        SetHello 30    endif    if ( timer < 2 )        set timer to ( timer + GetSecondsPassed )        return    endif    Set xPos to GetPos X    if ( xPos > 84700 )        if ( xPos < 85700 )            Set yPos to GetPos Y            if ( yPos < -3200 )                if ( yPos > -4000 )                    ;since the above method may not actually work...                    Journal IL_RescueHermit 30                    set followNow to 0                    AiWander 256 0 0 40 20 20 0 0 0 0 0 0                    Say "Vo\D\M\Flw_DM004.mp3" "Thank you."                    SetHello 30                endif            endif        endif    endif    if ( GetDistance Player < NPCVoiceDistance )        if ( GetDistance Player < 500 )            set distanceCheck to 0        endif        set timer to 0        return    endif    if ( distanceCheck == 0 )        Say "Vo\D\M\Flw_DM001.mp3" "Where are you going?"        set distanceCheck to 1    endifelse    ;if follow is NOT the current package, make sure followNow is zero    set followNow to 0endifEnd


(Tested, yes.)
User avatar
Neliel Kudoh
 
Posts: 3348
Joined: Thu Oct 26, 2006 2:39 am

Post » Tue Mar 01, 2011 6:34 am

Another MPP bug.

Script ColonySeler:
if ( placeonce == 0 )    if ( GetJournalIndex "CO_7" >= 10 )        PositionCell 4480.000, 3968.000, 15820.000, 0, "Raven Rock, Bar"    endifendif

This if-clause should just be deleted. These PositionCell coordinates are off level, and there is no need to position Seler anyway. The original Bloodmoon script had an unparseable command at the place (wrong order of arguments in PositionCell), which the compiler just ignored, and that was perfectly okay. MPP has "fixed" the unparseable command by putting the arguments in order, but the right thing should have been just removing it. (Or replacing the coordinates by right ones, but I don't see why the PositionCell should be there at all.)
User avatar
Michael Russ
 
Posts: 3380
Joined: Thu Jul 05, 2007 3:33 am

Post » Tue Mar 01, 2011 1:26 pm

Another MPP bug.

Script ColonySeler:
if ( placeonce == 0 )    if ( GetJournalIndex "CO_7" >= 10 )        PositionCell 4480.000, 3968.000, 15820.000, 0, "Raven Rock, Bar"    endifendif

This if-clause should just be deleted. These PositionCell coordinates are off level, and there is no need to position Seler anyway. The original Bloodmoon script had an unparseable command at the place (wrong order of arguments in PositionCell), which the compiler just ignored, and that was perfectly okay. MPP has "fixed" the unparseable command by putting the arguments in order, but the right thing should have been just removing it. (Or replacing the coordinates by right ones, but I don't see why the PositionCell should be there at all.)


Assuming this is true, and this code block should be removed then the placeonce short can be removed as well as that is the only place it is referenced in this script. Also, if the coordinates should instead be replaced with the "right ones" then placeonce should be updated as well; as it stands it looks like this if block will be true anytime it is encountered.

On a somewhat related topic, how would one go about implementing these changes themselves? Is it "safe" to simply convert this to an esp using the Enchanted Editor, then load the esp in MWEdit to make the script changes (by checking this esp as active and putting a check next to the three main esm files), save the changes and recompile the scripts, save the file, and then convert it back to esm using the Enchanted Editor again?

Or is there a better method of making these changes?
User avatar
Katey Meyer
 
Posts: 3464
Joined: Sat Dec 30, 2006 10:14 pm

Post » Tue Mar 01, 2011 2:28 am

Or is there a better method of making these changes?

This is my preferred method. Assuming we are editing name.esm
1. copy the name.esm to name.esp using Mash
2. load in MWEdit masters of name.esp, name.esp (be sure to have masters loaded first)
3. change/compile script(s) with MWEdit (strict syntax check on suggested)
4. if mod is big/more complex than a few scripts, DON'T SAVE the loaded name.esp from MWEdit, it can screw other things; it is safer to use MWEdit to fix the syntax, but compile/save from TESCS only.

5a. IF scripts changed are many AND you did not add NEW scripts, I find convenient/faster to:
- 6a from MWEdit, save the mod as name_edited.esp
- 7a select name_edited.esp in Mash, right click, Export/Scripts as name_edited_scripts.mws
- 8a select name.esp in Mash, right click, Import/Scripts name_edited_scripts.mws
- 9a. load in TESCS name.esp, recompile all. Note: if your mod does not have both Tribunal.esm and Bloodmoon.esm as masters, better load also Wrye's GMST Vaccine.esp to avoid generating dirty GMST

5b. else (alternative to 5a - 9a)
- 6b load name.esp in TESCS. Paste in TESCS the edited script sources from MWEdit, recompile scripts one at a time as needed

10. from TESCS, save name.esp
11. from Mash, select name.esp, right click, copy to Esm
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am


Return to III - Morrowind