×
Меню
Индекс

MSFD Forcing running and jumping

 
 
ForceRun
ClearForceRun
GetForceRun (short)
 
ForceJump
ClearForceJump
GetForceJump (short)
 
ForceMoveJump
ClearForceMoveJump
GetForceMoveJump (short)
 
These functions all control the specified NPC’s movement. The ForceRun function makes the NPC always run when they move, the ForceJump function makes the NPC constantly jump, and the ForceMoveJump makes the NPC always jump when they are moving. The Get versions of the functions return one if the specified NPC currently is forced into the given action and zero otherwise. The Clear functions are used to turn forced movement modes off. An NPC can only be forced to do one movement at a time. The priority for forced movement is Sneak > Running > Jump > MoveJump.
 
Sample Script:
This script lets an object control the movement type of Athlete, an NPC set to Travel endlessly in a four-point square.
 
Begin AthleteControl
 
short questionAsked
short button
short isrunning
short isjumping
 
if ( MenuMode )
     return
endif
 
if ( OnActivate == 1 )
     set isrunning to ( Athlete->GetForceRun )
     set isjumping to ( Athlete->GetForceMoveJump )
     if ( questionAsked == 0 )
          if ( isrunning )
               MessageBox, "Make Athelete stop running? "  "Yes"  "No"
          else
               MessageBox, "Make Athelete run? "  "Yes"  "No"
          endif
          set questionAsked to 1
     endif
endif
 
if ( questionAsked == 1 )
     set button to GetButtonPressed
     if ( button == -1 )
     else
          if ( isrunning == 0 )
               if ( button == 0 )
                    Athlete->ClearForceMoveJump
                    Athlete->ForceRun
               endif
          else
               if ( button == 0 )
                    Athlete->ClearForceRun
               endif
          endif
          if ( isjumping )
               MessageBox, "Make Athelete stop jumping? "  "Yes"  "No"
          else
               MessageBox, "Make Athelete jump? "  "Yes"  "No"
          endif
          set questionAsked to 2
          set button to -1
     endif
endif
 
if ( questionAsked == 2 )
     set button to GetButtonPressed
     if ( button == -1 )
     else
          if ( isjumping == 0 )
               if ( button == 0 )
                    Athlete->ClearForceRun
                    Athlete->ForceMoveJump
               endif
          else
               if ( button == 0 )
                    Athlete->ClearForceMoveJump
               endif
          endif
          set questionAsked to 0
          set button to -1
     endif
endif
end