Coding

 Reply to this postStart new topic

spawn an actor

badboy
post Sep 15 2012, 07:31 PM
Post #1


Trained Member

Posts: 76
From: Nederland, NL
Joined: 1-May 12



I want to spawn a char (actor) trough asm, but I don't know where to start. What functions are necessary?
I've looked at how the opcode spawns an actor and I think that I need these:

CODE
_PedPool__allocate

AFAIK this one makes space, and stores some value in the eax register

CODE
CCivilianPed__constructor

eax from the previous function and 2 other parameters are pushed before using this one. I guess that this one creates the code for the ped. Returns 3 values that I do not know (pointer/handle?).

CODE
??2CTask@@YAPAXI@Z

Do I really need this one, and what is the point of this function (seems to change some registers for the next code)?

CODE
CPedTasks__?assignPrimaryTask

Which numbers do I have to enter here?

CODE
CWorld__findGroundZForCoord // or direct
?setPosition@CPlaceable@@QAEPAURwV3D@@PAU2@@Z
CPlaceable__setRotation
CWorld__add

Makes sense, but I still don't know the handle of the ped.

Help would be appreciated teehee.gif
Go to the top of the page
 
+Quote Post
Deji
post Sep 15 2012, 07:57 PM
Post #2


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



'_PedPool__allocate' would be the function which allocates a pool for peds.
'??2CTask@@YAPAXI@Z' ("void * __cdecl CTask::operator new(unsigned int)") allocates n bytes of space for a ped task.

What kind of things do you want to do with the ped? And why can't it be done via script? It's important to realise that what was made possible for the script is not possible outside a script, without setting up all your own functions to do so.

CPopulation::AddPed (0x612710) should be enough to add a basic ped. However, you should also increment the ped counter at 0xC0EC24.

But then to control the ped adds a lot of more requirements. For this in VJ, I had set up many different game classes and ASM function bridges, so I could call class functions on the objects.


--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: