So I have a system where I can change a party member's class and using conditional prefabs I can change the combatant's prefab to fit the current class.

I would however like to control the animations based on the weapon the character is using. I think it'd be nice to have several Animator Controllers with the same setup, but different animations attached for different weapons. I'm just not sure how I should go about changing the animator controller based on the weapon type. Any tips?
  • Hm, it's probably easiest to do this via a small custom component. You can get notified by a combatant's equipment changes by registering to combatant.Equipment.Changed event handler, check the equipped weapon and change to the appropriate controller.

    Let me know if you need more detailed instructions :)
    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!
  • Finally got more time to spend on this. ^^

    I really only need to change the animator in battle. I can change the animator with script. How do I check the item type of the equipped weapon though?

    I figured I'd simply put a script on the combatant's prefabs that immediately sets the animator in Start() if they have that specific weapon type attached.
  • I would like to get the weapon type specifically for the combatant that the script is attached to, is that possible?

    Could this be done with makinom too?
  • Managed to access the combatant through here: http://orkframework.com/tutorial/howto/accessing-a-game-objects-combatant/

    And I found the way to actually access the equipment type based on ID. If anyone else is struggling with this:
    combatant.Equipment.IsTypeEquipped(EquipSet.Weapon,2,0)

    The 2 is the ID in ORK for the Item type, the 0 is the equipment partID. I have weapons in the first slot in ORK.


  • @Keldryn Tutorial should help out: http://forum.orkframework.com/discussion/5215/tutorial-ork-animations-using-mecanim-my-all-new-comprehensive-guide/p1

    If you want to use code easiest way to do equipment specific stuff is to attach any monobehavior to prefab that gets spawned in players hand and do modifications based on the Start Function of that. You could set Int variable in Mechanim based on your weapon and all that.

  • Seems like my work here is already done :D

    You can also check if an item type is equipped on any equipment part by using -1 as the part ID/index.
    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!
Sign In or Register to comment.