15 lines
780 B
Plaintext
15 lines
780 B
Plaintext
Scriptname _00E_SetActorScale Hidden
|
|
|
|
Float Function Change(Actor akActor, Float fNewScale) Global
|
|
|
|
; Sets the scale of akActor to fNewScale and returns the old scale.
|
|
; This is a workaround for GetScale() returning the cumulative scale of Race.Height * Actor.Scale for actors.
|
|
; So it results in a messed up scale if the value returned by GetScale() is used to revert the scale change for an actor whose race has a non-1.00 height (for example, HighElfRace)
|
|
|
|
Float fOriginalScale = akActor.GetScale()
|
|
akActor.SetScale(fNewScale)
|
|
; Now use the known fNewScale and the return of GetScale() to get the race height coeff, and apply that coeff to fOriginalScale to calculate the true actor's reference scale.
|
|
Return fOriginalScale * fNewScale / akActor.GetScale()
|
|
|
|
EndFunction
|