Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Spawned EUP NPC has green hair

Featured Replies

Playing around with a callout script and trying to spawn an EUP ped.  Everything is working correctly except that when I try to set the hair (Component #2), the hair shows up as bright green.  Tried searching for similar issues and didn't find any info.  I need the hair to be normal, random colors... black, brown, etc.

 

Code below:

Spoiler

Model policeOfficerModel = new Model("mp_m_freemode_01");
Ped policeOfficer = new Ped(policeOfficerModel, newPosition, newHeading);
policeOfficer.SetVariation(2, 74, 0); // component 2 = hair, drawable 74, texture 0

 

Any ideas how to be able to set the hair style without it turning out bright green?  I really don't want to leave all my spawned peds bald.

 

Apologies if this is not the correct subforum for this question.

  • 4 weeks later...
  • Author

Figured this out.  For anybody having a similar issue, the solution is sort of two-step as described below.

 

1) After setting the hair component (Component #2), call the SET_PED_HEAD_BLEND_DATA native method.  Not sure if the order matters for those two actions, but this is what I did and it worked.  Calling the native Head Blend method will set their face shape & skin color, and for some reason it also fixes the green hair issue.

 

2) [OPTIONAL] After calling the Head Blend native method, all hair will be black by default.  If you want to change it to another color, you will then need to call the _SET_PED_HAIR_COLOR native method.

 

Two important notes about the _SET_PED_HAIR_COLOR native method:

  • When trying to call the method by name, it was crashing LSPDFR and my game.  I had to use the CallByHash method to call it.
  • This method does NOT work until you've called the SET_PED_HEAD_BLEND_DATA method as described in step 1.

 

Sample below for illustration purposes... (read: this specific example not tested, but should work)

 

Spoiler

 

// STEP 1: set the hair component
ped.SetVariation(2, 4, 0);  // Component 2, Drawable 4, Texture 0

 

// STEP 2: call SET_PED_HEAD_BLEND_DATA native method
NativeFunction.Natives.SET_PED_HEAD_BLEND_DATA(ped, 2, 27, 0, 14, 30, 0, 0.4847583f, 0.9027591f, 0.0f, 0);

 

// STEP 3: call _SET_PED_HAIR_COLOR native method by hash
NativeArgument argPed = new NativeArgument(ped.Handle);
NativeArgument argColor1 = new NativeArgument(3); // Primary Color
NativeArgument argColor2 = new NativeArgument(3); // Highlight Color
NativeFunction.CallByHash<int>(0x4CFFC65454C93A49, argPed, argColor1, argColor2);

 

Edited by wrps

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.