Jump to content

[SA]Change NPC model


igotnothing

Recommended Posts

9 hours ago, igotnothing said:

how do i change

All peds, weapons, vehicles and some objects are already described in Sanny Builder and if i remember correctly it is impossible to change or add a new one..

 

#ARMY - 287 // Model Name - Model ID
#AK47 - 355 // Model Name - Model ID
#KART - 571 // Model Name - Model ID
#BOMB - 364 // Model Name - Model ID

 

All you can do is change the peds by correctly rigging via 3DMax or Zmodeler, export it to a "txd" and "dff" file and tweak the initiated ped files in "Data" and "Models" folders 😉

  • Like 1
Link to comment
Share on other sites

Maybe something like that. Find a char. Get his model. If model is the one you want to change - then delete char and create another one at exactly the same coordinate.
 

:FIND_CHAR
0AE1: 1@ = random_char_near_point 4@ 5@ 6@ in_radius 25.0 find_next 1 pass_deads 1
0665: get_actor 1@ model_to 12@
:CHECK_MODEL
wait 0
8039:   not 12@ == 28  //28 is the model you want to replace
jf @FIND_CHAR

00A0: store_actor 1@ position_to 4@ 5@ 6@
0172: 7@ = actor 1@ Z_angle
009B: destroy_actor 1@
009A: 1@ = create_actor_pedtype 17 model %put_desired_moel_here% at 4@ 5@ -100.0
0173: set_actor 1@ Z_angle_to 7@

 

Edited by vladvo
Link to comment
Share on other sites

On 3/7/2023 at 11:56 PM, igotnothing said:

how do i change NPC model and pedtype with cleo?

:changePedModel
//  0@ - actorHandle;   1@ - newModelID
0226: 8@ = actor 0@ health  
if 8@ == 100
then
    //  if (CStreaming::ms_aInfoForModel[newModelID].m_nLoadState == LOADSTATE_LOADED) {
    if 0248:   model 1@ available       
    then    
        //  DWORD savedAnimGroup = ped->m_dwAnimGroup;
        0A96: 0@ = actor 0@ struct 
        0A8E: 2@ = 0@ + 0x4D4   //  m_dwAnimGroup from CPed   
        0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0
    
        //  ped->DeleteRwObject();  
        0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0 
        0A8E: 5@ = 3@ + 0x20    //  DeleteRwObject  from CEntityVtbl    
        0A8D: 5@ = read_memory 5@ size 4 virtual_protect 0
        0AA6: call_method 5@ struct 0@ num_params 0 pop 0  
        
        //  ped->m_nModelIndex = -1; 
        0A8E: 6@ = 0@ + 0x22    //  m_nModelIndex from CEntity
        0A8C: write_memory 6@ size 2 value -1 virtual_protect 0 
        
        //  ped->SetModelIndex(newModelID);
        0A8E: 7@ = 3@ + 0x14    //  SetModelIndex   from CEntityVtbl
        0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0  
        0AA6: call_method 7@ struct 0@ num_params 1 pop 0 1@ 
        
        //  ped->m_dwAnimGroup = savedAnimGroup;   
        0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0 
        
        0223: set_actor 0@ health_to 99
    else 
        0247: load_model 1@         //  CStreaming::RequestModel(newModelID, 0x0C);
        038B: load_requested_models //  CStreaming::LoadAllRequestedModels(false);
    end
end
0AB2: cleo_return 0 

Call it like this:

0AB1: cleo_call @ChangePedModel params 2 param1 31@ param2 #SWAT

where 31@ (param1) is a ped handle and MODEL_SWAT is just a showcase.

  • Like 2
Link to comment
Share on other sites

igotnothing
On 3/13/2023 at 8:16 PM, Jack said:
:changePedModel
//  0@ - actorHandle;   1@ - newModelID
0226: 8@ = actor 0@ health  
if 8@ == 100
then
    //  if (CStreaming::ms_aInfoForModel[newModelID].m_nLoadState == LOADSTATE_LOADED) {
    if 0248:   model 1@ available       
    then    
        //  DWORD savedAnimGroup = ped->m_dwAnimGroup;
        0A96: 0@ = actor 0@ struct 
        0A8E: 2@ = 0@ + 0x4D4   //  m_dwAnimGroup from CPed   
        0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0
    
        //  ped->DeleteRwObject();  
        0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0 
        0A8E: 5@ = 3@ + 0x20    //  DeleteRwObject  from CEntityVtbl    
        0A8D: 5@ = read_memory 5@ size 4 virtual_protect 0
        0AA6: call_method 5@ struct 0@ num_params 0 pop 0  
        
        //  ped->m_nModelIndex = -1; 
        0A8E: 6@ = 0@ + 0x22    //  m_nModelIndex from CEntity
        0A8C: write_memory 6@ size 2 value -1 virtual_protect 0 
        
        //  ped->SetModelIndex(newModelID);
        0A8E: 7@ = 3@ + 0x14    //  SetModelIndex   from CEntityVtbl
        0A8D: 7@ = read_memory 7@ size 4 virtual_protect 0  
        0AA6: call_method 7@ struct 0@ num_params 1 pop 0 1@ 
        
        //  ped->m_dwAnimGroup = savedAnimGroup;   
        0A8C: write_memory 2@ size 4 value 4@ virtual_protect 0 
        
        0223: set_actor 0@ health_to 99
    else 
        0247: load_model 1@         //  CStreaming::RequestModel(newModelID, 0x0C);
        038B: load_requested_models //  CStreaming::LoadAllRequestedModels(false);
    end
end
0AB2: cleo_return 0 

Call it like this:

0AB1: cleo_call @ChangePedModel params 2 param1 31@ param2 #SWAT

where 31@ (param1) is a ped handle and MODEL_SWAT is just a showcase.

thank you so much

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.