License from €75
DE EN FR ES IT CZ

Global Outfit Animations?

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 10 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!
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.

    Get 15 % off Try it for free
  3. · 10 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")

  4. · 10 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. 
  5. · 10 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.
  6. · 10 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?
  7. · 10 years ago
    Btw: I can't read the code lines on my smartphone ( they are cut off) and I can't edit my posting. 
  8. · 10 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!
  9. · 10 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!
  10. · 10 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.
  11. · 10 years ago
    Haha, wow, okay, I guess I have my work cut out for me!

    Thanks so much for your help!
  12. · 9 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.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?