First of all, I'd like to preface with the fact that I only started messing around with RGSS stuff yesterday on a whim, so my knowledge base is pretty low.
Out of curiosity, I was looking into ways to make something in RPG Maker with a fighting game combat system, ideally for a Mortal Kombat fangame or something. I found an old thread on here where a guy was talking about launching MUGEN in another window through RPG Maker for combat scenarios and thought it was a cool (though quite impractical) idea. And getting the actual game to launch and run smoothly alongside RPGM has worked like a charm thus far.
However, the poster in the thread was talking about how you can get MUGEN to make textlogs of your fights that keep track of who won, how much life the players had left, how much time on the clock, etc. So if you could get an RPGM script to read these logs, you could make it so it could store the data as variables and have it alter the game, IE: you lose a fight and it triggers a Game Over screen on RPG Maker.
Herein lies my problem. MUGEN has been making the logs just fine, but I haven't found a good way to have RPGM interpret them. I don't really have a mind for coding, but I've been trying my best with mixed results, and some of the problems I've been having are leaving me scratching my head. I've figured out ways to use scripts to read through MUGEN logs via events, but the problem occurs whenever I try to save the data from the logs as variables, whether they be variables in Ruby or in RPGM.
It's weird, because in troubleshooting these issues I've found that the data will be successfully loaded in as a variable, but the variable won't be processed correctly when I playtest the game. For example, the MUGEN logs store which team won the match as either a 1 or a 2, with 1 being the player's team and 2 being the CPU. So, I made a script that would read that number from the log and save it in the RPGM project as a variable. I had an event that would simply display a message with "\v[1]" to see if this worked correctly, and every time it would show the correct number. However, whenever I would make a test event that would use that variable in a conditional branch, it would always trigger the conditional even if it didn't meet the conditions. So if the conditional branch would trigger a Game Over when the variable is at 2, it would always trigger even if the variable was at 1. Switches have yielded similar issues, where once the switch has been triggered either on or off by the script using the log file it always acts as if the conditions are being met irregardless of the current status of the switch.
I'm now trying to achieve a similar goal exclusively through scripting, but I'm having the same sort of issue. Here's what I have right now (which straight up doesn't work since I'm a newbie):
I feel like this is closer to working as it's significantly less convoluted than what I've tried before, but even when the "p wl" line reads out as a 1 the script still goes ahead and triggers the game over. So I don't really know what I'm missing at this point, but that's most likely my inexperience as a coder speaking.
Are there any scripts out there that can do what I'm trying to do in a *ahem* idiotproof way? Or, better yet, how can I fix my code to make it not suck? Any help would be much appreciated.
Out of curiosity, I was looking into ways to make something in RPG Maker with a fighting game combat system, ideally for a Mortal Kombat fangame or something. I found an old thread on here where a guy was talking about launching MUGEN in another window through RPG Maker for combat scenarios and thought it was a cool (though quite impractical) idea. And getting the actual game to launch and run smoothly alongside RPGM has worked like a charm thus far.
However, the poster in the thread was talking about how you can get MUGEN to make textlogs of your fights that keep track of who won, how much life the players had left, how much time on the clock, etc. So if you could get an RPGM script to read these logs, you could make it so it could store the data as variables and have it alter the game, IE: you lose a fight and it triggers a Game Over screen on RPG Maker.
Herein lies my problem. MUGEN has been making the logs just fine, but I haven't found a good way to have RPGM interpret them. I don't really have a mind for coding, but I've been trying my best with mixed results, and some of the problems I've been having are leaving me scratching my head. I've figured out ways to use scripts to read through MUGEN logs via events, but the problem occurs whenever I try to save the data from the logs as variables, whether they be variables in Ruby or in RPGM.
It's weird, because in troubleshooting these issues I've found that the data will be successfully loaded in as a variable, but the variable won't be processed correctly when I playtest the game. For example, the MUGEN logs store which team won the match as either a 1 or a 2, with 1 being the player's team and 2 being the CPU. So, I made a script that would read that number from the log and save it in the RPGM project as a variable. I had an event that would simply display a message with "\v[1]" to see if this worked correctly, and every time it would show the correct number. However, whenever I would make a test event that would use that variable in a conditional branch, it would always trigger the conditional even if it didn't meet the conditions. So if the conditional branch would trigger a Game Over when the variable is at 2, it would always trigger even if the variable was at 1. Switches have yielded similar issues, where once the switch has been triggered either on or off by the script using the log file it always acts as if the conditions are being met irregardless of the current status of the switch.
I'm now trying to achieve a similar goal exclusively through scripting, but I'm having the same sort of issue. Here's what I have right now (which straight up doesn't work since I'm a newbie):
Code:
lines = File.readlines("logs/1.log")
wl = lines[7]
wl = wl[14..-2]
p wl
if wl == 2
SceneManager.call(Scene_Gameover)
end
I feel like this is closer to working as it's significantly less convoluted than what I've tried before, but even when the "p wl" line reads out as a 1 the script still goes ahead and triggers the game over. So I don't really know what I'm missing at this point, but that's most likely my inexperience as a coder speaking.
Are there any scripts out there that can do what I'm trying to do in a *ahem* idiotproof way? Or, better yet, how can I fix my code to make it not suck? Any help would be much appreciated.