GTAG - Modding - San Andreas - Peds
Peds
Ped models can be used to create actors via opcodes 009A, 0129, 01C8, 02F2, 0503 and 0621. Additionally, opcodes 0376 and 0560 can create a random actor, whose model and pedtype is chosen in accordance to the currently loaded models, the current weather and in certain cases, the active external script.
Ped types are used in creation of the actors and define actor behaviours, however in certain cases they have a heavy effect over the actor model. For example, when creating an actor with the pedtype 'COP', the model specified will be ignored and instead, a cop will be created automatically based on the current towns cop model.
Memory Structure
The memory structure of CPed is 0x7C4 bytes in size. There are a total of 140 ped objects allowed in the pool.
- Base Info
- Base: 0xB7CD98 (pointer to player CPed, which is the start of the ped pool)
- Size: 0x7C4
- Num: 0x8C
- Offsets
- +0x14: Pointer to CMatrix
- +0x0 - 0x2C [float]: Rotation Matrix
- +0x30 [float]: X Coord
- +0x34 [float]: Y Coord
- +0x38 [float]: Z Coord
- +0x1C: Binary Flags [dword]:
- +Bit 1 [bit]: Collision Detection
- +0x22 [word]: Model ID
- +0x2F [byte]: Current Interior
- +0x36 [byte]: Object Type
- CPhysical
- +0x40: Immunity Binary Flags [dword]:
- +1 [bit]: Gravity
- +2 [bit]: Collision Detection
- +4 [bit]: Rotation Limit? (disable to allow extra spin velocities)
- +5 [bit]: Disables position changes
- +6 [bit]: Gravity?
- +7 [bit]: Disables high jumps
- +13 [bit]: Disables position changes?
- +16 [bit]: Unknown - allows walking up steep ground with ease
- +18 [bit]: Bulletproof
- +19 [bit]: Fireproof
- +20 [bit]: Collision-proof
- +21 [bit]: Melee-proof
- +22 [bit]: Immune to non-player
- +23 [bit]: Explosion-proof
- +29 [bit]: Is Lit?
- Physics
- +0x44 [float]: X Velocity
- +0x48 [float]: Y Velocity
- +0x4C [float]: Z Velocity
- +0x50 [float]: X Angle Velocity
- +0x54 [float]: Y Angle Velocity
- +0x58 [float]: Z Angle Velocity
- +0x5C [float]: X Acceleration
- +0x60 [float]: Y Acceleration
- +0x64 [float]: Z Acceleration
- +0x68 [float]: X Acceleration
- +0x6C [float]: Y Acceleration
- +0x70 [float]: Z Acceleration
- +0x8C [float]: Mass (lowering it enables the ped to jump higher)
- +0x98 [float]: Air Resistance
- +0x9C [float]: Air Resistance
- +0xE0 [float]: X Velocity of last collision?
- +0xE4 [float]: Y Velocity of last collision?
- +0xE8 [float]: Z Velocity of last collision?
- +0xEC [float]: X Position of last collision?
- +0xF0 [float]: Y Position of last collision?
- +0xF4 [float]: Z Position of last collision?
- +0x12C [float]: Brightness (how much light is on the ped)
- +0x130 [float]: Brightness Multiplier?
- +0x40: Immunity Binary Flags [dword]:
- +0x172 [float]: Unknown (Swim Audio?)
- +0x294 [sizeof = 0x100]: CPedSound
- +0x4 [dword]: Pointer to CPed
- +0x8 [byte]: Unknown - Is Voice Enabled?
- +0x92 [word]: Voice Type
- +0x96 [word]: Voice ID
- +0x98 [byte]: Voice Gender (0 = Male - 1 = Female)
- +0x99 [byte]: Unknown - Enable Vocal Type?
- +0x9A [byte]: Unknown - Voice Muted Flag?
- +0x9B [byte]: Unknown - Vocal Enable Flag?
- +0xAC [float]: Voice Volume
- +0xB0 [float]: Voice Volume
- +0x438 [dword]: Pointer to this CPed
- +0x46C: Ped State Binary Flags [dword]:
- +1 [bit]: On ground
- +2 [bit]: Was on ground?
- +3 [bit]: Head rotated to look at something
- +4 [bit]: Head returning to look forward
- +5 [bit]: Is Aiming
- +6 [bit]: Is Holstering Gun
- +7 [bit]: Can ped aim?
- +8 [bit]: Is Talking
- +9 [bit]: In car
- +10 [bit]: In air
- +11 [bit]: Landing jump
- +12 [bit]: Has collided
- +13 [bit]: Near car
- +14 [bit]: Ped visible in car
- +15 [bit]: Update anim heading?
- +16 [bit]: Remove head?
- +17 [bit]: Is firing weapon
- +18 [bit]: Has camera?
- +19 [bit]: Is bleeding
- +20 [bit]: Attack with weapons (peds victim is too far away for melee attacks)
- +21 [bit]: Is dying anim playing?
- +22 [bit]: Stay put
- +23 [bit]: Don't chase victim?
- +24 [bit]: Is wanted
- +25 [bit]: Crouch disabled
- +26 [bit]: Crouch to shoot
- +27 [bit]: Is crouched?
- +28 [bit]: Is ped getting up
- +29 [bit]: Next footprint bloody
- +30 [bit]: Not jackable
- +31 [bit]: Still on valid poly?
- +32 [bit]: Can be healed by medic
- +0x470: Ped State Binary Flags [dword]:
- +1 [bit]: Reset walk anims
- +2 [bit]: Is on boat
- +3 [bit]: Bus was jacked
- +4 [bit]: Invisibility - The ped will fade to the new state (no effect on weapons/objects)
- +5 [bit]: Knocked into air by collision
- +6 [bit]: On steep slope
- +7 [bit]: Cull at far distance only?
- +8 [bit]: Is swimming to shore
- +9 [bit]: Collided with vehicle
- +10 [bit]: Rich from mugging?
- +11 [bit]: Is Chris' police mission criminal?
- +12 [bit]: Shake fist
- +13 [bit]: Immune to headshots
- +14 [bit]: Ped has been recorded for replay?
- +15 [bit]: Update matrices
- +16 [bit]: Flee when standing?
- +17 [bit]: Miami Vice cop
- +18 [bit]: Ped has money given by script
- +19 [bit]: Ped has been photographed
- +20 [bit]: Is drowning
- +21 [bit]: Drowns in water
- +22 [bit]: Head stuck in collision
- +23 [bit]: Dead ped in front of peds car?
- +24 [bit]: Stay in jacked car (get 'kidnapped')
- +25 [bit]: Don't fight
- +26 [bit]: Doom aim?
- +27 [bit]: Vunerable to shots in vehicle
- +28 [bit]: Is being pushed by car
- +29 [bit]: Ped is untargettable
- +30 [bit]: This ped has target priority
- +31 [bit]: Crouch when scared
- +32 [bit]: Was knocked off bike
- +0x474: Ped State Binary Flags [dword]:
- +1 [bit]: Done position from collision?
- +2 [bit]: Invisibility (also takes effect on attached items/weapons)
- +3 [bit]: Added to population?
- +4 [bit]: Just exited car
- +5 [bit]: Is disguised
- +6 [bit]: Ignore player group commands
- +7 [bit]: Is being arrested
- +8 [bit]: Has sought cover?
- +9 [bit]: Was stealth killed
- +10 [bit]: Don't drop weapons when dead
- +11 [bit]: Called pre render?
- +12 [bit]: Blood puddle created from ped
- +13 [bit]: Is part of gang attack wave
- +14 [bit]: Remove marker on ped when dead
- +15 [bit]: Never leave group
- +16 [bit]: Test for blocked positions
- +17 [bit]: Right arm blocked
- +18 [bit]: Left arm blocked
- +19 [bit]: Right arm blocked in crouch
- +20 [bit]: Midriff blocked for jump?
- +21 [bit]: Fallen down
- +22 [bit]: Use attractor instantly?
- +23 [bit]: Don't rotate head?
- +24 [bit]: Brain is scripted?
- +25 [bit]: Waiting for script brain to load
- +26 [bit]: Has group drive task
- +27 [bit]: Can enter/exit car
- +28 [bit]: Can't be knocked off bike
- +29 [bit]: Has been rendered
- +30 [bit]: Is cached
- +31 [bit]: Push other peds
- +32 [bit]: Has armour
- +0x47C [dword]: Pointer to CPedIntellegence
- +0x480 [dword]: Pointer to PlayerData
- +0x484 [dword]: Creation Type (1 = Normal, 2 = SCM)
- +0x4D4 [dword]: Anim Group ID (walk style)
- +0x534 [dword]: Movement Status (1 = on foot, 4 = starting to move, 6 = walking/running, 7 = sprinting)
- +0x540 [float]: Health
- +0x544 [float]: Max Health
- +0x548 [float]: Armour
- +0x558 [float]: Current Z Rotation
- +0x55C [float]: Target Z Rotation
- +0x560 [float]: Z Rotation Speed
- +0x58C [dword]: Current Vehicle Pointer
- +0x598 [dword]: Pedtype
- +0x59C [dword]: Pointer to ped.dat info
- +0x5A0 [sizeof = 0x1C * 13]: CWeaponSlot Array
- +0x0 [dword]: Type
- +0x4 [dword]: State (0 none, 1 firing, 2 reloading)
- +0x8 [dword]: Ammo in clip
- +0xC [dword]: Total ammo
- +0x10 [dword]: Unknown Timer
- +0x14 [byte]: Unknown
- +0x15 [byte]: Unknown
- +0x16 [byte]: Unknown
- +0x17 [byte]: Unknown
- +0x18 [dword]: Particle pointer
- +0x718 [byte]: Current weapon slot
- +0x72C [byte]: Weapon accuracy
- +0x72D [byte]: Fight style
- +0x72E [byte]: Allowed attack moves
- +0x730 [dword]: Pointer to fire entity of ped
- +0x740 [dword]: Current weapon ID
- +0x760 [dword]: Weapon that killed ped
- +0x764 [dword]: Pointer to ped that murdered this ped
- +0x79C [dword]: Pointer to targetted entity
- +0x14: Pointer to CMatrix

