Page 1 of 1

[THUG2][PC] How to make an animation Menu

Posted: Fri Jan 28, 2011 2:10 pm
by Anteara
In this tutorial I will show you how to create an animation menu.

Things needed:
  • QB Decompiler/Compiler
  • Your own menu

The way this tutorial works:
  • The functions will be displayed in quotes (because I can't use color in code)
  • Parts of each function will be color coded, underneath the function will show you what each color means

The reason I am color coding things is so people will learn what each part of the function does.




For this tutorial, we will use a scrolling menu, that way we can put as many animations on a single menu as we want.

1) How to make a scrolling menu

:i function $anims_menu$
:i call $make_new_themed_scrolling_menu$ arguments
$title$ = %s(14,"Animation 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_anteara_menu$:s}:s}

:i :a}
:i $replace_handlers$
:i :s}
:i call $theme_menu_add_item$ arguments
$text$ = %s(7,"Blocker")
$pad_choose_script$ = $Anim_01$$no_bg$$centered$ = $centered$
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$pad_choose_script$ = $create_anteara_menu$$no_bg$$centered$ = $centered$
:i $finish_themed_scrolling_menu$
:i endfunction


#The type of menu we will be making
#The title of the menu
#The pad back script (When you press escape or backspace)
#The menu item
#The function that the menu item calls

2) Now that we have a menu, we haveto make the function that the menu item will call.

:i function $Anim_01$
:i $exit_pause_menu$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $Ped_Blocker_BlockA_idle$$cycle$$NoRestart$

:i endfunction


#The function name
#When the function is called, this will exit the pause menu
#Self explanatory
#This is the anim that is being called

We now have a scrolling menu with a menu item that when used exits the pause menu, and tells the skater to play an anim. It's also possible to link anims.

3) How to link an anim

:i function $anteara_starwars$
:i $exit_pause_menu$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $PED_Starwarskid_clip01$
:i $Skater$.$WaitAnimFinished$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $PED_Starwarskid_clip02$
:i $Skater$.$WaitAnimFinished$
:i endfunction


#This tells the function to wait for the first anim to finish, and when it is finished, it will then play the next anim.

We now have a function with two anims linked together.

Unfortunately, at this time, I will not tell you how to make these anims work online, the reason i am not going to tell you this is because if you use an anim online that another player doesn't have preloaded, you will cause the other player to crash, and in many cases, you will crash the entire server.

You still may use these anims in story mode, etc, you just haveto locate where each anim is loaded. When using anims be sure to be off your board, the anims don't work if you're on your board.

Also, some of this code is sloppy, but it does work well nonetheless.

Re: [THUG2][PC] How to make an animation Menu

Posted: Sat Oct 08, 2011 4:33 am
by PunKā„¢95
That can come in handy in my menu mod> tnx bro. :clap:

Re: [THUG2][PC] How to make an animation Menu

Posted: Fri Oct 12, 2012 11:40 pm
by ZurePitchmen83
This worked for me, but i can't add another animation to a menu, when i try to, the game freezes :( , how can i put more than 1 animation to a menu properly?

Re: [THUG2][PC] How to make an animation Menu

Posted: Sat Oct 13, 2012 2:51 am
by WhoElseButMe
Need more details about your code

Re: [THUG2][PC] How to make an animation Menu

Posted: Tue Oct 16, 2012 4:48 am
by ZurePitchmen83
It's similar to the one in the tut, but this is my attempt

Code: Select all

:i function $anims_menu$
:i call $make_new_themed_scrolling_menu$ arguments
$title$ = %s(14,"Animation 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_anteara_menu$:s}:s}
:i :a}
:i $replace_handlers$
:i :s}
:i call $theme_menu_add_item$ arguments
$text$ = %s(7,"Blocker")$pad_choose_script$ = $Anim_01$$no_bg$$centered$ = $centered$
:i call $theme_menu_add_item$ arguments
$text$ = %s(5,"Panic")$pad_choose_script$ = $Anim_02$$no_bg$$centered$ = $centered$
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$pad_choose_script$ = $create_anteara_menu$$no_bg$$centered$ = $centered$
:i $finish_themed_scrolling_menu$
:i endfunction
:i function $Anim_01$
:i $exit_pause_menu$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $Ped_Blocker_BlockA_idle$$cycle$$NoRestart$
:i endfunction
:i function $Anim_02$
:i $exit_pause_menu$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $Ped_GermanCop_Panic$$cycle$$NoRestart$
:i endfunction
:i function $anteara_starwars$
:i $exit_pause_menu$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $PED_Starwarskid_clip01$
:i $Skater$.$WaitAnimFinished$
:i $Skater$.call $PlayAnim$ arguments
$Anim$ = $PED_Starwarskid_clip02$
:i $Skater$.$WaitAnimFinished$
:i endfunction

I tried the level that was specific to the anim (Berlin) and yet it doesn't work, it just freezes, no matter which level i play in, why? :help