Is there a simple way to check for which part a selected equipment piece is equipped to?
  • Hm, no, I don't think there is ... where do you want to check it, events or formulas?
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • It would simplify many events and formulas to be able to do a quick check on the location of a selected equipment piece rather than constantly cycling to see if an equipment part has an item equipped that matches the selected equipment. More than that, I'd like to be able to link equipment parts in my equip events to set default locations for holding equipment when it's unequipped, and so that I can automatically set up the proper variables to then feed to my equipment viewers. Also, while I'm on that subject, how do I turn off/make invisible specific children of a parent mesh? I haven't had any luck playing around with the 'Child Renderer'.
  • I'll look into adding new options for checking selected data being equipped on an equipment part.

    If you want to unequip equipment to another part, you can use the Switch Equipment node for that - otherwise I'll need more details on what you want to do.

    The Use Child Renderer settings of an equipment viewer are for changing the material of a renderer on a different game object than the one the viewer is attached to. The path to the object is defined from the root of the game object the viewer is attached to.
    E.g. if your object's hierarchy (to the renderer) would be RootObject > Spine > RendererObject, the path would be Spine/RendererObject.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks, I am using the 'Switch Equipment Node' and it makes it quite easy to swap equipment via events.

    What I'd like to be able to do is carry multiple items equipped on secondary equipment slots that the viewer displays as something like a dagger resting in its sheath, and which after swapping into one of the active 'Held' slots displays as an empty sheath in the original location with an unsheathed dagger attached to either the right or left hand. My current plan for the setup is something like this...

    -I have three active equipment slots for weapons and such : RightHand, LeftHand & BothHands.

    Let's say that I equip something like a longsword, which can dock to any of the above mentioned slots. Currently my equip event checks combatants for a Stat called 'Equipped Weaponry' which can be an integer from 0-10 depending on the combination of equipment held in those three slots. '0' means that the combatant is unarmed, '1' means that a single melee weapon is held in either the right or left hand, '2' is a melee weapon held in 'BothHands', '3' is held in each the right and left hands and so on. Then it decides how things should be swapped around.

    If the 'Equipped Weaponry' integer, for example, is a '1', the event then searches for whichever hand slot is in use and checks whether the item equipped in that slot can be equipped in both hands, and if so switches it to the applicable slot. It also checks which hand is designated as the combatant's primary hand and blocks that part, unless the weapon can only be equipped in 'BothHands', in which case it blocks both the right and left hand slots. If a second weapon were to be equipped in either the 'RightHand' or 'LeftHand' slots while the 'Equipped Weaponry' stat=2, however, then it checks the equipment docked in the 'BothHands' slot to see whether it can also be equipped as a single handed weapon. If it can, then it switches into the main single-hand slot leaving the newly equipped weapon in the offhand slot where it started, or otherwise the newly equipped weapon is removed while the original one is left in 'BothHands'. After all of the swapping around is done, then variables are assigned and animations are played, and that should give an idea of how everything currently works in that regard.

    Now, the thing is, I also have those secondary slots that I mentioned earlier, which run in pairs; one to hold and display a scabbard (if applicable) for an equipped weapon, and the other to hold the weapon itself when it's not currently being held. I'd like to set these up so that they can recognize and remember each other's default locations, and so that if the long sword mentioned earlier were to be equipped, then a set of variables for defining it's scabbard's properties might transfer to a newly created item which would then dock to an appropriate corresponding slot. I'd like to use these variables to ensure that weapons can easily be swapped between their active and passive equipment parts, and to ensure in the latter instance that they will automatically return to the proper unequipped location. When an equipped weapon is returned to the inventory, I also need to make sure that any scabbard items are destroyed, and of course I'll need to make sure the equipment viewers can all recognize to display these changes accordingly and in sync.

    So, that's basically what I'm looking to achieve there. I don't know if I've thought up the best way to go about it, but at the very least I'd like to make it as foolproof as possible, and hopefully with little to no hassle on the user's end.
  • ThreeNippledWanda
    One other method that you could use that Gil suggested to me is that.
    You don't need to add additional slots for sheathed weapons. What you do is you add multiple equipment viewers of the same slot, then in equipment viewers you setup requirements options.
    For example you could have object variable on combatant or a status value "Sheathed".
    And you setup equipment viewer on the hand to work with Sheathed bool set to false, and equipment viewer on the back to work with Sheathed set to true.

    Then you just change object variable on combatant and ORK does the rest.

    Not sure if this works for your setup, but it worked for me so just wanted to share.
  • edited December 5
    As @hellwalker said, there's an easier way to do this without having to use separate equipment parts :)

    Beside using variable conditions, you can also have your animation enable/disable the equipment viewers (or their game object). E.g. drawing animation disables the sheated viewer and enables the in-hand viewer, sheathing animation disables in-hand and enables sheated viewer.
    Editing animations in Unity allows you to add enabling/disabling stuff as well, and if your model's structure is standardized, you can reuse the animations on them.
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I have variables to manage the swaps, but not a foolproof way as of yet to ensure the variables adjust correctly 100% of the time. If one variable gets off the whole setup glitches.

    Using animations might be a smoother, easier way to handle animation swaps, but I don't believe the Mecanim controller talks to directly to ORK or vice versa. My greater concern is to ensure that item variables update reliably, and the viewers at this stage are actually more useful as a visual means for testing that.

    As far as the need for multiple equipment slots, apart from the three active ones I have to actually use weapons, I don't know if I can get around the additional dormant ones simply by tweaking the equipment viewers because I'm basically wearing the weapons as equipment when they're not in use, and when a weapon is equipped to one of the hand slots the link to its docking slot still needs to be maintained so that it removes to the proper location when it's put away and draws from the proper location when a user wants to reequip it in the hand. That said, I can try to see if I can make it work. It sounds like what you're suggesting is that I create 3 duplicate 'held-in-the-hand' equipment viewers in the empty game object used for holding the 'Sheath' equipment viewer to display an empty sheath while it's in the hand if the designated variable matches, display weapon and sheath together when the weapon is removed to its dormant 'Sheath' slot, and time my variable changes and equipment swaps precisely to occur at the right frame in my animations so that they appear and disappear in unison during the correct frame in my animations.
  • Animations can "SendMessage" the animated object.
    So you could have like a CombatantHelper script, that has functions like Equip/Unequip and change Combatant Object Variable there.
    But, I'm not sure how it's these days. Few years back it was possible that animation events would skip if framerate was low and unity just skipped animating event frame.

    Hmm, so you have 3 possible weapons that can be equipped at the same time but only one is active and in hand right?
    Are they any 3 weapons like 3 two handers or like you can have one dagger, one bow, one two hander?.
    And they each unequip to corresponding type of sheath?

    btw do you have any video or picture for this? Cause it's one of those picture is worth thousand words situations.

    Cause one way to simplify it further is to use conditional prefabs for equipment. You could have Drawn Dagger, Sheathed dagger, Only Sheath models as conditional prefabs for Dagger inventory item and use variables to switch which one need to appear.

    Although I'm not quite sure what is the origin of variables for items condtional prefab, combatant or item variables?
  • The animation doesn't need to talk to ORK directly, as it would just need to enable/disable the equipment viewer to show/hide it :)

    As for having different equipment viewers for different weapons - that could be handled using object variables (on the combatant) and the equip/unequip events to set it based on the weapon.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @hellwalker

    "Hmm, so you have 3 possible weapons that can be equipped at the same time but only one is active and in hand right?
    Are they any 3 weapons like 3 two handers or like you can have one dagger, one bow, one two hander?."

    -There could be a weapon in each the right and left hand slots, *or* a weapon in the 'BothHands' slot. In other words, I just made an extra slot for a weapon carried in both hands to make it easier to distinguish between a single weapon carried two-handedly and two individual weapons held simultaneously. Some weapons can be equipped to any one of the 3 slots and should cycle via their 'On Equip' event to the 'BothHands' slot if no other weapon or shield is currently active, or to one of the available single hand slots when another weapon or a shield is equipped while they're currently active. This part is working, despite my not knowing the order in which ORK equips/unequips an item and runs its event, and vice versa. My test event for equipping and unequipping a single specific item between pre-selected active and inactive slots also seems to edit variables correctly, but I've yet to properly configure the equipment viewer to hide/show child objects of weapon meshes. I'm either not typing something correctly to case, or I've got the wrong idea about how the 'Child Renderer' feature works and what it does.

    "And they each unequip to corresponding type of sheath?"

    -Provided that they should have one, yes. Something like an axe would simply tuck into a sash or belt-loop without needing to toggle any kind of sheath, but it still needs to show up on character models when its tucked away and so requires the same type of active/inactive equipment slot setup as something with an actual sheath to toggle. It's the same basic premise used in many games where they allow you to create multiple equipment setups to toggle between, only I'd like to show all of these carried options simultaneously on the character model and fix it so that they always display in the correct areas. An axe, if it's pulled and equipped from anywhere into the right hand could be unequipped to any of the nearest convenient available slots, which would probably just be a position on the right hip if one is available, or if not would just cycle until it found somewhere to tuck away (I'll keep two 'emergency-slots' in reserve just in case). A sword, on the other hand, will always need to keep track of the slot from where it was pulled so that it returns and draws accordingly.

    "btw do you have any video or picture for this? Cause it's one of those picture is worth thousand words situations."

    -I haven't created any pics or vids yet, though perhaps I'll need to. Prolixity only carries one so far.

    "Cause one way to simplify it further is to use conditional prefabs for equipment. You could have Drawn Dagger, Sheathed dagger, Only Sheath models as conditional prefabs for Dagger inventory item and use variables to switch which one need to appear."

    -I'm certain that variable prefabs are the key to sorting out this system, I just need to be able to prevent glitches. If the system must rely on equip swapping events to create and remove variables, it seems impossible to ensure that something won't get dropped at some point. Speaking of which, that's another matter! If something like a sword is dropped on the ground, it's sheath obviously wouldn't disappear, but neither would the weapon be equipped anymore. For it to be able to return to its proper sheath when re-equipped, there can't be any mismatched variables due to something like a timing issue or Unity glitch, or programming errors. Honestly, I don't know why I even bothered to include that last possibility since it hardly seems possible at all.

    Another problem is that when game objects with character prefabs are initialized, no equip events are run to assign the appropriate item variables. Given the degree of lag I've noticed while running through my attack event chain from start to finish, I'm afraid that running individual initialization events for every spawned character in a scene might cause some some sort of internal hemorrhaging to occur in the processor. Really wish Gordon Moore hadn't written that stupid law.

  • @gamingislove

    "The animation doesn't need to talk to ORK directly, as it would just need to enable/disable the equipment viewer to show/hide it :)"

    -I just don't trust the animations not to glitch through a frame. I'd rather tweak an event's timing so that it creates the variables when an animation *should* reach the appropriate frame. That way, even if the timing is off or an animation frame skips, the variables will still adjust and the viewer should then do its job.

    As for having different equipment viewers for different weapons - that could be handled using object variables (on the combatant) and the equip/unequip events to set it based on the weapon.

    -Right, but the the event will need a way to find and determine where the selected equipment piece is docked. My current event determines this by process of elimination, but it's too clunky for a hyper-complex setup. It would be much simpler if it were able to look and see were the selected equipment, marked 'action', was currently docked. That feature would also eliminate the need for multiple steps in a lot of other instances. Also, I don't believe that equip events occur automatically when a character prefab initializes into a scene.
Sign In or Register to comment.