edited February 2014 in ORK Support
Let's say I have a combatant that have several abilities that uses different weapons. For example, his default attack weapon is a pistol, but he has an ability that uses a rifle. When the ability finishes, the character will return to his pistol. What would be the best method in switching out weapons specificly for abilities? Would Spawn/Destroy prefab be essential for this when creating the events for the ability?
Post edited by gamingislove on
  • Interesting problem, never thought of something like this :D

    For now you can work with the event system, but if you have a large amount of weapons, this could be a bit cumbersome :)
    You'd need to create three events (or two, but three would be better, a task per event).

    The 1st event would check for the currently equipped weapon and set a game variable to remember which weapon is equipped (e.g. set a string variable to the weapons name, or set a float variable to the weapons index).
    You'd have to check for each weapon in your game individually (i.e. only one weapon per step) - if the check is successful, set the variable, else execute the next check.

    The 2nd event would now check the inventory for the rifles - again, each individually. If the inventory contains the rifle, equip it, else check for the next rifle.

    The 3rd event would finally check the previously set variable and equip the weapon according to the variable.

    The 1st and 2nd step would be performed as the first two events of your ability. The 3rd event at the end.


    I'll look into it and may make a feature out of this so you wouldn't have to do it this way (which can be really elaborate if you have many weapons).
    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!
  • Couldn't wrap my head around that one, so I might just wait and see what you can do. Haha...

    The Ability weapons aren't inventory-based; it's just apart of the abilities' animations. His pistol is the only equippable weapon.
  • Ok, if you don't really need to switch equipment, I'd use the prefab steps to spawn the rifle's prefab on your player.
    To hide the currently equipped weapon I'd use game variables, but the equipment viewer currently can't use them - will come in one of the next udpates :)
    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 November 2013
    Variable logic is something I have yet to learn, I must admit.

    How would variables work in this case? I don't know much of the uses for variables yet.
    Post edited by Griffin on
  • edited February 2014
    I have another question! (disregard the previous one since that's been covered already)

    If a character's prefab includes items/weapons they were modeled with, could you still use Equipment Viewer? Or do the weapons have to be individual prefabs? Sorry if that doesn't make sense! Like if a weapon is a child object of a character model. :]

    When adding a weapon to an Equipment Viewer, what determines how the weapon will be positioned on it? Obviously, you wouldn't want the character to be holding a sword at the blade!

    Post edited by Griffin on
  • Weapons have to be individual prefabs to be used by the equipment viewer.

    The equipment viewer will place the equipment's prefab exactly how the game object the viewer is attached to. You can add individual offsets to position and rotation in the equipment's settings.
    Crucial for this placement is to know where the origin (i.e. position 0, 0, 0) of the prefab is - that's usually determined in whatever 3D model program it was created. This position of the prefab will be placed at the position of the viewer.
    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!
  • Understandable! Thanks!


    Will it be possible (in the future) to include a WYSIWYG for Equipment Viewer? If not, I'll handle the hard part! :]
  • Good idea, should be useful - I'll look into it :)
    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!
  • Awesome! Thread no longer needed!
  • Actually, I have one more question. What if the weapon is animated? Such as a flail? How could something like that be incorporated into Equipment Viewer if it has to be its own prefab?
  • Well, at least in the battle events (as in any other event), you can use a child object of any actor, waypoint or prefab for the different steps - so you can use that to play the animation on the weapon in an ability's battle event.

    Outside of that, you'd need handle this yourself with a small script ... or maybe global events, but I think a script would be simpler :)
    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!
  • Righty-o! Consider this solved!
Sign In or Register to comment.