Author Topic: Increasing SP max.  (Read 3131 times)

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Increasing SP max.
« on: September 11, 2006, 10:11:48 pm »
Hello.

I am making Blackjack in the M. Fair for Silver Points. (Don't worry, I'll make a tutorial when I get that far :D). What I need is to know what I must do to change the SP max to 9999 instead of 200, also SP need to carry over on a NewGame+. If anyone can give me a quick solution of what hex I must change to do these two things I would greatly appreciate it. 

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Increasing SP max.
« Reply #1 on: September 12, 2006, 12:53:56 am »
Originally, silver points is 1 byte, with 255 silver points being the max.  Well, technically the event code limits it to 200, but that can be changed easily (look around where NPCs say "You can't earn any more points", then remove the >C8 check and = C8 assignment commands.  C8 in hex is 200 in decimal, what you're really seeing there is "If Silver Points >200, display "Can't earn any more points" text and set silver points back to the maximum of 200".  When the commands are removed you can now use the full 255 again.  But since you require a maximum greater than that...

Having >255 silver points requires moving it to another memory address that has two consecutive bytes unused.  The additional requirement of New Game+ is a little tricky as there is a very limited amount of data that gets moved to the new game.  Fortunately, there is a little bit of free space (to the best of my knowledge) within the character stats.

Open events for Location 1B7 Leene Square

At the beginning, offset 0401, change the existing assign command to:

Assignment mem-to-mem, Variant 49, Load from 7E294E, Store to 7F0242, Width two byte.

Scroll down to offset 0A95, change the Width to Two byte
The next command 0A9A, change value 8 to value 16 in the text box
Then go to 0AAF, change the Assign command to have it Store to 7E294E, Width two byte.

Press the Write Mem. button, and then File -> Save.

Now, when you talk to the shopkeeper at the tent that exchanges gold for silver points, he'll correctly use the new address and display an amount >255, assuming you have that many silver points.

...and that should be enough to get you started.
« Last Edit: September 12, 2006, 01:11:19 am by JLukas »

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #2 on: September 12, 2006, 12:00:54 pm »
Thank you JLukas, that was very informative. Btw, I just have to do the two-byte / mem address thing to all spots in M. Fair where it checks SP for 9999 SP? Also, does the above code make it carry over on NewGame+?
« Last Edit: September 12, 2006, 04:36:24 pm by Zakyrus »

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Increasing SP max.
« Reply #3 on: September 12, 2006, 09:31:57 pm »
Yes, just follow the above for all the other NPCs (Objects) at the fair that deal with silver points.  With the new 7E294E memory address, yes, it carries over to a New Game+


Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #4 on: September 12, 2006, 10:04:13 pm »
Ok thanks.

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #5 on: September 13, 2006, 08:40:35 am »
Here's the basic layout of the BlackJack game, this is simply a BASIC layout. Once I get this working, I'll make the TF tutorial. But for now...:


Blackjack!
Instructions: The basics of Blackjack are to beat the dealer without going over 21. You are dealt two cards and afterwards may draw as many cards as you wish. But, if you break 21 the dealer automatically wins. The card values are as follows: 2 through 10 equals their respective values. J, Q, and K equal 10. A equals 1 or 11 depending on your hand. If your hand is greater then 11 then an A equals 1. You can bet 5, 10, or 25 SP per game and if you win you will receive double the amount you bet. In the event of a tie, nobody wins and you are refunded your bet amount.

Game:
Welcome to the Blackjack table. Play a round with me sir?
Require Instructions? (if yes show instructions, above)
How many Silver Points would you like to bet? (5,10,25) {check amount vs current SP}
if bet_amount > cur_SP then "Dealer: What are you trying to pull? You don't have enough SP" else:

(set d_check to false)
(bet_amount= bet)

game_start:
Dealer: I will first deal you two cards.
Dealer: Your first card.
  You have a(n) (give card value)
Dealer: Your second card.
  You have a(n) (give card value)
Dealer: I will draw my cards.
  Your total is:  (give total value)
Dealer: Draw or Stay?      {if Draw then goto Draw, else goto Stay}

Draw:
Dealer: Here is your card.
  You have a(n) (give card value)
if d_check=false then {goto dealer_check}
  Your total is:  (give total value)      {if total > 21 then goto break}
Dealer: Draw or Stay?            {if Draw then goto Draw, else goto Stay}

Stay:
if d_check=false then {goto dealer_check}
Dealer: Please show me your hand.   {goto game_check}

dealer_check:
{if dealertotal =< 16 then "Dealer: I will draw another card."}
{if dealertotal => 17 then "Dealer: I will play with this hand."} & set d_check=true (so he only says this # of times needed)
{goto dealer_check}  loop thru this again until dealer has a good hand

break:
{if total > 21 then "You have (total), you broke 21. Dealer wins this round."}   goto end_game
goto end_game

game_check:
if dealertotal > 21 then: "Dealer: I have (dealertotal), which means I broke 21. You win this round." goto win_game
if dealertotal = total then: "Dealer: I have (dealertotal), you have (total). We both tie."          goto tie_game
if dealertotal > total then: "Dealer: I have (dealertotal), you have (total). I win this round."          goto lost_game
if total > dealertotal then: "Dealer: You have (total), I have (dealertotal). You win this round."          goto win_game

tie_game:
"You got back your (bet_amount) Silver Points."
goto end_game

win_game:
"You win (bet_amount * 2) Silver Points!"
goto end_game

lost_game:
"You lost (bet_amount) Silver Points!"
goto end_game

end_game:
reset all card, totals, and d_check values
Do you want to continue? (if no, exit script)
{check bet_amount vs SP}
goto game_start


There you have it. Also, I am using a Grey Cat for the Dealer Sprite  :D. Once I get this figured out, I am going to attempt to make Poker(Texas Holdem style)! The suits would be: hearts(heart), swords(spade), scythes(clubs), rings(diamonds). However, this requires keeping track of an and randomizing an entire deck and having the user selectable option of going against the Dealer and up to two NPCs (more ppl, the bigger the SP pot); which means that each player would have to be able have 2 cards with suits and some card checking scripts to see if its worth folding, raising, or bluffing. Also, I would need some way to make a mini text window that displays your cards and that on the table(otherwise the textbox would be full of decisions, and it would be hard to see what cards you have and especially those on the table. I seriously doubt this is possible(not the card checking but a deck with suits and numbers attached). If anyone can help me on this drop me a email or post here in this forum.
« Last Edit: September 13, 2006, 08:59:59 am by Zakyrus »

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #6 on: September 27, 2006, 03:30:24 am »
I added the above code, and I believe it's currently not possible to increase past 255. This is because of this function in TF:

(Loc 1B7 Leene Square)
[0A01] 7F0242 += 05; TF does not allow me to change this to a two-byte function. So, I am thinking I am going to have to wait on this. If I leave this as one-byte, the SP goes to 4 SP instead of going higher than 255.
« Last Edit: September 27, 2006, 08:17:27 am by Zakyrus »

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Increasing SP max.
« Reply #7 on: September 27, 2006, 09:47:05 am »
I won't be able to look into this in detail until later, but you should be able to use two of those 1 width commands to get the job done, like this:

7F0242 +=00
7F0243 +=05

I forget if the game reverses the values, you might need to switch the above to 7F0242 +=05 and 7F0243 +=00 instead.  Try both methods out and see if you can get it working.  Really you only need 1 byte here since you're only adding 5 silver points as the prize(instead of >255)  Did you get the shopkeeper example above working at least?

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #8 on: September 27, 2006, 10:00:17 am »
Yeah I got the shop part working, so it checks your SP no problem. I was just having trouble with the parts where it adds to the SP. I'll play around with this some more later.

>_< I am currently confused at the moment. Everything I do makes the SP go to 4 SP (although it does indeed now go up to atleast 255, I can't get it to add right or something so I can't really see if it can go over yet. I'll keep playing around with this.)
« Last Edit: September 29, 2006, 04:10:57 am by Zakyrus »

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #9 on: November 04, 2006, 01:49:31 am »
After some time I came back to this and found a way around it.

I changed the > C8 checking to C350 ( 50,000 ) width 2, then what I did was Assign the SP to be added to memory ( I Assigned to mem address 7F0244 (which is temp memory), then it adds the SP to the total.
Afterwards, it assigns 7F0244 back to 0 so it can be used for other temp values again. Probably not the best way to get it working, but it works perfectly and that's all that counts. Now, SP can go up to 65,535 if you wish; but if you go higher, it will still go back to 0. Also, yes, they do carry over to the new game+.

As for the Blackjack, well that's another story. I have it almost finished, but here's the part where I am deadlocked:

I used random number to gain the card values(these here are the hex values). 0-13 = A, 13-26 = 2, 26-39 = 3 and so on....  So approx.  every card uses 19 numerical values within the rand. number. Then it stores this to a temp. mem value.

The problem is that when you add the cards together, they obviously are adding the hex values. So drawing an A and a 2 is going to/could give me numerical value 39 instead of 3.

I need a way to either reduce the hex numbers to simple numerical, or be able to simply "value-to-mem" the number into a simple numerical one... however the latter can't be done because the only operations that can be done are add and subtract, it doesn't have =, multiply, or divide. Also I don't want to use too many temp values,  as MANY of them are used up.  (7F200 to 7F03FE) This is so you/dealer can draw up to 8 cards. (shouldn't need more than that)

All I have to say is that sadly the video poker will be easier to finish then this. (and that uses suits!) (Though the texas-hold em style still will be the hardest)

If anyone has input on this please feel free to lay it on me.
« Last Edit: November 04, 2006, 02:32:35 am by Zakyrus »

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #10 on: December 16, 2006, 05:22:08 pm »
Here's the Slot Machine:




There is a few bugs in my Leene Square(in the Blackjack object), so I can't release the TF export until I fix them. When that happens I will have Blackjack added too(it's about 98% done).

ZeaLitY

  • Entity
  • End of Timer (+10000)
  • *
  • Posts: 10795
  • Spring Breeze Dancin'
    • View Profile
    • My Compendium Staff Profile
Re: Increasing SP max.
« Reply #11 on: December 16, 2006, 07:49:53 pm »
Totally impressive.

JLukas

  • Fan Project Leader
  • Squaretable Knight (+400)
  • *
  • Posts: 426
    • View Profile
Re: Increasing SP max.
« Reply #12 on: December 16, 2006, 08:10:33 pm »
With the event window open, you can decode the event data to a .txt file.  At the top of the screen, select LocEvent -> Decode All.  That way you won't need to take screenshots  :D

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1351
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Re: Increasing SP max.
« Reply #13 on: December 19, 2006, 01:16:23 am »
With the event window open, you can decode the event data to a .txt file.  At the top of the screen, select LocEvent -> Decode All.  That way you won't need to take screenshots  :D

Thanks. I will keep that in mind.