Author Topic: Placeable anim question.  (Read 393 times)

Legacy_Borden Haelven

  • Hero Member
  • *****
  • Posts: 681
  • Karma: +0/-0
Placeable anim question.
« on: January 12, 2012, 03:01:28 pm »


               I've got my bookshelves nicely animated using the on2off & off2on anims. How do I stop the thing from playing the on2off anim when I close the placeable's inventory?
               
               

               
            

Legacy_s e n

  • Hero Member
  • *****
  • Posts: 654
  • Karma: +0/-0
Placeable anim question.
« Reply #1 on: January 12, 2012, 04:20:05 pm »


               maybe you're forgetting a 0 node animation r stuff lk that
               
               

               
            

Legacy_Borden Haelven

  • Hero Member
  • *****
  • Posts: 681
  • Karma: +0/-0
Placeable anim question.
« Reply #2 on: January 12, 2012, 06:07:01 pm »


               0 node animation? (Newby at animation really.)
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
Placeable anim question.
« Reply #3 on: January 12, 2012, 08:46:42 pm »


               Animations by default should have 4 base settings:

1) Off; does nothing, object sits still, animation keys typically start at Zero and move to Zero or to One with nothing actually changing.

2) Off-To-On; object starts it's movement sequence

3) On; Object performs it's full animation, as in whatever it does for a complete, always running cycle.

4) On-To-Off; where the object cycles down to it's stop position.

For a chest, the OFF position is always closed.  You need that closed setting to be a distinct animation, even if it only uses one key on the animation bar.  Typically, you are better off if you define more than one key for the off slot though.

When you "open" that chest, you use the Off-To-On animation to show the way the lid rises up.

Once open, since it is a simple chest, you use the ON animation to be a single or couple of keys that show the lid is open.

Closing the chest you would use On-To-Off to show the lid slowly closing the chest.

The engine will use what is available, and if the animation cycles are not all defined, it "guesses", typically incorrectly, what you want it to do.  In your case, since it appears you have not defined the "off" slots, the engine assumes that you want it to perform the On-To-Off cycle.

You could define the On-To-Off cycle to be the same as the On cycle, (IE, fully open, no movement)

OR, you need to define a script that runs and "sets" the sequence in use when the "bookshelf" is empty to be the "On, fully open, no movement" sequence.
               
               

               
            

Legacy__six

  • Hero Member
  • *****
  • Posts: 1436
  • Karma: +0/-0
Placeable anim question.
« Reply #4 on: January 12, 2012, 10:31:01 pm »


               I don't think it's possibly to "open" a container placeable without the animation playing.

However, I would circumvent it by creating an invisible object with an inventory, and giving the bookshelf an OnUsed event to instruct the player to open that invisible object's inventory instead.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Placeable anim question.
« Reply #5 on: January 12, 2012, 11:02:01 pm »


               <shuffling the deck of many things...>

Oooh! Tricky, _six! I like that.
I've always like sleight of hand... It's like magic!

<...so badly it takes him three days to find his head>
               
               

               


                     Modifié par Rolo Kipp, 12 janvier 2012 - 11:02 .
                     
                  


            

Legacy_Borden Haelven

  • Hero Member
  • *****
  • Posts: 681
  • Karma: +0/-0
Placeable anim question.
« Reply #6 on: January 12, 2012, 11:19:03 pm »


               Sorted it. A placeable fires it's On_Used script when you close it's inventory this script fixed things.

void main()
{
object oPC = GetLastUsedBy();
object oInvisible_Bookshelf = GetObjectByTag("InvisibleBookcase");
string sShelf_Pair = GetLocalString(OBJECT_SELF,"BookShelf_Pair_Tag");
object oShelf_Pair = GetObjectByTag(sShelf_Pair);
int nSearchDifficulty = GetWillSavingThrow(OBJECT_SELF);
int nListenDifficulty = GetReflexSavingThrow(OBJECT_SELF);
int nLoreDifficulty = GetFortitudeSavingThrow(OBJECT_SELF);
int nSearchSkill = GetSkillRank(SKILL_SEARCH,oPC);
int nListenSkill = GetSkillRank(SKILL_LISTEN,oPC);
int nLoreSkill = GetSkillRank(SKILL_LORE,oPC);
int nOpened = GetLocalInt (OBJECT_SELF,"X2_L_PLC_ACTIVATED_STATE");

   if (nOpened == TRUE)
   {
       ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
       SetUseableFlag(OBJECT_SELF,FALSE);
       DelayCommand(10.0,ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
       DelayCommand(25.0,SetUseableFlag(OBJECT_SELF,TRUE));
       SetLocalInt(OBJECT_SELF,"X2_L_PLC_ACTIVATED_STATE",FALSE);
       return;
   }
   if ((nSearchSkill >= nSearchDifficulty))
   {
       ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
       AssignCommand(oShelf_Pair,ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE));
       DelayCommand(10.0,AssignCommand(oShelf_Pair,ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE)));
       SetLocalInt(OBJECT_SELF,"X2_L_PLC_ACTIVATED_STATE",TRUE);
       return;
   }
   if ((nLoreSkill >= nLoreDifficulty))
   {
       FloatingTextStringOnCreature("These books don't seem quite right.",oPC);
       return;
   }

   if ((nListenSkill >= nListenDifficulty))
   {
       FloatingTextStringOnCreature("It sounds hollow behind this.",oPC);
       return;
   }
}

The script below should work on any placeable with suitable animations.
void main()
{
if (nOpened == TRUE)
   {
       ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
       SetUseableFlag(OBJECT_SELF,FALSE);
       DelayCommand(10.0,ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE));
       DelayCommand(25.0,SetUseableFlag(OBJECT_SELF,TRUE));
       SetLocalInt(OBJECT_SELF,"X2_L_PLC_ACTIVATED_STATE",FALSE);
       return;
   }
   
       ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
SetLocalInt(OBJECT_SELF,"X2_L_PLC_ACTIVATED_STATE",TRUE);
       }
               
               

               


                     Modifié par Borden Haelven, 12 janvier 2012 - 11:31 .
                     
                  


            

Legacy_s e n

  • Hero Member
  • *****
  • Posts: 654
  • Karma: +0/-0
Placeable anim question.
« Reply #7 on: January 13, 2012, 12:29:46 am »


               i dont understand why all that trouble... should be the same kind of animation of chests: if they do work without script, why a bookshelf shouldnt have the same behaviour?
               
               

               
            

Legacy_Borden Haelven

  • Hero Member
  • *****
  • Posts: 681
  • Karma: +0/-0
Placeable anim question.
« Reply #8 on: January 13, 2012, 12:39:57 am »


               I've used placeable activate type anims not container open type anims. You can't override container anims as they're built as creatures. I was just struggling stopping it from firing the deactivate anim not knowing it fired the on_use script twice.

All working now. :- www.xfire.com/video/52de01/ ':wizard:'
               
               

               
            

Legacy__six

  • Hero Member
  • *****
  • Posts: 1436
  • Karma: +0/-0
Placeable anim question.
« Reply #9 on: January 13, 2012, 03:52:59 pm »


               To clarify Sen, Bordren wanted it to not play the animation. Which is more difficult than it sounds '<img'> Thats looking awesome by the way. How about a version where the bookshelf will only open if you put a specific book on the shelf?
               
               

               
            

Legacy_s e n

  • Hero Member
  • *****
  • Posts: 654
  • Karma: +0/-0
Placeable anim question.
« Reply #10 on: January 13, 2012, 06:22:05 pm »


               so basically on close inventory keep the bookshelf opened?
               
               

               
            

Legacy_Borden Haelven

  • Hero Member
  • *****
  • Posts: 681
  • Karma: +0/-0
Placeable anim question.
« Reply #11 on: January 14, 2012, 09:51:51 pm »


               

_six wrote...

How about a version where the bookshelf will only open if you put a specific book on the shelf?


That use a on_disturbed script wouldn't it. Can do that.