How to setup the body to be default and work with weapons?

drerlee

Member
How do you setup the body to be default and work with weapons. So far my effort has led me to my no longer being able to equip weapons after adding the body. What is the correct way to set the body on the character by default and still be able to pick up weapons?
 
Actually my character appears to be stuck in the melee state after attacking, and not only can i not attach weapons, but other functions cease to work as well such as my character does not die now after being killed. I've added the meleechacterIK preset to the body state. No difference. docs dont show how to set this up, and there is no video. I feel like ive been dealing with this way longer than i need to. How to resolve this?
 
If your character is stuck in an attack state my guess is that the use ability is waiting for an animation event that does not exist, so the attack never completes.
Either change it such that you do not wait for the animation event and instead wait a constant amount of seconds, or add the animation event on your item.
1632380376164.png
1632380563332.png

The animation events are called:
OnAnimatorItemUse
and
OnAnimationItemUseComplete

The Body Item is setup like any other Melee Item. In the integration all Items must be set as prefabs and must be dynamically added to the character. The way the item knows where the colliders are (legs, arms, etc...) is by using ObjectIdentifier IDs.

If you go in the weapon properties and click on one of the hitbox colliders within the list you'll be able to set the ID for it:
1632380909153.png
This ID is unique and the item will search for it on the character when the item is equipped.

If you wish to make the body item default, and that it can never be unequipped, I recommend making two "Equippable" ItemCollections. On for your equipment, and the other for your body item. Then you can simply set the body in the body Item Collection at edit time and it will be equipped automatically.

Check out the integration demo to see this in action.
I will update the documentation when we the new version is realeased to make this more clear.

I hope this helps.
 
If your character is stuck in an attack state my guess is that the use ability is waiting for an animation event that does not exist, so the attack never completes.
Either change it such that you do not wait for the animation event and instead wait a constant amount of seconds, or add the animation event on your item.
View attachment 7251
View attachment 7252

The animation events are called:
OnAnimatorItemUse
and
OnAnimationItemUseComplete

The Body Item is setup like any other Melee Item. In the integration all Items must be set as prefabs and must be dynamically added to the character. The way the item knows where the colliders are (legs, arms, etc...) is by using ObjectIdentifier IDs.

If you go in the weapon properties and click on one of the hitbox colliders within the list you'll be able to set the ID for it:
View attachment 7253
This ID is unique and the item will search for it on the character when the item is equipped.

If you wish to make the body item default, and that it can never be unequipped, I recommend making two "Equippable" ItemCollections. On for your equipment, and the other for your body item. Then you can simply set the body in the body Item Collection at edit time and it will be equipped automatically.

Check out the integration demo to see this in action.
I will update the documentation when we the new version is realeased to make this more clear.

I hope this helps.
I was already doing every step you mentioned in your response except for the "uncheck wait for animation event". The only way I could learn how to set this up with the ultimate Inventory System was by studying the demo, which I have done and Im constantly referencing back and forth to setup my character just like Nolan, but Im having the same issue. This is going on an entire day of me trying different things. I've unchecked the "wait for animation event" on the Melee script, like you said and still the same issue. After I punch and/or kick, my character walks funny and is not able to equip any items, nor be killed or use any other abilities besides walking and running. Im not doing anything with animation events, although I was already aware of those two commands you gave me. Anyways, my issue still exists,
 
Ok here is some more context. Im getting 100's of errors in my logs that I dont know how to fix shown in the images below all related to the integration:
 

Attachments

  • IndexOutOfRange.PNG
    IndexOutOfRange.PNG
    153 KB · Views: 15
  • MeleeWeapon.cs507.PNG
    MeleeWeapon.cs507.PNG
    140.2 KB · Views: 15
  • nullreferenceexception.PNG
    nullreferenceexception.PNG
    156.9 KB · Views: 15
And these as well:
 

Attachments

  • items.cs648_error.PNG
    items.cs648_error.PNG
    117.1 KB · Views: 3
  • items.cs639_error.PNG
    items.cs639_error.PNG
    132.5 KB · Views: 3
  • MeLeeWeaponPropertiesComponentCannotBeFound.PNG
    MeLeeWeaponPropertiesComponentCannotBeFound.PNG
    84.6 KB · Views: 3
When you have errors you must fix them in order since errors can waterfall, meaning one error can cause other scripts to not initialize and cause more errors which may not even be related to the first error. Fixing the first error might fix everything else.

I see that you also have warnings that you are hiding, these might have some context as to how to fix your issues.

One of the errors say you are missing a trigger on the Health Pickup. Try fixing that.

As for the error with the BridgeEquippableProcessing, I check the code, can you confirm that the line that causes the issue is:
Code:
if(ItemSetManager.ActiveItemSetIndex[categoryIndex] != -1){ return; }
If that's the case then my guess is that your itemSetManager was either not initialized properly, or your Item Set Manager Item Set Categories are broken. Perhaps the Body item doesn't know in what category it should be equipped.
Could you show me a screenshot of your InventoryItemSetManager component?


Once you fix the errors one way to debug the character being stuck is by checking the Animator at runtime. Try to find the animation the character is stuck in, and check the transition parameters to see why it isn't transitioning out of that animation. That should give you a good indication of what is wrong.
 
The health pickup was an unrelated issue because of a playmaker script. I have removed that totally from the scene and those errors are gone. The only errors are from UCC now including the two warnings which are telling me: The "Pathfinding ability" should be ordered above the "Move Towards" ability, in which i have no clue what it is taking about, i dont have any pathfinding abilities showing in the characters locomotion script.

There are a few lines that the bridgeequippableprocessing shows and the only one close to the line you mentioned is on 562: if (itemSetIndex == -1) { return false; }

If my Item Set Categories are broken, then wouldn't they cause a problem with all of my other pickups? Because they all work fine without the body enabled.

Ive attached my ItemSetyMgr below
 

Attachments

  • InventoryItemSetMgr.PNG
    InventoryItemSetMgr.PNG
    34.6 KB · Views: 3
Thanks to your reply I realized the code had change between my current version and the one that is currently released. We planned for an update soon but it was delayed to early next month. So I searched in the forum to see if someone had the same error as you previously.

I think your issue is related to this post, the error happens on the same line of code:

There I shared the code changes that should fix your issue.

I'm very sorry for the inconvinience. The next update is a very big one that will fix and add new functionalities to both UCC (2.4) and UIS (1.2). We'll make quicker/smaller updates more often once those are released.

Out of curiosity why did you make the Body Item on another Item Set Category?

Item Set Categories are meant to be used as ways to equip Item Sets in parrelel. For example we use it in the demo scene to equip any magic with all othe ItemSets, or allow to throw grenades whether your left or right hand is available not matter what item is equipped in the other hand.
 
Thanks to your reply I realized the code had change between my current version and the one that is currently released. We planned for an update soon but it was delayed to early next month. So I searched in the forum to see if someone had the same error as you previously.

I think your issue is related to this post, the error happens on the same line of code:

There I shared the code changes that should fix your issue.

I'm very sorry for the inconvinience. The next update is a very big one that will fix and add new functionalities to both UCC (2.4) and UIS (1.2). We'll make quicker/smaller updates more often once those are released.

Out of curiosity why did you make the Body Item on another Item Set Category?

Item Set Categories are meant to be used as ways to equip Item Sets in parrelel. For example we use it in the demo scene to equip any magic with all othe ItemSets, or allow to throw grenades whether your left or right hand is available not matter what item is equipped in the other hand.


"Out of curiosity why did you make the Body Item on another Item Set Category?"
I had already tried placing it as an item set under the equippable category, nothing is working so i was trying different things.

I copied the code to both scripts you reference in that thread, however my issue still exists. Im still receiving the same slew of errors. One of the errors Im very curious about is the one that says:
"Error: The First/Third Person Melee Weapon Properties component cannot be found for the Body. Ensure the component exists and the component's Action ID matches the Action ID of the Item (0).
UnityEngine.Debug:LogError (object)
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon:Start () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:335)'
 
I believe the error is mentioning that either those components are missing or that the Action ID isn't 0
1632484472745.png

Try comparing your Body Item prefab with the one from the Demo to see if you can find any differences.

But as I mentioned previously, if you have other errors before that, thos errors might be preventing your item from being spawned/initialized correctly and that could cause these sort of issues.

If you can't get it to work I will ask you to send me your project at support@opsive.com such that I can have a look when I have some time. When sending a project export the relevant assets in a package and make sure to test that package in a new project before sending it, to make sure it compiles and that you can reproduce the error.

I'm very sorry you are having so many issues, and hopefully we can get to the bottom of this soon. I'll make sure to update the documentation afterwards with our findings such that no one else gets stuck on this issue in the future.
 
I've compared the body and my body is missing both the third person perspective item script and the third person melee weapon properties script. I have added those two, but the same issues occur. Shouldn't those scripts be auto-added when i go through the ucc item pickup screen?
 
They will be added automatically through the Item Builder. If you have not done so I would first create a fresh project and go through the video below on setting up a melee weapon. This will allow you to follow the video step by step without the integration. Once you get the workflow down you can then create it again, this time following the integration steps by making it a runtime item.

 
Thank you for the package, I reviewed it and answered.
As I mentioned above your Body prefab is missing some components. I recommend you create a new Body Item prefab and refer to the demo scene body prefab for comparison
 
Im sorry, I forgot I renamed the demo scene to "Doom City 3". The scene is in the folder _scenes. Ican resend it if nesscessary I have followed your instructions, and I realize the correct properties on the melee weapon were not showing becauseI wasn't selecting {"add third person visible item" option.I went and created the body prefab witht the correct properties, however I am still having issues using it with Ultimate Inventory. I've added the body as a "character item' through the integrations screen. And Ive set the body to the item set category restrictions under the "equippable" category, andIve set the body to its on item collection under the "equippable" item set category. Now, the player does not do anything when I try to punc, or kick. At the same time, I ve again noticed when my AI kills me, the player doesn't die. Something about the setup is not correct.
 
Does your character not die only when the body item is added?
Do you have the Die ability set?

Are you still gettings errors or warnings?

Did you check the Animator at runtime to see if the character is locked in one of the animations?

After creating the new body Item, did you setup the collider IDs and Melee Weapon Animator events?
I'd recommend you open your body Item prefab next to the demo body item prefab and compare it in detail, you might find things that you missed. Also read some of the messages above again where I explain how the colliders are setup in case you missed it.

If you are still struggling with this you can send us your project again. But this time make sure the package you send us compiles and can be used to replicate your error. You can do so by importing the package you exported in a new project and testing it.
It would also help if you can send us some reproducution steps to get to where things fail.
 
Does your character not die only when the body item is added?
Do you have the Die ability set?

Are you still gettings errors or warnings?

Did you check the Animator at runtime to see if the character is locked in one of the animations?

After creating the new body Item, did you setup the collider IDs and Melee Weapon Animator events?
I'd recommend you open your body Item prefab next to the demo body item prefab and compare it in detail, you might find things that you missed. Also read some of the messages above again where I explain how the colliders are setup in case you missed it.

If you are still struggling with this you can send us your project again. But this time make sure the package you send us compiles and can be used to replicate your error. You can do so by importing the package you exported in a new project and testing it.
It would also help if you can send us some reproducution steps to get to where things fail.

Yes, my character not dying only happens the body is attached.

No errors.

I did not setup colliders. I will now.

Ive already checked the package i sent you previously. there should be nothing wrong. I explained in my prior response to you the scene name was different.

Recreating the scenario should be simple as my original thread question. How to setup the body with ultimate Inventory, so the character can always be able to do melee combat and equip weapons. So far mine is only able to equip weapons.

Im testing now. I will let you know shortly.
 
As you can see from both below screen shots, my character now has all the same scripts as the demo characters. Furthermore, What do you mean setup colliders, there are no coilliders on the demo object in the third person melee properties script? All of those fields are empty. And when i tried dragging my colliders to the body object, the script wouldn't let me. No errors in the console

What are your instructions from start to finish to getting melee ability to work with Ultimate Inventory?
 

Attachments

  • Mybodydemo2.PNG
    Mybodydemo2.PNG
    224.3 KB · Views: 0
  • Yours.PNG
    Yours.PNG
    252.9 KB · Views: 0
Top