Error while switching a weapon

bluebird

New member
Hi,

I've assigned 4 item types to Default Loadout in Inventory.

1135

While I switching weapon with Q or E, I'm getting following errors:

1134

In demo scene switching works perfectly.
Is there anything which I forgot to set up?
 

Justin

Administrator
Staff member
It doesn't look like the selector is initialized - if you click on the item in the hierarchy it should initialize that item.
 

bluebird

New member
I already clicked on item in hierarchy for configure
I also assigned crosshairs sprites in item.cs, adjusted clipsize in ShootableWeapon.cs, assigned reloadable clip object and it's attachment.

Btw, I didn't get your point about selector initialization & initializing an item. I gone through your video tutorial and I did the same as video for creating item types & items.

Note that, if I choose to have only assault rifle, then no errors came into console and it works fine.

later, I removed all items from Default Loadout and added only shot gun.
And play the scene, but I can't fire bcoz it shows bullets 0 in UI monitor. It happens same in case of pistol also.

why it is 0, even after I specify consumable item type to 200 in Default Loadout?

I set look sensitivity to -1 in all items as it mentioned in fire trouble shooting steps:
https://opsive.com/support/documentation/ultimate-character-controller/items/actions/usable/shootable-weapon/

Go through this video for error re-generation steps:

 

Attachments

Justin

Administrator
Staff member
There is a lot going on in that video and it's not a completely new character so I'm not able to completely follow along with what configuration has happened in the past. Taking it one step at a time, it sounds like you got the assault rifle working but not the shotgun, correct? For the shotgun you should be able to follow the same steps that you took for the assault rifle except use a different ItemType and Animator ID.
 

bluebird

New member
Hi Justin,

I followed same steps as I did for assault rifle, I also changed item types & animator id while creating item.
here is video for adding shotgun and I didn't able to fire. I think reason should be a bullet count, it shows 0 in canvas.

 

bluebird

New member
After adding shotgun to Nolan, I added pistol.

I recorded a video for this:


You can check item sets into ItemSetManager, shotgun had higher priority. Then played the scene, it threw same error as I got before (check previous messages).
Then I swapped out item sets and I kept pistol as a higher priority (see at 1:50) and shotgun as a second priority.

There wasn't any error but I also wasn't able to shoot with pistol. You can see bullet count 0 in canvas. (I assume that is the reason behind firing isn't working) Firing should work as I set look sensitivity to -1. (see at 1:00)

Note that, this problem is not only for shotgun & pistol; but when I carry assault rifle and pistol/shotgun in default loadout, in that case I also faced same error. Only working thing is assault rifle in loadout, if I add second weapon into default loadout then problem will arise at switching the weapon.

I hope that both recorded videos can help you to troubleshoot the problem and get the fix soon.
 

Justin

Administrator
Staff member
If the shotgun doesn't work then I would first try to get that item to work rather than adding a new item. Having zero bullets would prevent it from firing. What does your inventory look like?
 

bluebird

New member
Ok. This time I configured only shotgun.

I noticed a difference when I set 'profile' field of item manager to 'Shotgun'. In this case, there won't be any bullets appear in UI monitor. I added bullet count 50 in inventory, even after it does not appear in UI canvas. (loaded & unloaded bullets stays to 0)

When I don't select profile (ie. keep it to None) while setting up shotgun item, It works fine. but I ran into different problem this time.
I've set up shotgun with bullet type count of 50 and clip size 10. after bullets gets finish in magazine OR I press R on key board, reload animation doesn't play. So I checked into inspector and noticed that reload item ability is activated, but reload animation doesn't play. and this ability doesn't even stop. here is the video:

 

Justin

Administrator
Staff member
I would not use the profile since it looks like you got further. If you debug the animator controller does the Slot 0 Item State Index change to 3 when reload is active? If so, is the reload state being played on the arms layer?
 

bluebird

New member
I enabled debug for animator and checked that when I press R, Slot 0 Item State Index change to 3 but doesn't go back to 0. It stays at 3 after key press.
At this time in Arms Layer, active state is Idle state, it doesn't switch to Reload state.
 
Last edited:

Justin

Administrator
Staff member
Ah hah - think I figured it out. On your shotgun change the reload Animator Audio Selector to Random and also have an Item Substate Index of 3. Once you do that the animation should play.

1152

You'll also need to ensure that you deselect the Reload Event's Wait For Animation Event toggle and specify a duration of 0.42.
 

bluebird

New member
Hi,

I made modifications as you said. (only change is loaded and unloaded bullets are set in UI)
1) but firing is not working.

I noticed following things:
Slot0 Item State Index is still 3. (It should be switch back to 0 and when I fire it should switch to 2. but it doesn't change!)
Slot0 Item State Index Change is still enabled. (It should be disable after reload completes)
In Arms layer of animator, active state is Idle

2) Also, IK isn't working.
I don't know what's going on behind..

You can check screenshots attached


Also, can you clarify why there are problems to set up basics features of asset? (like firing, reloading, switching weapons, run time pick up)
I didn't use any custom characters/weapons/animations yet! I used whatever came with asset.
Still I'm facing issues with setting up basic things. I followed your tutorials as they are.

Are those videos deprecated or what? I have only one item working - assault rifle.
It feels like the process is not straight forward to set up. :(

There are lots of common problems/questions comes everyday regarding core features to setting up.
Please rework on tutorial videos/documentation for each weapon. I would suggest to pin up common problems at top of forum.

It has been a month since I started exploring this asset. but I'm still struggling to work with basics correctly o_O
 

Attachments

Justin

Administrator
Staff member
Here is a three minute long video of me setting up the shotgun. I haven't setup the shotgun in awhile so it wasn't a perfect run through but I was able to fire and reload. IK also works. Hopefully this helps:


Also, can you clarify why there are problems to set up basics features of asset? (like firing, reloading, switching weapons, run time pick up)
I didn't use any custom characters/weapons/animations yet! I used whatever came with asset.
Still I'm facing issues with setting up basic things. I followed your tutorials as they are.

Are those videos deprecated or what? I have only one item working - assault rifle.
It feels like the process is not straight forward to set up. :(
This is a large asset so it takes some time to fully understand how it works. I would love to make it easier so if you have any suggestions I'm all ears, but I can't make a video for every weapon because that would cause the videos to go out of date too quickly when we change a parameter within the demo scene for example. The videos that are out there now are accurate and it explains the overall concepts well, but for something like a shotgun where there aren't any tutorials for it I recommend comparing the values of the shotgun within the demo scene to your shotgun.
 

bluebird

New member
Okay. thanks for clarification and video link.
Unfortunately, that website is not available in our country, so can't watch your video.

by the way, good news is shot gun is set up successfully.
and I can switch between assault rifle and shotgun, now

For IK, I changed value of 'Hand Weight' property to 1. It's also working now.
 
Top