Triple Triad - FF8 Mini-game

Ok, so just to be clear, we are replacing

Spoiler
  #--------------------------------------------------------------------------  # * gain_traid_card(id, num) - !!UPDATED!!  #--------------------------------------------------------------------------  def gain_triad_card(id, num)    old_total = $game_timer.total_cards[id]    old_disc = $game_timer.card_discovery[id]    if Config_Triple_Triad::Max_Cards_Types != 0 && Config_Triple_Triad::Max_Cards != 0      num.times do        if $game_timer.total_cards_owned < Config_Triple_Triad::Max_Cards &&          ($game_timer.total_cards[id] + $game_timer.hand_cards_check[id]) < Config_Triple_Triad::Max_Cards_Types          $game_timer.total_cards[id] += 1          $game_timer.total_cards[id] = 0 if $game_timer.total_cards[id] < 0          $game_timer.card_discovery[id] = true if num > 0          SceneManager.scene.card_triad_popup(id, num, old_total, old_disc) if num > 0        else          $game_timer.card_overflow[id] += 1        end      end    else      num.times do        $game_timer.total_cards[id] += 1        $game_timer.total_cards[id] = 0 if $game_timer.total_cards[id] < 0        $game_timer.card_discovery[id] = true if num > 0        SceneManager.scene.card_triad_popup(id, num, old_total, old_disc) if num > 0      end    end    if $game_timer.card_overflow.max > 0 && $game_timer.overflow_flag == false      Sound.play_buzzer      $game_message.position = Config_Triple_Triad::Message_Full_Pos      $game_message.add(Config_Triple_Triad::Booster_Full_Text)      $game_timer.overflow_flag = true      Fiber.yield while $game_message.busy?      SceneManager.call(Scene_Card_Overflow)    end  endend

with the following (what you posted above):

Spoiler
#--------------------------------------------------------------------------# * gain_traid_card(id, num) - !!UPDATED!!#--------------------------------------------------------------------------def gain_triad_card(id, num)old_total = $game_timer.total_cards[id]old_disc = $game_timer.card_discovery[id]if Config_Triple_Triad::Max_Cards_Types != 0 && Config_Triple_Triad::Max_Cards != 0num.abs.times doif num > 0if $game_timer.total_cards_owned < Config_Triple_Triad::Max_Cards && ($game_timer.total_cards[id] + $game_timer.hand_cards_check[id]) < Config_Triple_Triad::Max_Cards_Types$game_timer.total_cards[id] += 1$game_timer.card_discovery[id] = true if num > 0else$game_timer.card_overflow[id] += 1endelse$game_timer.total_cards[id] -= 1$game_timer.total_cards[id] = 0 if $game_timer.total_cards[id] < 0endendif $game_timer.total_cards_owned < Config_Triple_Triad::Max_Cards && ($game_timer.total_cards[id] + $game_timer.hand_cards_check[id]) < Config_Triple_Triad::Max_Cards_TypesSceneManager.scene.card_triad_popup(id, num, old_total, old_disc) if num > 0 && SceneManager.scene_is?(Scene_Map)endelsenum.abs.times doif num > 0$game_timer.total_cards[id] += 1else$game_timer.total_cards[id] -= 1end$game_timer.total_cards[id] = 0 if $game_timer.total_cards[id] < 0$game_timer.card_discovery[id] = true if num > 0endSceneManager.scene.card_triad_popup(id, num, old_total, old_disc) if num > 0 && SceneManager.scene_is?(Scene_Map)endif $game_timer.card_overflow.max > 0 && $game_timer.overflow_flag == falseSound.play_buzzer$game_message.position = Config_Triple_Triad::Message_Full_Pos$game_message.add(Config_Triple_Triad::Booster_Full_Text)$game_timer.overflow_flag = trueFiber.yield while $game_message.busy?SceneManager.call(Scene_Card_Overflow)endend
Also, Sixth, what does Max_card and max_card_types do? Max_cards is the maximum amount of total cards? or individual cards? The description leaves me wanting 😛
'Max_Cards' is the total maximum amount of cards the player can hold.


If this is set to 100, for example, when the player got 100 cards already (regardless of the card's type) and gains more cards from somewhere (no matter what type of card), the card arrangement scene triggers, because the player can not take any more cards at all.


'Max_Card_Types' is the maximum amount of cards the player can hold from a card type.


For example, if this setting is 9, and the player have 9 Slimes card already, the next Slime card will trigger the card arrangement scene, because the player can not take anymore cards from that type.


I hope it's clear now. 😀


Yeah, you replace that one. Just make sure you leave the last 'end' line there which is NOT the part of the definition itself (it closes the class 'Game_Interpreter'), or else you will get a nice error smiling at you. 😀


But don't post script parts without code tags, pretty please, it hurts my eyes! *-*


I made a new popup for the card arrangement trigger when the player gains a card which he/she can't take. I couldn't look at that text message box at the middle of the screen anymore. 😀


Looks prettier now.


And I guess I will retire from this script for now. Will still fix bugs if someone finds and reports them, of course.


Will post a fixed demo a bit later, so I don't leave a bugged one up and will add the change mentioned above in it too.
Hmm. Just one quick question, when opening a booster pack, the popup follows and is centered on the player and not the screen. How to make it center on the screen?

EDIT: Answer: In the Booster and Popup section of the scripts.
Hmm. Just one quick question, when opening a booster pack, the popup follows and is centered on the player and not the screen. How to make it center on the screen?

EDIT: Answer: In the Booster and Popup section of the scripts.
Code:
  # The type of the popup window's placement.  # :player = the appearance will depend on the player's position on the screen.  # :direct = the popup window will always appear at the same place on the screen.  Pop_Placement_Type = :player                                    # Set the height of the popup window here. Useful if you got smaller or  # bigger cards in your game.  Pop_Height = 236          # These settings will adjust the position where the popup window will show up.  # If the above setting is set to :player, these settings will act as offset  # values which will be added to X and Y position accordingly.  # If the above setting is set to :direct, this will set the X and Y position  # of the popup window on the screen directly.  # Regardless which type did you choose above, the X setting here represents  # the center of the window, not it's left edge like usually.  X_Placement = 0     Y_Placement = -85
BUG: Card shop wallpaper doesn't work properly. When making the script use wallpaper the card window with card images, description and your total cards are not shown at all. Also the list of cards in the shop loses its window skin border. 

When using another script to force the background on it it works althou the list of the cards in the shop are shown behind the transparent window.
I never tested the background option, haven't even touched it.


Will take a look at it a bit later, gotta go now for a few hours.


Thanks for reporting!


Ok, fixed it.


Damn these 'z' values! >.> 😀


Ima pack the fixed demo now and will upload it.


New demo uploaded. It is at the same place, I edited my post there.


The change log is there also.
Hmm. Got a very bad error almost every time in the Win / Lose scene. I was able to come up with this error message in the DEMO also so its not just my customizations f*king it up.

Using random cards bought from the store. Used triple_triad(1) to start the battle. Enemy settings for enemy 1:

Spoiler
#============================================================================= # Big Randy #============================================================================= Enemy[1] = { 'Cards' => [5, 5, 3, 4, 2, 6], 'Reservecards' => [3, 4, 5, 6], 'Music' => 'battledesert', 'AI' => 2, 'Win' => 2, 'Open' => false, 'Same' => true, 'Plus' => true, 'Combo' => true, 'Samewall' => false, 'Pluswall' => false, 'Elemental' => false } 
Error happens after the battle in the Win / Lose scene when trading the cards you've won / lost. Error message:

Spoiler
error.png
Line 159 is 

$game_timer.hand_cards_check[$game_timer.hand_deck[n-5]] -= 1The whole section where line 159 is located (Inside script Win / Lose Scene):

Spoiler
#-------------------------------------------------------------------------- # * Atualização de cena - !!UPDATED!! #-------------------------------------------------------------------------- def update super move_cards if @decided == false if @start_count if Input.trigger?🙂 $game_variables[WinVariable] = @win_old if $game_timer.card_overflow.max > 0 Sound.play_ok dispose_all SceneManager.goto(Scene_Card_Overflow) return else Sound.play_ok dispose_all SceneManager.goto(Scene_Map) return end end end if @decided == false return if @player_pics[4].x > @player_pics[4].width/2 + 30 end exchange_cards if !@flip_npc_commands.empty? && @flip_npc_commands.first > 4 flip_npc_cards if @condition == 1 # one cursor_move if @decided == false return unless @flip_npc_commands.empty? if $game_variables[WinVariable] == 1 player_won else npc_won end elsif @condition == 2 # direct return if @decision @decision = true Sound.play_ok $game_variables[WinVariable] = 1 for n in 5...10 if $game_triple_results[n] == 1 $game_timer.npc_triple_triad[@id].push($game_timer.hand_deck[n-5]) $game_timer.hand_deck[n-5] = nil $game_timer.hand_cards_check[$game_timer.hand_deck[n-5]] -= 1 @flip_npc_commands.push(n) end end $game_timer.hand_deck.compact! @done = false @cards_taken = 0 for n in 0...5 if $game_triple_results[n] == 0 @cards_taken += 1 end end @cards_now = 0 @cards_now_taken = 0 for n in 0...5 if $game_triple_results[n] == 0 if $game_timer.total_cards_owned >= Config_Triple_Triad::Max_Cards && Config_Triple_Triad::Max_Cards != 0 $game_timer.card_overflow[$game_timer.npc_hand[n]] += 1 @cards_now += 1 elsif ($game_timer.total_cards[$game_timer.npc_hand[n]] + $game_timer.hand_cards_check[$game_timer.npc_hand[n]]) >= Config_Triple_Triad::Max_Cards_Types && Config_Triple_Triad::Max_Cards_Types != 0 $game_timer.card_overflow[$game_timer.npc_hand[n]] += 1 @cards_now += 1 else $game_timer.total_cards[$game_timer.npc_hand[n]] += 1 $game_timer.card_discovery[$game_timer.npc_hand[n]] = true @cards_now += 1 @cards_now_taken += 1 end if @cards_now == @cards_taken && @cards_now_taken == 0 && @cards_taken > 0 @rule_window.full_album = true @rule_window.refresh_full @start_count = true Sound.play_buzzer elsif @cards_now == @cards_taken && @cards_taken > 0 @rule_window.full_type = true @rule_window.refresh_full @start_count = true Sound.play_buzzer end end end $game_timer.npc_triple_triad[@id][$game_timer.npc_triple_triad[@id].index($game_timer.npc_hand[n])] = nil @flip_npc_commands.push(n) $game_timer.npc_triple_triad[@id].compact! else # all if $game_variables[WinVariable] == 1 take_all_npc unless @decision else take_all_player unless @decision end end end 
EDIT: It would help a lot if you'd added what scripts you edited in the change log! 🙂

And a big thanks on that background fix!

How about adding a sound option for Draw? It's kinda bad when you get draw and all of the music suddenly stops and there is only silence in the Win / Lose scene.
Damn, I should have put that line above the line '$game_timer.hand_deck[n-5] = nil'. >.>


Doing that will fix the problem, so feel free to move the problematic line above that line.


I rarely lose when I test, because I rig the battles, lol, that's why I missed that line. 😀


Thanks again for the report! 🙂


Much easier to find bugs if there are more people testing.


As for my edits, everything I edited is marked by me.


"!!UPDATED!!" means I changed something in that definition/class.


"!!NEW!!" means I added that whole definition/class by myself.


Just search for those and you will see exactly what I edited/added. 🙂


And for the definition edited after each update, just by reading the change log should give a basic idea where I edited the stuffs.


Script calls are in Game_Interpreter, visual changes are in the relevant window classes mostly, sometimes in the scenes itself. And basically that's it.


But I will try to add the exact definition to the change logs from now on, although I hope there won't be many change logs anymore, because that means a bug has been found. 😀


I will try to add some music for the "Draw" ending too.


Added music for the "Draw" ending. 🙂


Gonna test a bit more, and will update the demo again for the fix and draw music.
Awesome, haven't tested the fix yet thou. But I love how fast you tackle with the bugs. Seal of approval granted.
It would be a shame if I wouldn't fix it this quickly with such a detailed bug report! 😀


This is exactly how a bug report should look like, so extra thanks for that! 🙂


And just for the sake of doing something else in the new demo, I made a new "Win Condition" named "Random". It should be obvious what will happen on the win/lose scene if that condition is used. 😛


Demo updated again!
Awesome work you guys!! thanks Sixth!!! - will test it out in the coming days!
Hmm. Why it says "Not enough space in your card album to take all cards won!" in the Win / Lose scene after battle even when I have set Max_Cards = 0 and Max_Cards_Types = 0?
I probably missed a check somewhere. What type of win condition was activated when this happened?


I just got home from work, will need a few minutes to synchronize myself for scripting. 😀


Gonna check the issue after dinner.


Okay, I assume it happened with the "Direct" win condition.


I messed up quite a lot on that one and I just noticed it.


The card flipping at the end wasn't working properly, that one I fixed just now.


Same flipping issue appeared at the "All" win condition.


Also fixed the issue with that improper message at the end on win/lose scene.


Gonna triple check everything on the win/lose scene again, because it seems I haven't tested it that much or maybe I tested it in the middle of a night while being a half-zombie. 😀


Since I am kinda sick of waiting for 4MB+ to upload (30+ minutes or more if my connection resets >.>), I will just upload the fixed win/lose scene.


win_lose_scene_fix_sixth.txt


Just replace the Win/Lose script with this one, and the issues from above should disappear.


Will update the demo after a few days waiting, just in case someone finds some other bugs. 😛
Looking at this, I am confused!

Which version is the one that is refined with little bugs?

v 1.1.7?

Also is there anyway to remove the cursor icon if you dont use cursor scripts in your game? as it looks silly having the album open and a hand in the corner!

(annnd I am using OP's script atm, I dont want to deviate from it if there are bugs in the newer ones is all!)
Looking at this, I am confused!

Which version is the one that is refined with little bugs?

v 1.1.7?

Also is there anyway to remove the cursor icon if you dont use cursor scripts in your game? as it looks silly having the album open and a hand in the corner!

(annnd I am using OP's script atm, I dont want to deviate from it if there are bugs in the newer ones is all!)
This is an irrational fear -- the new script looks amazing. Get 1.1.7 and check it out, Sixth did some great things.

Then Replace the win/lose scene in 1.1.7 with the one Sixth posted above. Boom. Fixed.

As for the cursor thing, just get the script - it takes 2 seconds and if u have any problems we will help u
This is an irrational fear -- the new script looks amazing. Get 1.1.7 and check it out, Sixth did some great things.

Then Replace the win/lose scene in 1.1.7 with the one Sixth posted above. Boom. Fixed.

As for the cursor thing, just get the script - it takes 2 seconds and if u have any problems we will help u
cool I will give it a look, with the cursor thing, does it enable mouse use in everything?

can someone link me script source?
Also  ( I had to repost due to not being able to attach a file)

I get this in the shop window / Guide 😮 any help ? 🙂

Attached a 3rd ( found out how to attach so sorry for dupe post!)

There is 3 attachments all windows seem off!

EDIT: It doesn't do it in the demo game, could it possibly be my window color doing it? D:

(as I have taken out my custom menu and that didnt change anything)

issue.png

issue2.png

issue3.png
The scenes are like that because in the demo, I used 640x480 resolution and the settings are configured for that resolution.


You use the default resolution, which is 544x416. You will need to edit the settings for your resolution to make it look like a normal scene. I gave an option for most of the things in each scene, so you can configure it how you like.


However, there was a reason for using 640x480 resolution for the demo. I simply could not fit everything on the scenes on less resolution without making it too crowded and quite frankly... ugly. 😀


You can still try thou, the settings are there for you, the descriptions for them should be more than enough to understand what each of them do. And if you manage to set the scenes up on your resolution, feel free to share the settings for it!


In short, this is NOT a plug-and-play script unless you use 640x480 resolution for your game, and yes, it will take some time to set the scenes up for yourself, but that can't be helped, sorry.


The cursor can be disabled if you want. You can even enable it only for the Triple Triad scenes if you want. If you don't want the menu cursor anywhere, you don't need the menu cursor script.


But just a heads up, without that cursor, you will not see any indicator on the card album scene (by default) when using the icon version. The icons are drawn above the default cursor, it is how the 'draw_item' method works in this regard. That is why I included the menu cursor script in the demo.


I have no idea if the scenes will work with any mouse script, that you need to find out yourself. I don't even know how those scripts work, but I believe that if it doesn't work, than the problem lies in the mouse script, not in the Triple Triad script, because I use only default methods to draw the scenes/windows and visuals.


If it works, I guess you won't need that cursor icon anyway, right? Because you will see your mouse pointer instead, I guess.


As for the bugs, I fixed everything what has been reported so far.


But if someone finds some other bugs, I will be here to fix them, so don't worry about that.


If you need any help with the configuration, you can ask me.


But please, don't ask me to set the scenes up for you for your resolution, because honestly, I tried and I am sick from these low resolutions when it comes to scene designing. There is just not enough place to show the info in a pretty and organized way, and if it is not pretty and organized, I won't make it.


If you think I missed a setting or found out that you would like to adjust something which is not currently possible within the script's setup parts, than you can just ask me to make a setting for it for you.


I hope I covered most of the questions. If not, you know where to find me. 🙂
You have been perfect, how do you play RPG Maker in higher resolution (didnt know you could!)?

Also, how do you work the cursor, is there an extra script? (as by default I cant see anything in the project, do you have a mouse script source? 🙂 )

Found the stuff in the project (me being blind)

but how do I increase resolution
If you downloaded my demo (v1.1.7), you will see some custom scripts above the Triple Triad scripts.


The "YEA - Core Engine" has an option to resize your resolution and all the fixes you will need for it.


That one can not go higher than 640x480, because there is a limit built into the default engine.


But I guess if you were good with lower resolution, you will be fine with that too. 🙂


If you ever need higher resolution than 640x480, I suggest you look up the "high res dll" topic on this forum. It shouldn't be hard to find, pretty popular topic. 🙂


Be advised that your FPS will scale down depending on the resolution you are using. The higher the resolution, the lower the FPS becomes. This is not an issue on 640x480, but anything higher will have an impact.


The "MOG_Menu_Cursor" will add the animated menu cursor icon you see in the demo.


The script's instructions are on Portuguese, but the settings are easy to understand even like that.


Alternatively, you can use any other menu cursor script. I know Yanfly has one, and I am sure there are more scripts like that out there.


The "Menu Cursor Patch" fixes some update issues for the menu cursor script, and you can enable/disable the menu cursor for the scenes you want within that script too. I gave 2 very simple example how you can do that.


Ohh, and this patch snippet will only work with Moghunter's Menu Cursor script.


The menu cursor script needs the image for the cursor to work, the default one from Moghunter is provided in the demo.

Original thread: https://forums.rpgmakerweb.com/threads/triple-triad-ff8-mini-game.22285/