Having Trouble With Grenades and Dual Wielding

Hi, so I've got the Ultimate third Person Controller package a while ago and I'm liking it quite a bit so far. I do seem to be having quite a few issues with the inventory and item set management systems.

I have three gun's working right now, I'm trying to get dual wielding working but I am having an issue with equipping both pistols at the same time.

I've made two different items with separate item definitions and they are in the same set. One is a right and pistol with Anim Item slot ID 0 and the other is a left hand pistol with Anim Item slot ID 1. They are both in the same item set as left and right slot items ( 0 and 1 ) but when I am playing the game they only equip one at a time.

They do equip in different hands, one in the left and one in the right when I switch to the next available weapon. I'm just having issues getting them to equip at the same time.

As well as that, I am having some troubles with the grenades as well. I have a grenade set up, it works fine when the game is first played and loaded up ( default item set load out). The grenade throws and explodes and does damage and all that, but it is always equipped in the left hand. When I manage to unequip it and holster it( which it does nicely, sits on the holster looking good and all) I can't re-equip it. I have a second item set named "Grenades" that has the Unequip and Equip abilities but for some reason it's not re-equipping.

So to summarize, I'm having trouble dual wielding and equip both pistols at the same time. And with the grenades I'd like the grenade sitting on the holster the entire time and for the character to grab this grenade with his left and and throw it whenever the player wanted.

Thank you for any help or advise.
 
For the dual-wielding, does the Slot ID for each item match the slot you've assigned it to in the Item Set Manager? I.e. the Slot 0 item is in Slot 0 in the Item Set, etc.

For the grenade, I'm not 100% understanding what you're trying to achieve - you want the grenade to always be equipped in Slot 1, and dual wield-able with other items? If so, you'll again need to check its Item Slot and then create a different Item Set for each combination of another item + the grenade, e.g. the right-hand gun in slot 0 and the grenade in slot 1.
 
Hi, thank you for the quick response! I've actually made some good progress with the dual wielding and learned a good amount about this controller along the way.

The more I learn about how this controller is setup the more I like it to be honest. I've gotten my character to dual wield the two pistols. The item slot ID was the same for both of them so I did just have to change that and now they both equip.

So here's my issue now, they both equip and fire, at the same time. The only thing is they both fire at the same time with the "Fire1" input. I would like each gun to fire alternatively with the same input of "Fire1". I've been reading a response of your own here https://www.opsive.com/forum/index.php?threads/dualwield-firing-setup.3601/ and I'm going to give that a go later today.

I'm still having issues with the grenade, and now it's tied in with this dual wielding so I'll try to clear that up as best I can.

What I want from the grenades: I want the grenades, when equipped, to always be holstered on my characters waist. Then at any given time I want the player to be able to toss the grenade when they want while still holding whatever weapon they have, single shot guns and rifles or dual wielding. So basically a secondary throwable that can be used at any time.

What I have right now: The grenade is either always visible on the players hand, and I mean always attached to the players hand, or it is on the holster and therefore "unequipped", it looks great on the holster, I would just like it to be throwable from the holster. Also be able to change the active grenade when the player has more than one equipped or available.

The other issue I'm having is now that the dual wielding pistols is getting underway, since I have three Use abilities ( one for Slot 0 "Weapons", one for Slot 1 "Weapons", and one for Slot 1 "Grenades") now pressing the "G" key to throw a grenade while dual wielding will actually cause the pistol in my players left hand to fire. I'm guessing this is because I have that second Slot 1 use ability and it's mapped to the "G" and "Fire1" inputs.

So maybe I have to disable some of the use abilities when dual wielding so that pressing the "G" key input only throws grenades and does not cause the left hand Slot 1 pistol to be fired.

Also I think I have to make separate states for all of this? To fire each pistol alternatively with the same mouse button and be able to throw grenades with "G" when needed?

Thanks for your response and any advice is greatly appreciated. This is a great controller and I'm excited to get proficient with the system and see what it can really do.
 
Hm well since you want to be able to dual wield and still use the grenades, then I think you'll need to take a slightly different approach to them, since there isn't really a concept in UCC of being able to use an item when it's not currently active in one of the slots. There are a few different approaches you could take - the simplest is probably to just create a custom Ability which manually "uses" the grenade item (I'm not exactly sure if you can just call StartItemUse on a UsableItem even if it's not active, but that would be a place to start) from the character's inventory, regardless of if it's active or not, i.e. you'd look through the character's current inventory rather then checking their currently active item. The various example scripts on this page may give you some ideas on how to start doing this.

So it turns out you can actually just have a 3rd item slot, there's nothing in UCC that restricts you to just the default 2 slots. When you create a new item in the Opsive manager, if you use a blank gameobject as its item parent (i.e. no ItemSlot component), then it'll add that component automatically and increase the slot ID number by 1 (i.e. if you already have 2 ItemSlot components set up, as in the demo scene, then adding another one will set the new component's ID to 3). You can then allow your character to have 3 items active at any time, and restrict your grenade items to this new slot.

You'd need to set up a couple of extra things, like adding another set of animator parameters, e.g. Slot2ItemID, as well as creating a third EquipUnequip ability and Use ability for the new slot.

(Hope that other thread helps!)
 
Last edited:
Top