×
Меню
Индекс

MSFD Detecting players action: running, jumping, sneaking?

 
 
[no fix] GetPCSneaking (short)
[no fix] GetPCRunning (short)
[no fix] GetPCJumping (short)
 
     if ( GetPCRunning )
 
These functions returns 1 if the PC is performing the appropriate action and 0 if he is not. Since Morrowind doesn't have functions to directly test for keyboard input, these functions provide an alternative to check if the player has a certain button pressed. They have accordingly been used extensively for control purposes, e.g. for movable ships, ridable creatures, or in my climbing mod.
 
Sample script:
When this script is placed on an NPC, and the player has an item equipped called “scissors”, MessageBox warnings will be given based on the player’s current actions.
 
Begin momscript
 
short warn
 
if ( player->HasItemEquipped "scissors" )
     if ( warn != 1 )
          if ( GetPCRunning )
               MessageBox "Don’t run with scissors!"
               set warn to 1
          endif
     endif
     if ( warn != 2 )
          if ( GetPCJumping )
               MessageBox "Don't jump with those scissors! You'll put your eye out!"
               set warn to 2
          endif
     endif
     if ( warn != 3 )
          if ( GetPCSneaking )
               MessageBox "You can't hide those scissors from me!"
               set warn to 3
          endif
     endif
else
     set warn to 0
endif
 
end