FANDOM


BubaDragons lever animator is a simple script that plays the animation for a switch. Simply place this file in your scripttemplates directory and when you want to animate a switch select the Templates button and this file will be selectable

Script Notes Edit

  • This works best if the switch is placed with it's "Initial State" set to either Activated or Deactivated *NOT* default. If the switch dosen't work 'right' the first time but behaves correctly after that, the switch was placed with it's initial state set to "default".
  • Depending on weather or not the initial state is Activated or Deactivated you may want to change the line:
    • Change from: iAnimationState = (iAnimationState == iOff)?iOn:iOff;
    • Change to: iAnimationState = (iAnimationState == iOn)?iOff:iOn;
  • By commenting out the main() this file can be used as a #include file.

The Script Edit

//::////////////////////////////////////////////////////////////////
//:: Name
//:: OnUse_Switch_Scipt
//::////////////////////////////////////////////////////////////////
/* *****************************************************************
*** This is a simple script that plays the animation for
*** a switch.  Simply place this file in your scripttemplates
*** directory and when you want to animate a switch select
*** the Templates button and this file will be selectable.
***
*** NOTES:  This works best if the switch is placed with it's
***         "Initial State" set to either Activated or
***         Deactivated *NOT* default.  If the switch
***         dosen't work 'right' the first time but behaves
***         correctly after that, the switch was placed with
***         it's initial state set to "default".
***         Depending on weather or not the initial state is
***         Activated or Deactivated you may want to change
***         the line:
***         iAnimationState = (iAnimationState == iOff)?iOn:iOff;
***         To:
***         iAnimationState = (iAnimationState == iOn)?iOff:iOn;
***         By commenting out the main() this file can be used as a
***         #include file.
***************************************************************** */
//::////////////////////////////////////////////////////////////////
//:: Created By: BubaDragon
//:: Created On: 09-October-2002
//::////////////////////////////////////////////////////////////////
void ActionUseSwitch();
void main()
{
   ActionUseSwitch();
}
void ActionUseSwitch()
{
   int iOn = ANIMATION_PLACEABLE_ACTIVATE;
   int iOff = ANIMATION_PLACEABLE_DEACTIVATE;
   int iAnimationState = GetLocalInt(OBJECT_SELF, "AnimationState");
   iAnimationState = (iAnimationState == iOff)?iOn:iOff;
   ActionPlayAnimation(iAnimationState);
   SetLocalInt(OBJECT_SELF, "AnimationState", iAnimationState);
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.