edited March 2014 in ORK Support
Putting away the sword could be done using variable conditions in the Equipment Viewers and having two of them for the weapon.
Hey GiL, I saw you explained in the Unity Forum to someone on how to sheathe a sword. Could you maybe explain it in more detail so I can understand? =]
I got a sword to equip and to change my idle and run animation when I equip the sword, but I somehow can't figure out how to put the sword away to his back when pressing a key. I can unequip the sword by going into inventory-sword-unequip, but that just make the sword disappear.
I have an empty sheath on my character's back, and it'll be weird if the sheath is just for show XD
Post edited by Shadow_Fire on
  • Basically, you'll use two Equipment Viewers for your weapon, both using variable conditions to decide if the weapon is sheathed or not.
    E.g. use a bool variable 'Player Weapon Sheathed' - one equipment viewer will check for the variable to be true, the other to be false (i.e. the Is Valid field is enabled or disabled).

    Now, changing the variable is done using a Global Event that is called when you press the input key you want to use. The event should simply trigger the variable (i.e. check it's current value and change it accordingly). You can also use the event to animate sheathing/drawing the sword :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 2014
    Thanks GiL, for the info :]
    Do you know what's wrong with my setup?
    First I did a little test of calling a dialogue with global events when pressing C, to see if it work, and it did.
    In my player prefab, I added two equipment viewer components. The first one is set to is valid off and the second one is set to on. I put the name of the values as swordSheathe.
    In my input key, I created a key called Sheathe-Unsheathe Sword and use C as the key.
    In Global Events I created a new global event call Weapon Sheathe.
    In Event Type I click on key and use the input key that I just created.
    I set all states to ignore.
    I went to Events and created a new game events.
    (This is where I think I did something wrong)
    I created the node Check Game Variables. Inside the node, I added a new game variable. Value Type is set to value.
    Value is set to swordSheathe
    Is valid is disable.
    Type is set to bool
    Then on the success part, I added a node Change Game Variable
    Inside the Change Game Variable, the Value type is set to value.
    Value is set to swordSheathe.
    Remove box is disable.
    Type is set to Bool.
    Value box is disable.
    Back to Global Events, I put the newly created event inside Event Asset

    This doesn't seem to work.
    Post edited by Shadow_Fire on
  • Well, your event seems to check if swordSheathe is false, and changes it to false if it's false ... so yeah, that doesn't work :D

    To get it working, change the Success slot change variable step to true (i.e. enable the value box).
    And add another change variable step (or simply copy the other one) and add it to the Fail slot (this one should set the variable to false, i.e. disable the value box).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 2014
    Thanks!! It works! I am now able to play a sheathing animation --> sword disappearing whenever I press C and press C again to play a draw animation --> sword reappearing.
    But I have to remove one equipment viewer component for it to work. Would this create any problem?

    About the sword showing on the back, do you think this would work? Lets say I create another equipment parts call sword back, I added another sword to the weapon list(same sword, just different name, but this mean I am restricted to only one sword in the game, since the back sword and the sword in the right hand must both match). In the add start equipment, I would then add the sword to the swordback section. In the event system, I would then just add another variable to make the back sword disappear/appear when playing the sheathing/unsheathing animation. Would be this feasible? Or do you recommend something else, something simpler that will also works with more than one sword?
    Post edited by Shadow_Fire on
  • Strange, usually you should be able to do this with 2 equipment viewers with different variable conditions ...

    Can you send me a small project with your setup?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 2014
    Send!
    In a rush, I deleted quite a lot so if the no texture is too hard to see, I can send it again.

    Edit again. Sweeeeet, I manage with only one equipment viewer to use a variable to make the sword appear and disappear using the sheathing and unsheathing animation and showing the sword on the character's back when it's in sheath mode.
    I feel so proud XD.
    Post edited by Shadow_Fire on
Sign In or Register to comment.