[THUG2][PC]Creating your own physics menu

Tutorials for all THUG+ games goes here.
Forum rules
This forum is only for posting tutorials.
Specify what game it is for, and please take a look at this Template.
Post Reply
ProHad
VIP
Posts: 45
Joined: Wed Mar 03, 2010 10:10 pm

[THUG2][PC]Creating your own physics menu

Post by ProHad » Wed Mar 17, 2010 6:58 pm

Credit to Roq:
How to create your own physic menu


what You'll need :

Blub's compiler

Code: Select all

THUG2 Scripts: gamemenu.qb, displayoptions.qb
In this tutorial i'll show you how to create your own menu using Blub's QB compiler.

First of all we decompile the gamemenu.qb : qbe -d gamemenu.qb > gamemenu.txt

You'll get two files : gamemenu.txt and gamemenu.qb_table.qbi.
then displayoptions.qb

Gamemenu.txt is the decompiled qb, game...qbi is the table of the qb where all the id's used are defined.

So let's open gamemenu.txt and scroll down till we see :i endfunction, as you can take from the name this is the end of a function, so here we can add the new menu.

Here's are short takeout of such a place f.e.:

Code: Select all

:i endif
:i endfunction
:i function $menu_confirm_quit_park_editor$:s{
:i $yes_script$ = $launch_park_editor_save_park_sequence$


what we do is:

Code: Select all

:i endif
:i endfunction
ADD OUR STUFF HERE
:i function $menu_confirm_quit_park_editor$:s{
:i $yes_script$ = $launch_park_editor_save_park_sequence$

But before this we will write our menu, in order for our physic menu we will use the one from displayoptions, the easyiest way is just copy and paste wink.gif

Code: Select all

:i function $create_display_options_menu$
:i call $make_new_themed_sub_menu$ arguments
$title$ = %s(15,"DISPLAY OPTIONS")
:i $create_helper_text$:s{$helper_text_elements$ = :a{:s{$text$ = %s(16,"\b7/\b4 = Select"):s}
:i :s{$text$ = %s(10,"\bn = Back"):s}
:i :s{$text$ = %s(12,"\bm = Accept"):s}
:i :a}
:i :s}
:i $SetScreenElementProps$:s{$id$ = $sub_menu$
:i $event_handlers$ = :a{
:i :s{call $pad_back$ arguments
$generic_menu_pad_back$$params$ = :s{$callback$ = $display_options_exit$:s}:s}
:i :a}
:i :s}
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_HUD$
:i $hud_text$ = %s(3,"Off")
:i else
:i $hud_text$ = %s(2,"On")
:i endif
:i $theme_menu_add_item$:s{$text$ = %s(20,"Score/Special Meter:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_hud$
:i $pad_choose_script$ = $toggle_display_hud$
:i :s}
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_TRICKSTRING$
:i $hud_text$ = %s(3,"Off")
:i else
:i $hud_text$ = %s(2,"On")
:i endif
:i $theme_menu_add_item$:s{$text$ = %s(13,"Trick String:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_trickstring$
:i $pad_choose_script$ = $toggle_display_trickstring$
:i :s}
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_BASESCORE$
:i $hud_text$ = %s(3,"Off")
:i else
:i $hud_text$ = %s(2,"On")
:i endif
:i $theme_menu_add_item$:s{$text$ = %s(11,"Base Score:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_basescore$
:i $pad_choose_script$ = $toggle_display_basescore$
:i :s}
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_CHATWINDOW$
:i $hud_text$ = %s(3,"Off")
:i else
:i $hud_text$ = %s(2,"On")
:i endif
:i $theme_menu_add_flag_item$:s{$text$ = %s(14,"Tantrum Meter:")
:i $id$ = $tantrum_text$
:i $flag$ = $TANTRUM_OFF$
:i $reverse$
:i :s}
:i if $InNetGame$
:i $theme_menu_add_item$:s{$text$ = %s(12,"Chat Window:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_chatwindow$
:i $pad_choose_script$ = $toggle_display_chatwindow$
:i :s}
:i else
:i $theme_menu_add_item$:s{$text$ = %s(15,"Console Window:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_chatwindow$
:i $pad_choose_script$ = $toggle_display_chatwindow$
:i :s}
:i endif
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_BALANCE$
:i $hud_text$ = %s(3,"Off")
:i else
:i $hud_text$ = %s(2,"On")
:i endif
:i if $InNetGame$
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_G_DISPLAY_BALANCE$
:i $theme_menu_add_item$:s{$text$ = %s(15,"Balance Meters:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_balance$
:i $pad_choose_script$ = $toggle_display_balance$
:i $not_focusable$ = $not_focusable$
:i :s}
:i else
:i $theme_menu_add_item$:s{$text$ = %s(15,"Balance Meters:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_balance$
:i $pad_choose_script$ = $toggle_display_balance$
:i :s}
:i endif
:i else
:i $theme_menu_add_item$:s{$text$ = %s(15,"Balance Meters:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_balance$
:i $pad_choose_script$ = $toggle_display_balance$
:i :s}
:i endif
:i if NOT $InNetGame$
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_CUTSCENE_SUBTITLES$
:i %GLOBAL%$hud_text$ = %s(3,"Off")
:i else
:i %GLOBAL%$hud_text$ = %s(2,"On")
:i endif
:i $theme_menu_add_item$:s{
:i $text$ = %s(19,"Cutscene Subtitles:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_cutscene_subtitles$
:i $pad_choose_script$ = $toggle_cutscene_subtitles$
:i :s}
:i endif
:i if $InNetGame$
:i if call $GetGlobalFlag$ arguments
$flag$ = $NO_DISPLAY_NET_SCORES$
:i $hud_text$ = %s(3,"Off")
:i else
:i $hud_text$ = %s(2,"On")
:i endif
:i $theme_menu_add_item$:s{$text$ = %s(17,"Names and Scores:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_net_scores$
:i $pad_choose_script$ = $toggle_display_net_scores$
:i :s}
:i endif
:i if call $GotParam$ arguments
$from_options$
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$id$ = $menu_done$$pad_choose_script$ = $display_options_exit$$pad_choose_params$ = :s{$from_options$:s}$last_menu_item$ = %i(1,00000001)
:i else
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$id$ = $menu_done$$pad_choose_script$ = $display_options_exit$$last_menu_item$ = %i(1,00000001)
:i endif
:i $finish_themed_sub_menu$
:i endfunction
Now we have to short it up, its very big now smile.gif so we only have 1 option left without on/off, there will be another tut with on/off of course.

Code: Select all

:i function $create_display_options_menu$
:i call $make_new_themed_sub_menu$ arguments
$title$ = %s(15,"DISPLAY OPTIONS")
:i $create_helper_text$:s{$helper_text_elements$ = :a{:s{$text$ = %s(16,"\b7/\b4 = Select"):s}
:i :s{$text$ = %s(10,"\bn = Back"):s}
:i :s{$text$ = %s(12,"\bm = Accept"):s}
:i :a}
:i :s}
:i $SetScreenElementProps$:s{$id$ = $sub_menu$
:i $event_handlers$ = :a{
:i :s{call $pad_back$ arguments
$generic_menu_pad_back$$params$ = :s{$callback$ = $display_options_exit$:s}:s}
:i :a}
:i :s}
:i $theme_menu_add_item$:s{$text$ = %s(20,"Score/Special Meter:")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_display_hud$
:i $pad_choose_script$ = $toggle_display_hud$
:i :s}
:i if call $GotParam$ arguments
$from_options$
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$id$ = $menu_done$$pad_choose_script$ = $display_options_exit$$pad_choose_params$ = :s{$from_options$:s}$last_menu_item$ = %i(1,00000001)
:i else
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$id$ = $menu_done$$pad_choose_script$ = $display_options_exit$$last_menu_item$ = %i(1,00000001)
:i endif
:i $finish_themed_sub_menu$
:i endfunction
in order to use anything from this we must have edit this, because any id is used in displayoptions.qb

here is some idea for take it

Code: Select all

:i function $create_roq_menu$
:i call $make_new_themed_sub_menu$ arguments
$title$ = %s(8,"RoQ Menu")
:i $create_helper_text$:s{$helper_text_elements$ = :a{:s{$text$ = %s(16,"\b7/\b4 = Select"):s}
:i :s{$text$ = %s(10,"\bn = Back"):s}
:i :s{$text$ = %s(12,"\bm = Accept"):s}
:i :a}
:i :s}
:i $SetScreenElementProps$:s{$id$ = $sub_menu$
:i $event_handlers$ = :a{
:i :s{call $pad_back$ arguments
$generic_menu_pad_back$$params$ = :s{$callback$ = $display_options_exit$:s}:s}
:i :a}
:i :s}
:i $theme_menu_add_item$:s{$text$ = %s(11,"WallShuffle")
:i $extra_text$ = %GLOBAL%$hud_text$
:i $id$ = $menu_roq_ws$
:i $pad_choose_script$ = $wallshuffleon$
:i :s}
:i if call $GotParam$ arguments
$from_options$
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$id$ = $menu_done$$pad_choose_script$ = $display_options_exit$$pad_choose_params$ = :s{$from_options$:s}$last_menu_item$ = %i(1,00000001)
:i else
:i call $theme_menu_add_item$ arguments
$text$ = %s(4,"Done")$id$ = $menu_done$$pad_choose_script$ = $display_options_exit$$last_menu_item$ = %i(1,00000001)
:i endif
:i $finish_themed_sub_menu$
:i endfunction
so, now we can copy & paste this between f.e.

Code: Select all

:i endif
:i endfunction
--------------------------------------------------
:i function $menu_confirm_quit_park_editor$:s{
:i $yes_script$ = $launch_park_editor_save_park_sequence$

so, we have our own menu.
But the function wallshuffleon is not defined, so this is what we will do now

setup a new function

Code: Select all

:i function $wallshuffleon$
:i call $change$ arguments
$wall_ride_delay$ = %i(0,0000000)
:i endfunction

the best is to put this right under your menu so you have a better overview.


so the last what you will have to do is add manually every new id we used

here they are:

Code: Select all

create_roq_menu
menu_roq_ws
wallshuffleon
in order to add them to the table open gamemenu.qb_table.qbi with a text editor and add the table from displayoptions.qb( so you dont have to add every single id ) and those 3,

just add ( you can use any combination except the ones already in use )

Code: Select all

#addx 0x(youll get the id if you use qbkey and rev it ) "create_roq_menu"
#addx 0x(youll get the id if you use qbkey and rev it ) "menu_roq_ws"
#addx 0x(youll get the id if you use qbkey and rev it ) "wallshuffleon"
now just compile gamemenu.txt using : qbe -c gamemenu.txt



@Morten if you lost any of your tutorials let me know on here or MSN i got most of em laying around.

may
Posts: 8
Joined: Wed Oct 06, 2010 10:32 am

Re: Creating your own physics meu(Roq)

Post by may » Wed Oct 06, 2010 10:33 am

How to get Blub's Compiler?

ProHad
VIP
Posts: 45
Joined: Wed Mar 03, 2010 10:10 pm

Re: Creating your own physics meu(Roq)

Post by ProHad » Wed Oct 06, 2010 2:41 pm

viewtopic.php?f=8&t=36

download qb2.exe or qb2.1.exe

may
Posts: 8
Joined: Wed Oct 06, 2010 10:32 am

Re: Creating your own physics meu(Roq)

Post by may » Thu Oct 07, 2010 10:52 am

I will downloaded and open QB2.1.exe and it's don't run :/ Can you help me?

%.gone.
Global Moderator
Posts: 390
Joined: Sun Mar 07, 2010 5:12 pm

Re: Creating your own physics meu(Roq)

Post by %.gone. » Thu Oct 07, 2010 11:37 am

It's a command line tool so either use the command prompt, a batch file, or use KaMers tool cmd.exe

may
Posts: 8
Joined: Wed Oct 06, 2010 10:32 am

Re: Creating your own physics meu(Roq)

Post by may » Thu Oct 07, 2010 12:06 pm

Ok, now i understand how to use roq cmd xD

may
Posts: 8
Joined: Wed Oct 06, 2010 10:32 am

Re: Creating your own physics meu(Roq)

Post by may » Fri Oct 08, 2010 10:01 am

But how to create prx?

dennis344
Posts: 18
Joined: Thu Jun 17, 2010 10:42 pm

Re: Creating your own physics meu(Roq)

Post by dennis344 » Sun Mar 13, 2011 7:51 pm

Name 'create_roq_menu' is unknown - line 2
Any way to fix this?
Sorry btw.

Morten1337
Site Admin
Posts: 322
Joined: Mon Mar 01, 2010 2:23 pm
Location: Norway

Re: Creating your own physics meu(Roq)

Post by Morten1337 » Mon Mar 14, 2011 8:26 am

dennis344 wrote:Name 'create_roq_menu' is unknown - line 2
Any way to fix this?
Sorry btw.
i think you are using an old compiler. You need to use the newest one, it will generate the checksums for you

Post Reply