Setting up a character with a gun and a grenade

andrewpmoore

New member
I've been trying to follow the instructions, watch videos and look at the demos for a few days now trying to get a simple scenario set up.

I want two buttons on the screen
"Fire gun"
and
"Throw grenade"

I've managed to get the pistol and assault rifle to fire ok, but just can't work out exactly what's needed to get the grenade to be available and fire at any time.
It's be great for a video tutorial on setting these up.

I've read up on item sets here https://opsive.com/support/documentation/ultimate-character-controller/inventory/item-sets/ plus any other parts I can think of.

Currently I've got my item set set up like this:
1323
and can see my inventory

1324

but when canStartAbility is called it get's the item from item set 0 (I guess because it's active)
Do I need to programatically change the active set?

Looking at the Double Category Setup section, I can't tell if I'm supposed to have two "Item set managers" attached, one for each category.

The documentation is ok for each individual part, but I've found the video's to be so much more useful for understanding how one thing is tied to another.

Also I'm not sure if I always need to "aim" before being able to "use" or whether it varies from weapon to weapon.

Any help greatly appreciated as I've been stuck on this for a few days. I've tried so many things now I'm not really sure what to try.
 
Typically after days of looking into it, I tried a few more things and got it working!
Just kept it simple with one item set with the gun in one hand and the grenade in the other.
 
Glad you were able to get a solution :)

Even though you had the items in a different slot they are still in the same item set so they won't both be able to be active at the same time. In order to have them both active at the same time you'll need to create a new Item Set category similar to the demo scene. You can then add another Equip/Use ability for that category and be able to use the grenade at any time.
 
Thanks, any chance of a couple of screenshots of the Item Set Manager and the Item Abilities with how you are suggesting?
Although the demo is great for showcasing all the features available it's sometimes hard to pick apart due to the amount of features in it
 
I also keep seeing

Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Objects.TrajectoryObject.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Objects/TrajectoryObject.cs:453)

when I'm calling use ability on the grenade.
canStartAbility returns true, but then fails. Debugging, most of the time the m_Transform has a value, but occasionally it doesn't
 
Thanks, any chance of a couple of screenshots of the Item Set Manager and the Item Abilities with how you are suggesting?
Although the demo is great for showcasing all the features available it's sometimes hard to pick apart due to the amount of features in it
The Double Category Setup from the Item Set Manager link is a good overview of it.

when I'm calling use ability on the grenade.
canStartAbility returns true, but then fails. Debugging, most of the time the m_Transform has a value, but occasionally it doesn't
That line indicates m_Transform is null. Did InitializeComponentReferences get called? If you can tell me how to reproduce it within the demo scene I can also take a look.
 
Top