(3 in 1 Problems Deal!) Using Audio / PlayPedAmbientSpeechNative Issues / Store Peds

So you chose the 3 in 1 deal? Great choice! Let me get started.

I am currently trying to implement my own version of the twenty convenience stores in the game.
Right now I am working on the Dialogue spoken by the clerk whilst being robbed.
In my reference recording the asian clerk says: “Ok, I give you what you want, stay calm, relax!”
and “What you want now? You have taken all the money!”

But using PlayPedAmbientSpeechNative I could only get these lines:

Speech Name Dialogue Comment
SHOP_NO_MESSING Can we just relax please!; Just settle down, ok?; Take a chill pill! - strong text
SHOP_NO_COPS You’re a wanted individual I can’t serve you!; I can’t help you if the cops are after you!; No, come back without the cops please! When the player is wanted.
SHOP_NO_WEAPON You can’t have a weapon in here!; Absolutely not, no weapons allowed in here!; No weapons, that’s reasonable right? When player has weapon in store.
SHOP_SHOOTING - wrong ped - -

These were the ones all using SPEECH_PARAMS_SHOUTED (changing this does not affect said content afaik) and using Ped ShopKeep01. My reference lines nowhere to be found? Then again those were said by a different ped.

Testing showed that PlayPedAmbientSpeechNative is ped dependent! This means I have the wrong ped, at least to some degree. Thus my first two questions!

1. Have you seen the PedHash for this Ped (or any other store peds)?

I literally looked at all in-game peds and must have overlooked him due to probably a different outfit (I did this 3 times :sob:)

2. Is PlayPedAmbientSpeechNative the only way to get in-game speech? What about cutscenes?

That were my first two questions!
Another thing I realized is that once all dialogue options have been said from that point onward there will only be silence and this silence is ped independent. Let me explain!
I go to store one, rob it, ped says its dialogue and all is fine. Now I do this three more times. The third time the last option of the three that hasn’t been said will be said and on the fourth try nothing will be said at all. Even though these peds are completely unrelated besides being of the same type (ShopKeep01).

3. How can I get PlayPedAmbientSpeechNative to work an infinite ammount of times?

Again any help is appreciated, it’s 2am and I am desperate!

2 Likes

OK, so I got my first question answered!

(This is audio unrelated…)

So I already knew that each Ped has Variations in looks. Meaning there must be different looks for my PedHash.ShopKeep01.

I found SetPedComponentVariation(int pedHandle, int componentId, int drawableId, int textureId, int paletteId); and it came with a table along the lines of (simplified):

Body Component componentId
Head 0
Beard 1
Hair 2
Torso 3
Legs 4
Hands 5
Feet 6
Teeth 7
Accessories 8
Tasks 9

To change the appearance of a body part component we need a drawableId and a textureId. I still don’t really understand what makes a draw-able a draw-able and a texture a texture, but who cares. Lets start with drawableId.

The docs told me to use GetNumberOfPedDrawableVariations which I did for each Body component (using its component id). This returns the total amount of draw-able variations which effectively gets you the draw-able ids since it’s just the length and an id is the index (returns 3 → id’s: 0, 1, 2):

Debug.WriteLine(GetNumberOfPedDrawableVariations(clerk.Handle, 0).ToString());
Debug.WriteLine(GetNumberOfPedDrawableVariations(clerk.Handle, 2).ToString());
Debug.WriteLine(GetNumberOfPedDrawableVariations(clerk.Handle, 3).ToString());
Debug.WriteLine(GetNumberOfPedDrawableVariations(clerk.Handle, 8).ToString());

(These are the ones that returned more than a single variation)

For simplicity putting them in a table looks like this:

Body Component componentId Drawable Variations drawableId’s (length - 1)
Head 0 3 0, 1, 2
Hair 2 3 0, 1, 2
Torso 3 2 0, 1
Accessories 8 2 0, 1

DrawableId’s check, now textureId’s!
We need the texture-id’s for each draw-able variation, for this the docs reference GetNumberOfPedTextureVariations which takes a componentId and drawableId, the drawableId we have from the step just before, so for each draw-able variation we now get all texture variations:

            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 0, 0).ToString()); // Head 1
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 2, 0).ToString()); // Hair 1
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 3, 0).ToString()); // Torso 1
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 8, 0).ToString()); // Accessory 1

            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 0, 1).ToString()); // Head 2
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 2, 1).ToString()); // Hair 2
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 3, 1).ToString()); // Torso 2
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 8, 1).ToString()); // Accessory 2

            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 0, 2).ToString()); // Head 3
            Debug.WriteLine(GetNumberOfPedTextureVariations(clerk.Handle, 2, 2).ToString()); // Hair 3

Again in a table:

Body Component componentId Drawable Variation drawableId Texture Variations textureId’s (length - 1)
Head 0 1 0 3 0,1,2
Head 0 2 1 1 0
Head 0 3 2 3 0,1,2
Hair 2 1 0 1 0
Hair 2 2 1 2 0,1
Hair 2 3 2 2 0,1
Torso 3 1 0 3 0,1,2
Torso 3 2 1 3 0,1,2
Accessories 8 1 0 3 0,1,2
Accessories 8 2 1 1 0

With this one now has every variation of this ped and we can change the peds look using using SetPedComponentVariation.

Default look:

Using SetPedComponentVariation(clerk.Handle, 0, 2, 0, 0); // Ped Clerk, Head Component, Head 3, Texture 1, Palate 1:

I’m sure someone out there has written a much better and more detailed forum post on this, if you know of such one, please link it! I’m sure this is considered basic knowledge but this was something new (and fun) for me. I’m also very sorry for how off-topic this is, back to audio! Next step for me is finding out if variation affects dialogue options!

Ok so I’ve gotten closer, each different variant has their own dialogue, yet I still feel like I have the wrong speechName!

The new lines audio lines just “confirm my prejudice”:
Please I do not want this Chaos, stop please!
No stop it, not in the shop!
Please stop that this is a respectable shop!

At least I’ve gotten closer to my original clerk.

Original Reference Clerk:

My closest recreation attempt:

I still think I have the wrong head but it’s close enough since later this will be randomized anyways.

SetPedComponentVariation(clerk.Handle, 0, 2, 0, 0); // Sets Head
SetPedComponentVariation(clerk.Handle, 2, 2, 1, 0); // Sets Hair
SetPedComponentVariation(clerk.Handle, 3, 1, 0, 0); // Sets Clothing
SetPedComponentVariation(clerk.Handle, 8, 0, 1, 0); // Sets Apron