Kakis

Regular
Regular
Joined
Dec 20, 2018
Messages
34
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hello, I have been trying out Raizen's triple triad game:
(available here) https://forums.rpgmakerweb.com/index.php?threads/triple-triad-ff8-mini-game.22285/ and was wondering if I could get some help with a few changes to it. I would like to be able to add a description for the cards, when looking at the card album. (in the area highlighted in the image.)


Also, this is not related to scripting per say, but I'm having trouble with actually activating the triple triad game. Perhaps it's something that I am missing, but whenever I've tried out the demo and talked to NPCs, even with a deck on hand I can't seem to trigger it.

Any help would be appreciated, thank you.
 

Roninator2

Gamer
Regular
Joined
May 22, 2016
Messages
5,231
Reaction score
1,563
First Language
English
Primarily Uses
RMVXA
activating the triple triad game
In the script is a button that you press to start a game when talking to the NPC. Well, actually don't press z and talk to them then press the button (A), you just walk up to them and press A (the button programmed by default. But you also have to have your deck populated to play a game. Get some money buy your cards and go to the key items to load the deck then put cards into your hand, then challenge someone.

As for the description you need three things.
1. add in the description to the card. Keeping in mind that you only have so much width for the window.
2. add a line for the text line.
3. Add a line to draw the description

1. remember to add a comma at the end of the last line (after the slime 2). Card Settings script
Ruby:
Card[0] = {
# Configure each atribute of the card according to the direction.
# ONLY NUMBERS, if it is an A card, put 10.
'UP' => 5,
'LEFT' => 1,
'RIGHT' => 2,
'DOWN' => 2,
# Configure the basic settings for the card
'Price' => 10, # If not sellable, put 0
'Name' => "Slime", # Put the name of the card between ""
'Rarity' => 1, # So you can creat card boosters or other systems
'Image1' => "Slime1", # Name of image for player 1.
'Image2' => "Slime2", # Name of image for player 2.
'Desc' => "It's the weakest card you can use"

}
2.Add the album text. Card Album script line 56
Ruby:
# Texts
Album_Text[0] = 'Quantity: '
Album_Text[1] = 'Rarity: '
Album_Text[2] = 'Total Points: '
Album_Text[3] = 'Not enough cards!'
Album_Text[4] = 'Price: '
Album_Text[5] = 'Description: '

3. Add the line to the refresh method. Card Album script line 308
Ruby:
  def refresh(index)
    contents.clear
    contents.font.size = Text_size
    contents.font.name = Text_font
    if @card_number[index] == 0
      draw_text(Text_album_x, 0, window_width - Text_album_x, fitting_height(1), '?????', 1)
    else
      draw_text(Text_album_x, 0, window_width - Text_album_x, fitting_height(1), Card[index]['Name'], 1)
    end
    draw_text(Text_album_x, fitting_height(2), window_width - Text_album_x, fitting_height(1), Album_Text[0] + $game_timer.total_cards[index].to_s, 1)
    draw_text(Text_album_x, fitting_height(3), window_width - Text_album_x, fitting_height(1), Album_Text[1] + Card[index]['Rarity'].to_s, 1)
    sum =  Card[index]['UP'] + Card[index]['RIGHT'] + Card[index]['LEFT'] + Card[index]['DOWN']
    draw_text(Text_album_x, fitting_height(4), window_width - Text_album_x, fitting_height(1), Album_Text[2] + sum.to_s, 1)
    draw_text(Text_album_x, fitting_height(5), window_width - Text_album_x, fitting_height(1), Album_Text[4] + Card[index]['Price'].to_s, 1)
    draw_text(0, fitting_height(6), window_width, fitting_height(2), Album_Text[5] + Card[index]['Desc'].to_s, 1)
    reset_font_settings
  end
It's the last line before reset_font_settings

Multi lines.
You would have to repeat this process for multiple lines of description.
Or you can use the draw_text_ex built in method with an adjustment
copy the draw_text_ex method and paste it in the card album below the refresh method then delete the reset_font_settings line. If you don't then the font will be default and will be larger that the other text. This will require you to adjust the refresh method mentioned above and the description text.
1.
Ruby:
Card[0] = {
# Configure each atribute of the card according to the direction.
# ONLY NUMBERS, if it is an A card, put 10.
'UP' => 5,
'LEFT' => 1,
'RIGHT' => 2,
'DOWN' => 2,
# Configure the basic settings for the card
'Price' => 10, # If not sellable, put 0
'Name' => "Slime", # Put the name of the card between ""
'Rarity' => 1, # So you can creat card boosters or other systems
'Image1' => "Slime1", # Name of image for player 1.
'Image2' => "Slime2", # Name of image for player 2.
'Desc' => "The weakest card you can use.\nAn oldie but a goodie."

}
Notice the \n in the text, that's for new line function.
3.
Ruby:
  def refresh(index)
    contents.clear
    contents.font.size = Text_size
    contents.font.name = Text_font
    if @card_number[index] == 0
      draw_text(Text_album_x, 0, window_width - Text_album_x, fitting_height(1), '?????', 1)
    else
      draw_text(Text_album_x, 0, window_width - Text_album_x, fitting_height(1), Card[index]['Name'], 1)
    end
    draw_text(Text_album_x, fitting_height(2), window_width - Text_album_x, fitting_height(1), Album_Text[0] + $game_timer.total_cards[index].to_s, 1)
    draw_text(Text_album_x, fitting_height(3), window_width - Text_album_x, fitting_height(1), Album_Text[1] + Card[index]['Rarity'].to_s, 1)
    sum =  Card[index]['UP'] + Card[index]['RIGHT'] + Card[index]['LEFT'] + Card[index]['DOWN']
    draw_text(Text_album_x, fitting_height(4), window_width - Text_album_x, fitting_height(1), Album_Text[2] + sum.to_s, 1)
    draw_text(Text_album_x, fitting_height(5), window_width - Text_album_x, fitting_height(1), Album_Text[4] + Card[index]['Price'].to_s, 1)
    draw_text_ex(0, fitting_height(6)+5, Album_Text[5] + Card[index]['Desc'].to_s)
    reset_font_settings
  end
  def draw_text_ex(x, y, text)
    text = convert_escape_characters(text)
    pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
    process_character(text.slice!(0, 1), text, pos) until text.empty?
  end

Try these out and see if it matches what you want.
1672674051871.png
 

Kakis

Regular
Regular
Joined
Dec 20, 2018
Messages
34
Reaction score
2
First Language
English
Primarily Uses
RMMV
In the script is a button that you press to start a game when talking to the NPC. Well, actually don't press z and talk to them then press the button (A), you just walk up to them and press A (the button programmed by default. But you also have to have your deck populated to play a game. Get some money buy your cards and go to the key items to load the deck then put cards into your hand, then challenge someone.
Ah, I see! Thank you for the explanation. Tried it out and was able to get the triple triad game working.

As for the code, I was able to get the description working for cards without too much trouble, but I noticed that for some reason there are "[]", for where there should be a new line of text. Not sure why.



 

Roninator2

Gamer
Regular
Joined
May 22, 2016
Messages
5,231
Reaction score
1,563
First Language
English
Primarily Uses
RMVXA
I noticed that for some reason there are "[]", for where there should be a new line of text. Not sure why.
That's because your using the draw_text method. As I showed you need to use draw_text_ex to have it use the new line properly, otherwise you have make new draw_text for each line for the description. If you don't do this then it will take more work to get the new line to work.
 

Kakis

Regular
Regular
Joined
Dec 20, 2018
Messages
34
Reaction score
2
First Language
English
Primarily Uses
RMMV
That's because your using the draw_text method. As I showed you need to use draw_text_ex to have it use the new line properly, otherwise you have make new draw_text for each line for the description. If you don't do this then it will take more work to get the new line to work.
Oh, sorry my bad. I could've sworn I included the drawn_text_ex method.
Had a look through and realised that on script line 307, it was missing the draw_text_ex. I was confused because I had included:
def draw_text_ex(x, y, text)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?

So I had originally thought I had included it.
It's now working fine for me! Thanks again!
 

Latest Threads

Latest Posts

Latest Profile Posts

Lesson of the day: Trying to arrive in time is sometimes more difficult than any boss fight.
Day #2: Today we have some teddybears... and a brave dad to fend them off!1701517253009.png
Driving to Florida today to spend a week like we did last year. Looks like it will just be me and the Mrs. But she sleeps a lot longer than me so I will still have time to work on my Game Jam project. :stickytongue:
I think I have an unhealthy obsession with ornamentation... :kaoswt:

alice_frame_leaves.png

Forum statistics

Threads
136,681
Messages
1,268,685
Members
180,385
Latest member
kichigai333
Top