random animation with different costumes

  • #1, by zheThursday, 30. July 2015, 16:46 9 years ago
    Hey guys,

    I got a problem with the outfit system.
    I use this script from AFRLme to bring up a animation in the right direction and it works so far.
    But if I change the costume, it plays only the animation from the first outfit.
    I named all this animations in the different outfits with the same name.



    local char = game:getLink(VGameCurrentCharacter)

    function checkDir()
    -- East
    if char:getInt(VCharacterDirection) >= -22 and char:getInt(VCharacterDirection) <= 23 then
    startAnimation("Animations[useinv_e]")
    -- North East
    elseif char:getInt(VCharacterDirection) >= 24 and char:getInt(VCharacterDirection) <= 68 then
    startAnimation("Animations[useinv_ne]")
    -- North
    elseif char:getInt(VCharacterDirection) >= 69 and char:getInt(VCharacterDirection) <= 113 then
    startAnimation("Animations[useinv_n]")
    -- North West
    elseif char:getInt(VCharacterDirection) >= 114 and char:getInt(VCharacterDirection) <= 158 then
    startAnimation("Animations[useinv_nw]")
    -- West
    elseif char:getInt(VCharacterDirection) >= 159 and char:getInt(VCharacterDirection) <= 203 then
    startAnimation("Animations[useinv_w]")
    -- South West
    elseif char:getInt(VCharacterDirection) >= 204 and char:getInt(VCharacterDirection) <= 248 then
    startAnimation("Animations[useinv_sw]")
    -- South
    elseif char:getInt(VCharacterDirection) >= 249 and char:getInt(VCharacterDirection) <= 293 then
    startAnimation("Animations[useinv_s]")
    -- South East
    elseif char:getInt(VCharacterDirection) >= 294 and char:getInt(VCharacterDirection) <= 338 then
    startAnimation("Animations[useinv_se]")
    end
    end



    Any tips how I can handle this?

    I am working with V4.1 Build1177

    Newbie

    28 Posts


  • #2, by sebastianThursday, 30. July 2015, 18:05 9 years ago
    how do you call the function in the second outfit?

    Thread Captain

    2346 Posts

  • #3, by zheThursday, 30. July 2015, 18:11 9 years ago
    here are a pic from my outfits

    Newbie

    28 Posts

  • #4, by zheThursday, 30. July 2015, 18:19 9 years ago
    sorry sebastian, I missunderstand you.
    I call the function in the same way like the function for the first outfit.
    I have only this script and thought that is enough and the script will use the right animation from the actually outfit.

    Newbie

    28 Posts

  • #5, by sebastianThursday, 30. July 2015, 18:37 9 years ago
    the problem is that the script uses e.g. startAnimation("Animations[useinv_s]")
    the script itself cant decide now which outfit animation should be played so naming them different and creating a second function with the different name which gwts called on the second outfit should solve the issue.

    Thread Captain

    2346 Posts

  • #6, by zheThursday, 30. July 2015, 18:52 9 years ago
    thanks for the quick responde sebastian.

    Your solution is the one I am thinking about, too.
    If I understand you right.
    But then I have to use the visionaire ingame programming functions.

    for example
    If "outfit_normal"
    use "script_normal"
    else
    if "outfit_dark"
    use "script_dark"
    . . . and so on

    And this I have to do by all the different spots I need it.

    Newbie

    28 Posts

  • #7, by sebastianThursday, 30. July 2015, 19:19 9 years ago
    where do you call checkDir() exactly?

    Thread Captain

    2346 Posts

  • #8, by zheThursday, 30. July 2015, 19:25 9 years ago
    I call the script in the "actions" like this example.

    Newbie

    28 Posts

  • #9, by sebastianThursday, 30. July 2015, 19:39 9 years ago
    ah ok. so everytime you pickup something you only call the script and it does the animation regarding to the direction..

    So before you edit every action in your game you could edit your existing script and check for " CharacterCurrentOutfit " of the current character. depending on this it runs animations for outfit A or B.





    Thread Captain

    2346 Posts

  • #10, by zheThursday, 30. July 2015, 19:43 9 years ago
    Yeah that is what I need, BUT the script is from AFRLme and I have no clue to do this in the script. The reason for this is that I have no programming skills including lua smile

    Newbie

    28 Posts

  • #11, by sebastianFriday, 31. July 2015, 11:03 9 years ago
    i dont know what CharacterCurrentOutfit will return when you save it into a lua variable.
    on top of the script you could save the current outfit into a variable and check later if its outfit a or b or c or...
    depending on that call the function for that specific outfit. Im pretty new to lua and dont know how to call the data structure stuff out of my head but i think in the wiki is an example after the most data structure names which explain how to grab these.

    Thread Captain

    2346 Posts