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? =]
It looks like you're new here. If you want to get involved, click one of these buttons!
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 :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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.
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).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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?
Can you send me a small project with your setup?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
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.