New API For Equipping Assets on Humanoid Player Avatars

Yes, it should.

2 Likes

We definitely considered doing something along those lines, but at the end, settled on the current implementation to make things simpler and more straightforward. It is up to the developer to handle the delta the way they want, and then apply the final description.

For example, if you want to apply the description from an animation bundle, you should first get the latest applied description to the humanoid, copy the animation ids from the animation bundle into that, and then apply that description. A little more work on your side, but doable.

2 Likes

Alright that shouldn’t be an issue. My concern is more with future compatibility, in case Roblox adds more properties to the HumanoidDescription for any future avatar features.

Since there isn’t any official Reflection Lua API in-engine, I can’t iterate over the property names of the object and check which names have an animation suffix. The best I can do in that regard is to check the information obtained from GetBundleDetailsAsync.

Here’s the code from the Bundle Giver I wrote:

1 Like

It appears there needs to be an Animate script in order for this to work, even on stagnate NPCs. Trying to use this on hand held communication devices but to no avail.


Will this be re-worked in the future?

2 Likes

Where can we find a reference to the Methods available? In the wiki pages i can find a few methods in the examples such as

:LoadCharacterWithHumanoidDescription()
:ApplyDescription()
:GetHumanoidDescriptionFromOutfitId

But are these methods the only ones available? The two wiki pages i found dont seem to list them:

and

Thanks! I am trying to find an example of how I would apply a description to an NPC. I guess I would just do something like:

MyNPC:ApplyDescription(someDescritionHere)

Right?

1 Like

I found a new issue regarding equipping heads, I have reported it here with a repro:

4 Likes

NPC’s are currently not supported for HumanoidDescriptions, but the functionality is coming shortly.

2 Likes

You can manually read HumanoidDescriptions and apply them yourself using the Insert Service or such. It’s a lengthy function and can be a bit of a hassle to optimize. But it’s possible. Currently my API builds an NPC pretty easily.

local John = NPCService:CreateNPC("John")
John:LoadCharacter()
John:ApplyDescription(HumanoidDescription)
John:LoadCharacterWithHumanoidDescription(HumanoidDescription)
3 Likes

Looks nice from out here :slight_smile: would you be inclined to share your code?

1 Like

Sure,

A lot of the code is needless, its definitely in a rough state. And I offer no warranties haha

5 Likes

Any time estimate on features for NPCs? Deciding if I should do a custom implementation or wait for official Roblox API

1 Like

Apparently, whenever the game encounters a HumanoidDescription with a “Content Deleted” item, it just ends up not loading the character at all.

In this instance, I’m trying to load in a specific user, but this user is wearing a moderated shirt so I cannot load in that character at all until he or she updates his or her avatar.

Instead of handling the exception in a game that relies on this mechanic, it just ends up throwing an error stating that “Humanoid::ApplyDescription() Assets are incorrect for the Humanoid Description slots they have been assigned to.”

For now, a temporary fix for the problem on my end would be to pcall the function, then if there is an error it would just load a placeholder, but I still do not get why Humanoid:ApplyDescription() cannot handle anything that is “Content Deleted.”

5 Likes

Some else I believe I should add: The shirt is content deleted but still visible on the user in both 2D and 3D. :thinking:

1 Like

I found that if I wait for at least one player’s character to load in before trying to apply HumanoidDescriptions to an NPC it successfully applies the HumanoidDescription to the NPC. Is it safe to build my game/NPCs on top of this “bug”, or will something be changing in the future that will break this?

The HumanoidDescription system will shortly be supporting NPCs, so you should be safe to keep doing what you are doing, and once NPCs are supported you will not need to wait for a player character to load

4 Likes

Thanks for the reply. I can’t wait for it to be actually supported!

Also, do you know if there’s any way to keep a set of custom “/e” emotes while also using this system? It won’t allow me to keep a custom animation script in the game & even if I wanted to I also want to allow players to use any set of animations that they’d like to. Not sure how to add custom emotes if the script is constantly being re-inserted.

You’d need to edit the chat modules to do that.

1 Like

I’m pretty sure the chat modules no longer carry that functionality, it was all moved to the Animate script.

I love the new feature,
I created 64 accounts and recorded their user id’s. This gives me a library of 64 avatars that I can convert players into. The head issue has been mentioned by a few. This is where the head may not be in the right place when moving between R standards. My solution was to simply call the function a second time after a short wait. The other part of the trick was to lock the user out from calling the transform function for 5 seconds. This way the function can make clean calls without conflicts that could be generated by impatient clickers.

local module = {}
local locked = false
locked = script.Locked.Value

if not locked then
locked = true
function module.execute(player,avatar,avatartracker)
local humanoid = player.Character and player.Character:FindFirstChild(“Humanoid”)
if humanoid then
local humanoidDescriptionForUser = game.Players:GetHumanoidDescriptionFromUserId(avatar)

			humanoid:ApplyDescription(humanoidDescriptionForUser)
			wait(.25)
			humanoid:ApplyDescription(humanoidDescriptionForUser)
			wait(2)
			
			player.records.AvatarLast.Value = avatartracker --I have records to keep track when a player rejoins.

locked = false
	end
end

end

return module

Here is a link to my game:

Once I get promoted, I’ll post sample images.

You shouldn’t have to apply the description twice to get the correct behavior. Do you have an example of code which doesn’t work? I can look into it and see why it’s broken.

1 Like