[THUG2][PC] How to spawn a ped
Posted: Sun Aug 07, 2011 4:28 am
I've decided to make a tutorial of this just so people who want to do it don't have to go back to that thread.
This tutorial shows you how to spawn a ped as a composite object.
For the anim you want to play, go to the allanims.qb file.
Find an anim you want, for example I want $Ped_Bikini_LyingFrontToBack$.
When you have the anim you want, go up, and find the function name. The function $Ped_Bikini_LyingFrontToBack$ is in is called:
take note of the function name and checksum.
Go back to your composite object script,
The skeleton name must be $Ped_Female$, or else the anim won't play. This is because the ReferenceChecksum is called Ped_Female.
Here, again, the skeleton name is $Ped_Female$. The AnimName is $animload_Ped_Bikini$ because that is the function name.
So this is how you spawn a ped, I already created the function for you, so all you have to do is find an anim you want, put the function name of the anim you want in $AnimName$, and put the ReferenceChecksum in the $SkeletonName$.
Now you need to play the anim, you already have the $SkeletonName$, and $AnimName$ set up, so now you need to set up the anim itself.
This is the model of your ped, you can choose anything, but it must be a "Full" ped, as shown in the name. It also must be .skin.
This is the anim. Remember at the start, in the allanims file, I chose $Ped_Bikini_LyingFrontToBack$. You can look for any anim you want in the allanims file, just remember to go back up to the function its in, get the function name and reference Checksum.
This tutorial shows you how to spawn a ped as a composite object.
For the anim you want to play, go to the allanims.qb file.
Find an anim you want, for example I want $Ped_Bikini_LyingFrontToBack$.
When you have the anim you want, go up, and find the function name. The function $Ped_Bikini_LyingFrontToBack$ is in is called:
Code: Select all
:i function call $animload_Ped_Bikini$ arguments
$LoadFunction$ = $LoadAnim$
:i call $SetReferenceChecksum$ arguments
$Ped_Female$
take note of the function name and checksum.
Go back to your composite object script,
Code: Select all
:i function $anteara_ped12lol$
:i $Skater$.$Obj_GetPosition$
:i $CreateCompositeObject$:s{
:i $Components$ =
:i :a{
:i :s{$component$ = $motion$:s}
:i :s{$component$ = call $Suspend$ arguments
$NeverSuspend$:s}
:i :s{$component$ = $skeleton$
:i $SkeletonName$ = $Ped_Female$
:i $max_bone_skip_lod$ = %i(0,00000000)
:i :s}
:i :s{$component$ = $model$
:i :s}
:i :s{$component$ = $AnimBlender$
:i $AnimName$ = $animload_Ped_Bikini$
:i $SkeletonName$ = $Ped_Female$
:i :s}
:i :a}
:i $params$ = :s{$pos$ = %GLOBAL%$pos$$model$ = %s(43,"Peds\Ped_FemaleFull01\Ped_FemaleFull01.skin")$name$ = $Pedestrian$:s}
:i :s}
:i $Pedestrian$.call $Obj_PlayAnim$ arguments
$anim$ = $Ped_Bikini_LyingFrontToBack$$cycle$
:i endfunction
Code: Select all
:i :s{$component$ = $skeleton$
:i $SkeletonName$ = $Ped_Female$
:i $max_bone_skip_lod$ = %i(0,00000000)
:i :s}
The skeleton name must be $Ped_Female$, or else the anim won't play. This is because the ReferenceChecksum is called Ped_Female.
Code: Select all
:i :s{$component$ = $AnimBlender$
:i $AnimName$ = $animload_Ped_Bikini$
:i $SkeletonName$ = $Ped_Female$
:i :s}
Here, again, the skeleton name is $Ped_Female$. The AnimName is $animload_Ped_Bikini$ because that is the function name.
Code: Select all
:i function call $animload_Ped_Bikini$ arguments
So this is how you spawn a ped, I already created the function for you, so all you have to do is find an anim you want, put the function name of the anim you want in $AnimName$, and put the ReferenceChecksum in the $SkeletonName$.
Now you need to play the anim, you already have the $SkeletonName$, and $AnimName$ set up, so now you need to set up the anim itself.
Code: Select all
:i $params$ = :s{$pos$ = %GLOBAL%$pos$$model$ = %s(43,"Peds\Ped_FemaleFull01\Ped_FemaleFull01.skin")$name$ = $Pedestrian$:s}
:i :s}
:i $Pedestrian$.call $Obj_PlayAnim$ arguments
$anim$ = $Ped_Bikini_LyingFrontToBack$$cycle$
:i endfunction
Code: Select all
$model$ = %s(43,"Peds\Ped_FemaleFull01\Ped_FemaleFull01.skin")
This is the model of your ped, you can choose anything, but it must be a "Full" ped, as shown in the name. It also must be .skin.
Code: Select all
:i $Pedestrian$.call $Obj_PlayAnim$ arguments
$anim$ = $Ped_Bikini_LyingFrontToBack$$cycle$
This is the anim. Remember at the start, in the allanims file, I chose $Ped_Bikini_LyingFrontToBack$. You can look for any anim you want in the allanims file, just remember to go back up to the function its in, get the function name and reference Checksum.