- Sets the character's animation speed
- 0393: set_actor [char handle] anim_speed [flt]
- 0393: actor [char handle] perform_animation "[string]" at [flt] times_normal_rate
- [char handle]
- The handle of the character
- Speed (default 1.0)
- Animation name
This opcode sets the character's animation speed. It was never called in the original script of GTA III.
For Vice City
This opcode does not exist in Vice City but it is possible to set the speed of a character's animation. The following example, using Sanny Builder with CLEO for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode.
:opcode_0393 // 0@ - input param (character handle) // 1@ - input param (speed) 05E6: 0@ = actor 0@ struct 0@ += 0x4C 05E0: 0@ = read_memory 0@ size 4 virtual_protect 0 // get address of RpClump 05E2: call_method 0x402E20 num_params 1 pop 1 0@ 0@ // RpAnimBlendClumpGetFirstAssociation if not 0@ == 0 then 0@ += 0x24 05DF: write_memory 0@ size 4 value 1@ virtual_protect 0 // set anim speed end 05F6: ret 0
Use this line as a substitute for opcode 0393. This can be placed anywhere within the external script:
05F5: call_scm_func @opcode_0393 inputs 2 char_handle [char handle] speed [flt]
This is disassembled code for this opcode from PC v1.0 US.
loc_44D7BD: mov eax, [esp+208h+var_204] mov ecx, [esp+208h+var_204] ; get address of script for thiscall add eax, 10h ; get address of script's current instruction pointer push 2 ; push 2 for two parameters to collect push eax ; push address of script's current instruction pointer call CRunningScript::CollectParameters ; call CRunningScript::CollectParameters(uint *,short) mov eax, ds:ScriptParams ; get value of first parameter, the ped handle mov ecx, ds:CPools::ms_pPedPool ; get address of ped pool for thiscall push eax ; push ped handle call CPool_CPed_CPlayerPed::GetAt ; call CPool<CPed, CPlayerPed>::GetAt(int) to get address of ped mov eax, [eax+4Ch] ; offset ped address by 0x4C to get address of RpClump push eax ; push address of RpClump call RpAnimBlendClumpGetFirstAssociation ; call RpAnimBlendClumpGetFirstAssociation(RpClump *) test eax, eax ; check whether or not returned address is nonzero pop ecx jz short loc_44D7F8 fld ds:ScriptParams ; get value of second parameter, a floating-point value representing the speed fstp dword ptr [eax+24h] ; offset returned address by 0x24 and set it to the value loc_44D7F8: xor al, al ; return 0
set, character, actor, anim, animation, speed, rate