Jump to content

Spawning a Pedestrian


Recommended Posts

I'm currently looking into spawning pedestrians in my GTA and was wondering if anyone could point me to some useful opcodes/memory values that could help me with this, i've already looked at the CPed memory structure, but can't figure out how to make a ped spawn simply by manipulating memory values.

 

Also is there a tutorial on memory manipulation for GTA in C++ around here that i could use to better acquaint myself with the procedures?

Link to comment
https://gtaforums.com/topic/268785-spawning-a-pedestrian/
Share on other sites

I'm currently looking into spawning pedestrians in my GTA and was wondering if anyone could point me to some useful opcodes/memory values that could help me with this, i've already looked at the CPed memory structure, but can't figure out how to make a ped spawn simply by manipulating memory values.

 

Also is there a tutorial on memory manipulation for GTA in C++ around here that i could use to better acquaint myself with the procedures?

Look for the SCM Hook source code. Almost everything in the game such as mission and sub mission are stored in the scm. So what this SCM Hook does is just runs SCM commandes (Opcodes) from a compiled C++ DLL.... Allowing you to spawn what ever.. Good Luck. biggrin.gif

Link to comment
https://gtaforums.com/topic/268785-spawning-a-pedestrian/#findComment-4082729
Share on other sites

 

Is there any way to perform this without the program being a DLL? Or just through memory manipulation?

Not unless you are some kind of evil genius.

 

There are two ways of achieving this. First and most popular way is to amend the SCM script file so that a ped can be spawned on a keypress (or some other trigger of your choosing). Second is to use a dll to do the same. A third possibly is a Loader, which would start up the game and then write to memory as required. See the SA Script injector by op9080.

 

Which ever way you go its going to take some work on your part, even if you only take someone else's code and compile it.

 

 

Edited by Cowpat
Link to comment
https://gtaforums.com/topic/268785-spawning-a-pedestrian/#findComment-4083709
Share on other sites

Cheers thanks, i got a ped to spawn using some opcodes but now i have a more complex question, if i needed to obtain the $actorID by looking at the CPlayer/CPed mem structure how would i do that? At the moment i want to manipulate some actors on my screen and i dont know what there actorID is

 

If memory address's won't give me the actorid could i compare some positions? If i am executing an opcode from a DLL how can i get the players position from that?

Edited by Sacky
Link to comment
https://gtaforums.com/topic/268785-spawning-a-pedestrian/#findComment-4085644
Share on other sites

Retrieving the Player's position has been posted in the SA Memory topic by Stretchnutter. You do it with pointers rather than opcodes.

 

Obtaining a ped or vehicle ID is a different kettle of fish breadfish_by_Moto.gif

 

You can retrieve random ped and car IDs using opcodes, but they are just that - random. To my knowledge a sequential list or table of IDs has yet to found in memory. And neither are the IDs to be found in the ped or car structures AFAIK.

 

Have a look at the work by ceedj.

Link to comment
https://gtaforums.com/topic/268785-spawning-a-pedestrian/#findComment-4091015
Share on other sites

Thanks for your reply cowpat.

 

Lets say all i wanted to do was change the intelligence settings of a pedestrian in the game how would i go about doing that? I saw these opcodes that interested me:

 

 

009c 2  set_wander_path -/- no P: $actorID, int (pathID)

- gives the actor a path to walk along

009e 6  set_ped_path -/- no P: $actorID, X, Y, Z, float (1.0?), int (1?)

009f 1  set_ped_objective -/- no P: $actorID

- makes actor act like ped (?)

011a 2  set_actor_flags -/- no P: $actorID, int

- tells the actor to behave differently

0=do nothing

1=walk around

2=shoot at people

5=without weapon they run, with weapon they attack you

6=shoot at actors not player

7=shoot at actor and walk away

8=shoot at actor but dont go away

16=go mad (attack anyone, pull people out of car...)

- found @ gtaforums.com posted by "Muggers"

0192 1  set_actor_to_stand_still -/- no -/-

0193 1  set_actor_to_act_like_ped -/- no -/-

0194 4  set_actor_to_go_to_point -/- no -/-

01c9 2  set_actor_to_kill_actor1 -/- no -/-

01ca 2  set_actor_to_kill_player1 -/- no -/-

01cb 2  set_actor_to_kill_actor2 -/- no -/-

01cc 2  set_actor_to_kill_player2 -/- no P: $actorID, $player_char

- actor tries to kill the player

01ce 2  set_actor_to_avoid_player1 -/- no -/-

01d0 2  set_actor_to_avoid_player2 -/- no -/-

01d1 2  set_actor_to_follow_actor -/- no -/-

01d2 2  set_actor_to_follow_player -/- no -/-

01de 2  tie_actor_to_actor -/- no P: $actorID1, $actorID2

- makes actor1 follow actor2 (not sure)

01df 2  tie_actor_to_player -/- no P: $actorID, $player_char

- makes the actor follow the player

01e1 3  set_actor_follow_route -/- no P: $actorID, int (route), ?

- makes actor follow given route

 

However the obvious problem with this is i can't find the $actorID parameter to go into it, so i was wandering if there was any way to just manipulate the intelligence settings or set a normal actor to have AI? I saw these memory address's in GTAModding and wandering if they'd be of any assistance, and if so how?

 

 

00550B00

    CPool_CPatrolRoute_CPatrolRoute::CPool_CPatrolRoute_CPatrolRoute((int))

00550E40

    CPool_CPedAttractors_CPedAttractors::CPool_CPedAttractors_CPedAttractors((int))

00550D70

    CPool_CPedIntelligence_CPedIntelligence::CPool_CPedIntelligence_CPedIntelligence((int))

005503F0

    CPool_CPed_CPlayerPed::CPool_CPed_CPlayerPed((int))

00550A30

    CPool_CPointRoute_CPointRoute::CPool_CPointRoute_CPointRoute((int))

00550250

    CPool_CPtrNodeDouble_CPtrNodeDouble::CPool_CPtrNodeDouble_CPtrNodeDouble((int))

00550180

    CPool_CPtrNodeSingle_CPtrNodeSingle::CPool_CPtrNodeSingle_CPtrNodeSingle((int))

00550CA0

    CPool_CTaskAllocator_CTaskAllocator::CPool_CTaskAllocator_CTaskAllocator((int))

00550890

    CPool_CTask_CTask::CPool_CTask_CTask((int))

 

if they are what im looking for could someone give me an example of how i use them by getting the actor pointer of an actor (because i can do this)?

Link to comment
https://gtaforums.com/topic/268785-spawning-a-pedestrian/#findComment-4097584
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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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