[THUG2][PC] How to spawn a ped

Tutorial forum for Tony Hawk games.
Forum rules
No requests, use other sections for that. TAG your titles [THAW][THUG2] etc.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

[THUG2][PC] How to spawn a ped

Postby Anteara » 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:

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.
Lezzer
Posts: 48
Joined: Tue Jan 04, 2011 10:50 am
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby Lezzer » Mon Oct 31, 2011 11:09 am

Don't work.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby Anteara » Mon Oct 31, 2011 11:59 am

Lezzer wrote:Don't work.


I wouldn't write a tutorial if it doesn't work. It DOES WORK. FOR THUG2. Hence why it says THUG2 in the title! It does NOT work for THAW. If it worked for THAW I would say so!

WhoElseButMe knows how to make it work in THAW, there was a thread where he explained in detail how to make it work in THAW, so try and find it. If you can't then maybe you can ask WhoElseButMe very nicely to explain it to you...
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby ZurePitchmen83 » Fri Sep 28, 2012 9:59 pm

I'm having problems with this tutorial, when i try to use your tutorial script for a ped spawning menu, the game crashes! :cry: , no matter which level i go to, can you give me a way for this to properly work in a spawning menu, BTW, I'm using THUG2, not THAW
Last edited by ZurePitchmen83 on Sat Sep 29, 2012 10:34 pm, edited 1 time in total.
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby WhoElseButMe » Sat Sep 29, 2012 7:51 pm

This tutorial is for THUG2 NOT THAW perhaps what you're trying to spawn isn't loaded.
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby ZurePitchmen83 » Sat Sep 29, 2012 10:24 pm

WhoElseButMe wrote:This tutorial is for THUG2 NOT THAW perhaps what you're trying to spawn isn't loaded.


I know, but this is my attempt for ped spawning menu in THUG2, i don't see why this doesn't work

Code: Select all

:i function $peds_menu$
   :i call $make_new_themed_scrolling_menu$ arguments
      $title$ = %s(17,"Ped spawner menu")
   :i $SetScreenElementProps$:s{
   :i $id$ = $sub_menu$
   :i $event_handlers$ = :a{:s{call $pad_back$ arguments
      $generic_menu_pad_back$$params$ = :s{$callback$ = $create_zure_menu$:s}:s}
      :i :a}
      :i $replace_handlers$
   :i :s}
   :i call $theme_menu_add_item$ arguments
      $text$ = %s(11,"Bam Margera")$pad_choose_script$ = $anteara_ped12lol$$no_bg$$centered$ = $centered$
   :i call $theme_menu_add_item$ arguments
      $text$ = %s(4,"Done")$pad_choose_script$ = $create_zure_menu$$no_bg$$centered$ = $centered$
   :i $finish_themed_scrolling_menu$
:i endfunction
: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$ = $THPS6_human$
         :i $max_bone_skip_lod$ = %i(0,00000000)
         :i :s}
         :i :s{$component$ = $model$
         :i :s}
         :i :s{$component$ = $AnimBlender$
            :i $AnimName$ = $animload_THPS6_human_unloadable_1$
            :i $SkeletonName$ = $THPS6_human$
         :i :s}
      :i :a}
               :i $params$ = :s{$pos$ = %GLOBAL%$pos$$model$ = %s(47,"Peds\PedPros\PedPro_Margera\PedPro_Margera.skin")$name$ = $Pedestrian$:s}
   :i :s}
   :i $Pedestrian$.call $Obj_PlayAnim$ arguments
      $anim$ = $Ped_M_LookAround$$cycle$
:i endfunction


That code above is my attempt of spawning a ped in a menu, can anyone tell me what i need to do to this this to work :/
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby WhoElseButMe » Sat Sep 29, 2012 10:35 pm

When does it crash, when you open the menu or when you select a menu option?
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby ZurePitchmen83 » Sat Sep 29, 2012 10:37 pm

when i press the button
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby WhoElseButMe » Sat Sep 29, 2012 10:52 pm

Are you creating the object with the same name more than once?
Perhaps check to make sure the object doesnt already exist before creating it

Code: Select all

   :i $Skater$.$Obj_GetPosition$
   :i if call $ObjectExists$ arguments
      $id$ = $Pedestrian$
   :i $Pedestrian$.call $obj_PlayAnim$ arguments
      $anim$ = $Ped_M_LookAround$$cycle$
   :i else
      :i $CreateCompositeObject$:s{
      // and all its construction code go here
   :i endif

An example of this, tested in THAW but the same principles apply, can be found here
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby ZurePitchmen83 » Sat Sep 29, 2012 10:54 pm

Thanks, i'll try that and see if it worked

EDIT:it doesn't work, i tried it this way and it crashed, maybe i did it wrong

Code: Select all

    :i function $anteara_ped12lol$
       :i $Skater$.$Obj_GetPosition$
       :i if call $ObjectExists$ arguments
          $id$ = $Pedestrian$
       :i $Pedestrian$.call $obj_PlayAnim$ arguments
          $anim$ = $Ped_M_LookAround$$cycle$
       :i else
          :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$ = $THPS6_human$
         :i $max_bone_skip_lod$ = %i(0,00000000)
         :i :s}
         :i :s{$component$ = $model$
         :i :s}
         :i :s{$component$ = $AnimBlender$
            :i $AnimName$ = $animload_THPS6_human_unloadable_1$
            :i $SkeletonName$ = $THPS6_human$
         :i :s}
      :i :a}
               :i $params$ = :s{$pos$ = %GLOBAL%$pos$$model$ = %s(47,"Peds\PedPros\PedPro_Margera\PedPro_Margera.skin")$name$ = $Pedestrian$:s}
   :i :s}
   :i endif
   :i $Pedestrian$.call $Obj_PlayAnim$ arguments
    :i endfunction
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009
WhoElseButMe
Posts: 419
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby WhoElseButMe » Sat Sep 29, 2012 11:05 pm

Try this same code on an object you know is loaded like a combo O or something and give it a more unique name like my_combo_o to insure no name clash.
It all looks to be proper but I might be overlooking something and it still leads me to believe the object isn't loading into memory and that's the culprit to your crashing.
Image
WhoElseButMe on Nov 26, 2009 wrote:It's that lack of respect amongst their peers and ignorance towards modding etiquette that keeps us who know this stuff well from spreading it like wild fire. We do still enjoy playing the game and if you need to cheat to play a game PLAY SOMETHING ELSE YOU DON'T SUCK AT.
ZurePitchmen83
Posts: 158
Joined: Mon Jul 30, 2012 9:18 am
Location: USA
Contact:

Re: [THUG2][PC] How to spawn a ped

Postby ZurePitchmen83 » Sun Sep 30, 2012 6:38 am

It works now, i had to mess with the script, but i still have one issue, the anim doesn't play, instead, my ped is T-Posed rather than being animated, i'd like to know how to fix, the code is the same except for one change here

Code: Select all

:i :s{$component$ = $AnimBlender$
:i $AnimName$ = $animload_THPS6_human_unloadable_1$
:i $SkeletonName$ = $THPS6_human$
:i :s}
:i :a}
:i $params$ = :s{$pos$ = %GLOBAL%$pos$$model$ = %s(47,"Peds\PedPros\PedPro_Vallely\PedPro_Vallely.skin")$name$ = $Pedestrian$:s}
:i :s}
:i endif
:i endfunction


i'd like to know how to fix this
THPS4 Level Expansion Pack, THUG2 710 Mod 1.0
Modding and Model ripping since 2009

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 15 guests