Error: Unable to add MyPistol (Opsive.UltimateCharacterController.Items.Item) because the slot id is greater than the number of slots that exist in th

EVG

Member
Hello. I find it difficult to search for information in a foreign language, so I’ll ask a question here, since I haven’t found the answer. I get an error when adding a weapon to a character without a body and animator. Error text: "Error: Unable to add MyPistol (Opsive.UltimateCharacterController.Items.Item) because the slot id is greater than the number of slots that exist in the inventory.". Is everything shown in the video, what am I doing wrong? Why is this error caused? When I do the same actions, BUT for a character with a body and an animator, this error does not exist and the weapon is added. What's my mistake? Sorry for bad english.
 
I see what the issue is, now just trying to figure out the best way to fix it. So your arms are attached to the pistol and you want them to be grouped as one object, similar to UFPS 1, correct? If you manually add the ItemSlot component to your arms@pistol GameObject (under the First Person Objects) then it'll work, but I just want to make sure I know what you are doing so I figure out the correct change.
 
I have a fix for this - open ItemBuilder.cs and add the following under "NEW" to AddFirstPersonObject:

Code:
                    var baseObject = firstPersonObject.AddComponent<FirstPersonController.Character.Identifiers.FirstPersonBaseObject>();
                    baseObject.ID = maxID + 1;

                    // NEW:
                    // An ItemSlot must also be added to the base object if no visible item exists.
                    if (firstPersonVisibleItem == null) {
                        firstPersonObject.AddComponent<ItemSlot>();
                    }
 
  • Like
Reactions: EVG
So your arms are attached to the pistol and you want them to be grouped as one object, similar to UFPS 1, correct?
Yes, right. I use this asset: FPS Weapons

If you manually add the ItemSlot component to your arms@pistol GameObject (under the First Person Objects)
I added. The error has disappeared. Now the weapon is displayed. But it does not shoot, does not react to any actions.

This error appears only when adding a weapon to a character without a body. When adding to a character with a body there is no error.
 
That's right, I forgot to add an event. In general, the problem itself in the topic was solved by adding the ItemSlot component. Thanks Justin.
 
Good evening. Not to create a new topic here. I again had problems with setting up FPC.
1. The recharge sound is not played for the first time. In subsequent times there is sound.
2. Animation shooting does not have time to play several times when I shoot quickly.
3. When changing weapons it moves down.
P.S. I have no idle animation. Available animations: fire, equip, unequip, reload. (events added)
All these problems were not in UFPS 1.
 
Last edited:
Can you please create a new topic to keep things organized? Also, I would start by following the Shootable Weapons video and ensure you can get everything working with the included weapons first. From there you can start to create your own weapons.

 
Top