Jump to content

Best way of sandboxing spawned NPCs


SAC
 Share

Recommended Posts

Hi

 

I am programmatically spawning various NPCs into the world. If I just spawn them, they stand still / do nothing.

 

This statement works fine

 

TASK::_TASK_USE_NEAREST_SCENARIO_TO_COORD(myPed, vpedloc.x, vpedloc.y, vpedloc.z, 100, -1, true, true, true, true);

 

But I am wondering if there are smarter / more diverse ways of making them sandbox, this feels a little mechanical and repetitive

 

Also, it feels that there are scenarios placed on the map which are either gender or model-specific (?) For example, female spawns will never start carrying timber in the SD Harbor - is that reserved to the a_m_m_sddockworkers_02 model? If so, how to enable it / make it available to a female spawn?

 

I have also tried

 

TASK::TASK_USE_NEAREST_SCENARIO_CHAIN_TO_COORD(playerTarget, vpedloc.x, vpedloc.y, vpedloc.z, 100, true, true, true, true);

 

but it does nothing

 

Any ideas on how to diversify sandboxing?

 

Thx

Edited by SAC

 

My Fallout 4 and Skyrim mods: SAC - LoversLab

 

Link to comment
Share on other sites

I've only done a little testing trying to make peds hang around my camp so I don't know if this helps.

	TASK::TASK_WANDER_IN_AREA(ped, coord.x, coord.y, coord.z, 30.0f, 1077936128, 1086324736, 1);

This made them walk away during the day, but if I called it at around 8-9 pm they started using scenarios around the campfire (warming hands and stuff), then later they laid down to sleep or sat in the tent for the night. Don't know what the parameters are, I assumed the 30.0f is the radius but not use. I haven't tested this in towns at all..

Edited by crossed99
Link to comment
Share on other sites

1 hour ago, crossed99 said:

I've only done a little testing trying to make peds hang around my camp so I don't know if this helps.

	TASK::TASK_WANDER_IN_AREA(ped, coord.x, coord.y, coord.z, 30.0f, 1077936128, 1086324736, 1);

This made them walk away during the day, but if I called it at around 8-9 pm they started using scenarios around the campfire (warming hands and stuff), then later they laid down to sleep or sat in the tent for the night. Don't know what the parameters are, I assumed the 30.0f is the radius but not use. I haven't tested this in towns at all..

 

Looks very promising indeed!!

 

What would 1077936128, 1086324736 be? My natives show them as "any" (as in any guess is as good as mine 🙂 )

 

 

 

My Fallout 4 and Skyrim mods: SAC - LoversLab

 

Link to comment
Share on other sites

2 hours ago, SAC said:

What would 1077936128, 1086324736 be? My natives show them as "any" (as in any guess is as good as mine 🙂 )

No idea, it was in decomplied scripts. It's either those exact values or something like these:

 

TASK::TASK_WANDER_IN_AREA(0, ENTITY::GET_ENTITY_COORDS(&(Local_130[2 /*2*/]), true, false), 2f, 2f, 4f, 0);

TASK::TASK_WANDER_IN_AREA(&(Local_130[iVar0 /*2*/]), func_178(3, 12), 10f, 1f, 3f, 0);

Edited by crossed99
Link to comment
Share on other sites

18 hours ago, crossed99 said:

TASK::TASK_WANDER_IN_AREA(0, ENTITY::GET_ENTITY_COORDS(&(Local_130[2 /*2*/]), true, false), 2f, 2f, 4f, 0);

TASK::TASK_WANDER_IN_AREA(&(Local_130[iVar0 /*2*/]), func_178(3, 12), 10f, 1f, 3f, 0);

 

No idea what  ENTITY::GET_ENTITY_COORDS(&(Local_130[2 /*2*/]) means?

 

Found this in my version of natives.h

 

    // Makes ped walk around the area.
    // 
    // set p1 to 10.0f and p2 to 10 if you want the ped to walk anywhere without a duration.
    NATIVE_INLINE static void TASK_WANDER_STANDARD(Ped ped, float p1, int p2) { invoke<Void>(0xBB9CE077274F6A1B, ped, p1, p2); } // 0xBB9CE077274F6A1B 0xAF59151A b1207

 

 

Seems to work partially, meaning that they walk, but don't perform any activities. Will experiment more

 

My Fallout 4 and Skyrim mods: SAC - LoversLab

 

Link to comment
Share on other sites

ENTITY::GET_ENTITY_COORDS(&(Local_130[2 /*2*/]) just get's the center coordinates of the area they wanted the ped to wander in.

So they're ped, coodrdinates, then 4 unknown:

TASK::TASK_WANDER_IN_AREA(ped, area.x, area.y, area.z, 2f, 2f, 4f, 0);

TASK::TASK_WANDER_IN_AREA(ped, area.x, area.y, area.z, 10f, 1f, 3f, 0);

 

 

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...