×
Меню
Индекс

MSFD Scale Functions

 
 
GetScale (float)
SetScale newScale_float
ModScale scaleChange_float
 
If ( doonce == 0 )
     Object_ID->SetScale 0.1
     Set doonce to 1
endif
 
These functions are used to determine or modify the scale of a reference. Any scale you can set must be within (exclusively) 0 and 10 (so you can set it beyond 0.5 and 2, contrary to what was written in the original description by Bethesda) (info by Mode Locrian). The above sample script can thus be used to set scale beyond the limits of what the TES CS itself allows.
Notes: You shouldn't call "setscale" in every frame, at least not in exteriors or other FPS-critical situations.
The scale will be reset to a value within the 0.5 - 2.0 frame when you reload. So don't use a done-flag to call it only once. Either call it regularly (about all 10 frames) or test for "getscale" and reset the scale when it doesn't fit:
 
if ( GetScale != 5 )
    SetScale, 5
endif
 
 
Another way is to set it in a Tribunal or Bloodmoon start script. This can be done once, and will make sure the scale is set each time you load a game. (Forum info / JOG).
Sample script:
A more complex sample script by Bethesda shows how to grow and shrink an object.
When this script is placed on a reference, activating that reference gives the user the ability to change that reference’s scale.
 
Begin scalescript
 
short questionAsked
short button
 
float direction
float currscale
float tempscale
 
if ( MenuMode )
     return
endif
 
if ( OnActivate == 1 )
          if ( questionAsked == 0 )
               MessageBox, "Make this object..."  "...Grow"  "...Shrink"
               set questionAsked to 1
          endif
endif
 
if ( questionAsked == 1 )
     set button to GetButtonPressed
     if ( button == -1 )
     else
          if ( button == 0 )
               set direction to 1
          elseif ( button == 1 )
               set direction to -1
          endif
          set questionAsked to 0
          set button to 0
     endif
endif
 
if ( direction != 0 )
     set tempscale to .3 * GetSecondsPassed
     set tempscale to tempscale * direction
     ModScale tempscale
     set currscale to GetScale
     if ( direction == -1 )
          if ( currscale <= .5 )
               set direction to 0
          endif
     else
          if ( currscale >= 2 )
               set direction to 0
          endif
     endif
endif
 
end scalescript