Weird script behavior with Melian's book.

Post » Sat Oct 05, 2013 12:20 pm

I have noticed a strange thing about this book rotate script that came with Melian's book mesh. I have two books with this script sitting on shelves in the game-world. One is fine, but the other keeps flipping its orientation every time I load the game!

As promised, here are the pictures, complete with the console open to show the difference in variables.

http://img837.imageshack.us/img837/7785/qp55.jpg

http://img209.imageshack.us/img209/8428/c37g.jpg

And here is the script:

Spoiler
begin BRmel_book1

short state
short rotation ;0 normal 1 horizontal 2 vertical
short OnPCDrop
short OnPCAdd

float ax
float az
float mz
float tmp

if ( OnPCAdd == 1 )
set state to 0
set OnPCAdd to 0
set rotation to ( rotation + 1 )
if ( rotation >= 3 )
set rotation to 0
endif
set ax to 0
set az to 0
set mz to 0
elseif ( OnPCDrop == 1 )
set OnPCDrop to 0
disable
set state to 5
elseif ( state == 5 )
set state to 10
set az to ( player->GetAngle z )
set mz to ( GetPos z )
if ( rotation == 1 )
set az to ( az - 90 )
elseif ( rotation == 2 )
set ax to 270
set mz to ( mz + 18 )
set az to ( az - 90 )
endif
if ( az >= 360 )
set az to ( az - 360 )
elseif ( az < 0 )
set az to ( az + 360 )
endif
SetAngle x ax
SetAngle z az
SetPos z mz
enable
elseif ( state == 10 )
set tmp to ( ( GetAngle x ) - ax )
if ( tmp > 0.05 )
SetAngle x ax
elseif ( tmp < -0.05 )
SetAngle x ax
endif
set state to 11
elseif ( state == 11 )
set tmp to ( ( GetAngle z ) - az )
if ( tmp > 0.05 )
SetAngle z az
elseif ( tmp < -0.05 )
SetAngle z az
endif
set state to 12
elseif ( state == 12 )
set tmp to ( ( GetPos z ) - mz )
if ( tmp > 0.05 )
SetPos z mz
elseif ( tmp < -0.05 )
SetPos z mz
endif
set state to 10
endif

end

Can anyone tell me what the heck going on here?

User avatar
Wayland Neace
 
Posts: 3430
Joined: Sat Aug 11, 2007 9:01 am

Return to III - Morrowind