Point Cap for HORSE mode

Tony Hawk's Pro Skater 3 mod discussion.
post_exodus
Posts: 7
Joined: Tue Nov 21, 2017 6:19 pm
Contact:

Point Cap for HORSE mode

Postby post_exodus » Tue Nov 21, 2017 6:24 pm

Hey there, I got a rather unusal request,

my friend and I developed a drinking game based on THPS3 and we play it for years now... one part of it is, that playing the HORSE mode (same console) you are not allowed to score more than 5000points + the previous score from your opponent,

example: opponent scores 15234 points -> your turn -> score more than 15234 points but not more than 20234! Else you have to drink.

now i wonder if you can mod that "maximum" points into the game... so that you get a letter if you score too many points... given the source code it would be quite easy but is it possible by modding the files?

in other words: somewhere in the code there is an if-statement like

if (player1score < player2score) get_letter;

and i want to change it to

if (player1score < player2score | player1score > player2score+5000) get_letter;


Thanks alot!

edit: found out that Loser mode is called Horse in the english version ;)
benne
Posts: 12
Joined: Thu Nov 23, 2017 2:46 pm
Contact:

Re: Point Cap for HORSE mode

Postby benne » Fri Nov 24, 2017 9:40 am

Hey there,
I'm quite new here so i could be wrong but I dont think you can change that kind of game logic using scripts. the if statement you talk about will be hidden in assembler code somewhere deep inside so you have to reverse engineer it.. no idea how to do it exactly :thinking:

anyway, great idea of drinking game :D
WhoElseButMe
Posts: 410
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Point Cap for HORSE mode

Postby WhoElseButMe » Fri Nov 24, 2017 3:39 pm

This could probably be done through scripting alone. The horse goal is in the scripts and you modify it to do your checks.
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.
post_exodus
Posts: 7
Joined: Tue Nov 21, 2017 6:19 pm
Contact:

Re: Point Cap for HORSE mode

Postby post_exodus » Sat Nov 25, 2017 8:23 pm

WhoElseButMe wrote:This could probably be done through scripting alone. The horse goal is in the scripts and you modify it to do your checks.


Sounds like great news for me. Well, just spent 2 hours searching for the horse goal in scripts.. no success =( closest passages i found were:

Code: Select all

mode_horse = STRUCT{
          name = horse
          initial_players = 2
          max_players = 2
          time_limit_type = config
          default_time_limit = 10
          victory_condition_type = fixed

in gamemode.qb

and

Code: Select all

IF HorseStatusEquals GotLetter
     PlayYouGetLetterSound

in horse.qb


... but the exact passage where scores are compared i didnt find.
could you please help me one more time? would be so great!
WhoElseButMe
Posts: 410
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Point Cap for HORSE mode

Postby WhoElseButMe » Sat Nov 25, 2017 10:54 pm

horse.qb is the horse goal.
You'll want to come up with your own code to add into it.
Any variable placed outside of a "function" is globally seen.
You'll want to do your check before the goal assigns the letter to a specific skater perhaps when the skater lands.
Player1 lands take score and store it.
Player2 lands...
If player2's score is greater than player1's, check to make sure their score isn't greater than the stored score + 5000.
If it is, assign the letter to player2 else assign player1 the letter.
If player2's score is less than player1's score.
If player1's score is greater than player2's score + 5000 assign player1 the letter else assign player2 the letter.
Set stored score to zero.
And by player1 i mean the person that goes first for the round so you'll want to keep track of who went first too.
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.
post_exodus
Posts: 7
Joined: Tue Nov 21, 2017 6:19 pm
Contact:

Re: Point Cap for HORSE mode

Postby post_exodus » Sun Nov 26, 2017 10:38 am

Okay, thanks again, you are a great help! I get the Idea now,
problem is, how am I supposed to know where thinks like Score of a player are stored? I did not find a variable like "player1_score" in horse.qb. Same is for functions like "landing"...

In any way, I got the feeling that I'm missing some major information here. e.g. A lot of functions are called but I cannot find their definition..
example: I find this function call in horse.qb

Code: Select all

IF HorseStatusEquals GotLetter
      PlayYouGetLetterSound
ENDIF
IF...


so I suppose the "HorseStatusEquals" should be defined somewhere depending on how the last score is in relation to top score.. but "HorseStatusEquals" is nowhere else to be found inside horse.qb

Please get that right, I dont want you to do all the work for me and find variables/functions that do specific things.. I just want to know WHERE to search for them.
Best regards!

edit:
hmm, could it be that current score is stored in %GLOBAL%$Score$ ?
and btw. is there some kind of output console to do debugging? for example if i want to check if %GLOBAL%$Score$ contains the current score, can I print it out on the screen easily to check? that would be the biggest help ever!
rodneyM7
Posts: 22
Joined: Sun Sep 24, 2017 11:37 am
Contact:

Re: Point Cap for HORSE mode

Postby rodneyM7 » Sun Nov 26, 2017 8:32 pm

Code: Select all

:u(02:0000033b)function $Land$
....

tricks.qb

Code: Select all

:u(02:0000027a)$mode_horse$ = :s{$name$ = call $horse$ arguments
      $initial_players$ = %i(2,00000002)$max_players$ = %i(2,00000002)$time_limit_type$ = $config$$default_time_limit$ = %i(10,0000000a)$victory_condition_type$ = $fixed$$accumulate_score$ = %i(1,00000001)$track_trick_score$ = %i(1,00000001)$degrade_score$ = %i(0,00000000)$is_lobby$ = %i(0,00000000)$is_frontend$ = %i(0,00000000)$screenmode$ = $horse$$should_run_intro_camera$ = %i(0,00000000)$should_run_intro_camera_noncd$ = %i(0,00000000)$show_ranking_screen$ = %i(0,00000000)$is_career$ = %i(0,00000000)$is_singlesession$ = %i(0,00000000)$is_parkeditor$ = %i(0,00000000)$should_modulate_color$ = %i(0,00000000)$is_horse$ = %i(1,00000001)$is_king$ = %i(0,00000000)$is_trick_attack$ = %i(0,00000000)$show_leader_messages$ = %i(0,00000000)$timer_beeps$ = %i(0,00000000)$teamplay_type$ = $fixed$$is_teamplay$ = %i(1,00000001):s}

gamemode.qb

Hopefully of some use for you.
WhoElseButMe
Posts: 410
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Point Cap for HORSE mode

Postby WhoElseButMe » Mon Nov 27, 2017 5:45 am

First and foremost the syntax you refer to "%GLOBAL%" isn't a globally seen object at all and are nothing more than a local argument of the current function. A rule of thumb when dealing with THPS scripts and function names if the name has an underscore in it "_" to separate names it's usually somewhere in the scripts. If it doesn't then it is usually a cfunc found only in the exe.

You need to modify this goal to do what you want. So you get scorepot from the skater and store it yourself. Apply math yourself. You're trying to go around the game logic to do what you want or to force the game logic to do what you want.

The printf function is typically not compiled in release builds of the game but you could try sending chat messages to the screen.
formattext then sendchatmessage is usually a way to do this when you can't use printf to display messages.
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.
post_exodus
Posts: 7
Joined: Tue Nov 21, 2017 6:19 pm
Contact:

Re: Point Cap for HORSE mode

Postby post_exodus » Mon Nov 27, 2017 8:20 pm

Thanks to both of you!

now I understand better how everything works.

WhoElseButMe wrote:So you get scorepot from the skater and store it yourself.

That's exactly the point, didn't find a variable yet that stores current score of player... but I'll scan every script with my eyes and try to locate it ;)

I'm glad for all the input. Thanks alot!
WhoElseButMe
Posts: 410
Joined: Tue Aug 04, 2009 12:50 am
Location: FL - USA
Contact:

Re: Point Cap for HORSE mode

Postby WhoElseButMe » Mon Nov 27, 2017 8:49 pm

Because it isn't stored in scripts.
scorepot is the skater score.
outside of a function make an integer variable
my_stored_score = 0
then when you need to set it use change my_stored_score = whatever
my_stored_score can be used globally as long as it is in a script loaded with the game and isn't instantiated inside of a function.
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.
post_exodus
Posts: 7
Joined: Tue Nov 21, 2017 6:19 pm
Contact:

Re: Point Cap for HORSE mode

Postby post_exodus » Thu Dec 07, 2017 2:17 pm

Hey everybody! I'm almost done with my mod :) thanks to benne and all his questions in the other thread I managed to implement my score cap in Horse mode...
BUT: only for Player 1
Strange thing is: the functions

Code: Select all

SkaterCurrentScorePotGreaterThan
SkaterTotalScoreLessThan
SkaterTotalScoreGreaterThan
...

etc. are only working with player one. If I use them on second player, the score always seems to be zero.
So I hope there is some function like "SecondSkaterTotalScoreLessThan" but apparently there isn't ...

It is the last obstacle in my way I think.. can somebody help me (one more time)? :)
Maybe you, Demo? :)

Return to “THPS3 modding”

Who is online

Users browsing this forum: No registered users and 1 guest