Global Outfit Animations?

  • #1, by ygmantellSunday, 03. September 2017, 04:27 7 years ago
    Is there any way to have one action part to play a certain animation for every outfit?
    Like, instead of checking a condition like:
    If Condition: wearingSuit is true
    
         Play animation: Pick Up
    
    End If

    Over and over for each outfit, is there a way to only call one global animation for a character.  Like set an index or something like "Pick Up" is a pick up animation for each outfit no matter which one the character is wearing so I don't have to play each animation in an if statement.

    Thanks!

    Great Poster

    274 Posts


  • #2, by afrlmeSunday, 03. September 2017, 12:19 7 years ago
    If you create an animation with the same name for each of your active characters outfits then yeah you can call it easy enough...
    startAnimation(game.CurrentCharacter.CurrentOutfit.OutfitAnimations["pick-up"])

    You may want to create a function to make things easier though.
    function charAnim(anim)
     startAnimation(game.CurrentCharacter.CurrentOutfit.OutfitAnimations[anim])
    end

    Add that to the script section of the editor as a definition type script, then you can call that function inside of any other script or inside of an execute a script part with something like this...
    charAnim("pick-up")

    Imperator

    7285 Posts

  • #3, by MachtnixSunday, 03. September 2017, 14:48 7 years ago
    I don't understand. If you want a "pick up" animation, every outfit needs the same, but it's own animation. If you have ONE animation for all, the character changes his outfit while doing this. 

    Thread Captain

    1097 Posts

  • #4, by afrlmeSunday, 03. September 2017, 14:54 7 years ago
    I don't understand. If you want a "pick up" animation, every outfit needs the same, but it's own animation. If you have ONE animation for all, the character changes his outfit while doing this. 

    Depends on the outfit I suppose? If the appearance of the outfit is different with each outfit, then they may just want to have same animations but in the new outfit, which in that case the function I wrote will be fine as long as you make sure the animations use the same names throughout each outfit for the character.

    Imperator

    7285 Posts

  • #5, by MachtnixSunday, 03. September 2017, 16:43 7 years ago
    Sorry, I have no idea roll 
    First: that's the sense of outfits to be different from others. 
    Second: If I use the same name in every outfit Visionaire won't tolerate it? What about the animation Id?

    Thread Captain

    1097 Posts

  • #6, by MachtnixSunday, 03. September 2017, 16:47 7 years ago
    Btw: I can't read the code lines on my smartphone ( they are cut off) and I can't edit my posting. 

    Thread Captain

    1097 Posts

  • #7, by ygmantellSunday, 03. September 2017, 17:13 7 years ago
    Thanks AFRLme!  I know nothing about scripting in VS (but know basic lua), but that was easy enough to understand.

    Yeah, I want the same animation but in the diferent outfits. But, as Machtnix said, if the animations are named the same, wont that cause issues with the engine?

    Thanks!

    PS: As stated above, (on a slightly unrelated note) I know basic Lua, but not VS Scripting.  Is there any resources for me to learn how to utilize it?  After reading the documentation over and over, I'm still having trouble understanding how to use it.
    Thanks!

    Great Poster

    274 Posts

  • #8, by ygmantellSunday, 03. September 2017, 17:13 7 years ago
    Thanks AFRLme!  I know nothing about scripting in VS (but know basic lua), but that was easy enough to understand.

    Yeah, I want the same animation but in the diferent outfits. But, as Machtnix said, if the animations are named the same, wont that cause issues with the engine?

    Thanks!

    PS: As stated above, (on a slightly unrelated note) I know basic Lua, but not VS Scripting.  Is there any resources for me to learn how to utilize it?  After reading the documentation over and over, I'm still having trouble understanding how to use it.
    Thanks!

    Great Poster

    274 Posts

  • #9, by afrlmeSunday, 03. September 2017, 17:19 7 years ago
    Hmm... the function I wrote accesses the animation inside of the current outfit.

    game.CurrentCharacter.CurrentOutfit.OutfitAnimations["name of animation"] -- for example.

    Thus avoiding global access issues with using the same name as we are technically direct linking & not globally accessing it.

    @ygmantell: http://www.visionaire-studio.com/luadocs/ Simon has been working on this. I recommend checking out the phailed.me blog that is linked on that page too as it is a really easy page to learn Lua from. As for VS specific Lua, you need to have both the scripting page & the data structure pages on the wiki at hand. I often have to reference the data struture page as there's well over 100 data structure fields that can be read/written with Lua script.

    Imperator

    7285 Posts

  • #10, by ygmantellSunday, 03. September 2017, 17:40 7 years ago
    Haha, wow, okay, I guess I have my work cut out for me!

    Thanks so much for your help!

    Great Poster

    274 Posts

  • #11, by MachtnixMonday, 04. September 2017, 00:43 7 years ago
    Hmm. Somewhere in the wiki I read that you need unique names for Vis objects while using the short adress form. But if you have a clear adress, it could work.

    Is this the long or the short form? I think it works because there is only one possibility and you have only one CurrentOutfit a the same time.
    game.CurrentCharacter.CurrentOutfit.OutfitAnimations["name of animation"]
    I think it's better to clean the animation / outfit cache after using. The engine might think, the current animation is still in the cache.

    Thread Captain

    1097 Posts