Update 2: I think I'm done? At least done enough to let others try it as a plugin. Never made a plugin before. Never made anything before really in this aspect so this will be interesting. Let me know how it goes. The arrow is a little abrupt when it starts moving but not so much so that its unbearable. Feedback and constructive criticism is appreciated. Been a long time since I've shared with Google Drive so let me know if something is wrong with the link. I'll try again.
Forge Minigame Plugin Download
UPDATE 1.5: Found Interpolation movement like 10 minutes after updating this but it's 4am. I need to sleep. FL was kind enough to provide me with some resources to learn how to use ruby and i was able to get the minigame much closer to my desired point. The only issue that remains is that it misses button presses quite a bit. I have plenty of mid loop checks but i think the way I scripted it essentially made it a frame perfect input. Wasnt sure how else to get the arrow movement to be smooth. I'm not giving up. Help would be awesome but I'll crack this eventually.![[PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance [PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance](https://data.pokecommunity.com/attachments/87/87651-79f7d404599b1b4b700bc9ed24682fd2.jpg)
![[PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance [PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance](https://data.pokecommunity.com/attachments/87/87652-6e35820c5035ddd147920924b99c3b0b.jpg)
![[PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance [PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance](https://data.pokecommunity.com/attachments/87/87653-78e90e6dfcd41b2cd6066f51c4b24dfc.jpg)
If your just looking to use it and are pretty new like me, these pictures need to go into your game file under Graphics/Pictures. In the main script of the game itself, I made a new tab in the minigame section and put all of this in there. I named the tab "forgeMinigame" and call it at an event with "pbforgeMinigame".
def forgeMinigame
# Initialize Variables
$game_variables[26] = 25 # Temperature Level (Starts at 50)
$game_variables[27] = 0 # Hammer Hits Counter (Starts at 0)
pbMessage("You place the materials into the forge. The metal begins to heat up!")
# Heating Phase
loop do
choice = pbMessage("Adjust the temperature:", ["Increase Heat", "Decrease Heat", "Proceed to Hammering"])
case choice
when 0 # Increase Heat
$game_variables[26] += rand(8..15) # Raise temperature randomly
pbMessage("You add fuel. The forge burns hotter!")
when 1 # Decrease Heat
$game_variables[26] -= rand(8..15) # Lower temperature randomly
pbMessage("You cool the forge slightly.")
when 2 # Proceed to Hammering
# Check if temperature is good before moving to hammering
if $game_variables[26] < 60
pbMessage("The metal is too cold! It will be brittle...")
next # This will loop back to the temperature adjustment part
elsif $game_variables[26] > 70
pbMessage("The metal is overheated! It might be too soft...")
next # This will loop back to the temperature adjustment part
else
pbMessage("The metal is glowing perfectly. Time to hammer it!")
break # This breaks the loop and moves on to the hammering phase
end
end
end
# Initialize QTE Variables
$game_variables[28] = 192 # Sweet Spot Y
$game_variables[29] = rand(208..304) # Sweet Spot X (Initial Random)
$game_variables[30] = 176 # Arrow X Start
$game_variables[31] = 192 # Arrow Y (Fixed)
$game_variables[32] = 3 # Arrow Speed (Starts at 3)
total_score = 0 # Variable to track total score over 3 attempts
tries = 0
direction = 1 # 1 for right, -1 for left
# Show Static Pictures
$game_screen.pictures[1].show("QTEbar", 1, 256, 192, 100, 100, 255, 0)
$game_screen.pictures[2].show("QTEsweetspot", 1, $game_variables[29], 192, 100, 100, 255, 0)
$game_screen.pictures[3].show("QTEarrow", 1, $game_variables[30], 168, 100, 100, 255, 0)
# Small initial wait to allow the arrow to show
Graphics.update
Input.update
pbMessage("Press 'Accept' when arrow is above green.")
# Start Attempt Loop
while tries < 3
# Adjust arrow speed based on attempt number
case tries
when 0
$game_variables[32] = 3 # Keep first attempt's sweet spot fixed
when 1
$game_variables[32] = 5
$game_variables[29] = rand(208..304) # New sweet spot for second attempt
$game_screen.pictures[2].show("QTEsweetspot", 1, $game_variables[29], 192, 100, 100, 255, 0)
when 2
$game_variables[32] = 7
$game_variables[29] = rand(208..304) # New sweet spot for third attempt
$game_screen.pictures[2].show("QTEsweetspot", 1, $game_variables[29], 192, 100, 100, 255, 0)
end
# Arrow Movement Loop (runs until player presses C)
loop do
# **Buffered Input Check**
Input.update
if Input.trigger?(Input::C)
break
end
# Update Arrow Position with smoother movement
$game_variables[30] += $game_variables[32] * direction
# Reverse direction at edges
if $game_variables[30] >= 336
$game_variables[30] = 336
direction = -1
elsif $game_variables[30] <= 176
$game_variables[30] = 176
direction = 1
end
# Re-draw Arrow at New Position
$game_screen.pictures[3].show("QTEarrow", 1, $game_variables[30], 168, 100, 100, 255, 0)
# Ensure the screen updates and handles input without freezing
Graphics.update
Input.update
# **More Frequent Mid-Frame Checks**
if Input.trigger?(Input::C)
break
end
# Adjust wait time based on speed
if $game_variables[32] == 3
pbWait(0.005) # Faster frame update for speed 3
else
pbWait(0.01) # Normal speed for other attempts
end
end
# **Process Player's Input**
hit_distance = ($game_variables[30] - $game_variables[29]).abs
if hit_distance <= 8
total_score += 2
pbMessage("Great swing!")
elsif hit_distance <= 32
total_score += 1
pbMessage("Good swing!")
else
pbMessage("Poor swing!")
end
# Increment attempt counter
tries += 1
# Short buffer to prevent input spam
pbWait(0.15)
# Message between attempts
if tries < 3
pbMessage("Attempt #{tries} complete! Speed will now increase.")
end
end
# Determine Outcome based on total_score
if total_score >= 6
pbMessage("Perfect! You scored high!")
elsif total_score >= 4
pbMessage("Good effort! You did well!")
elsif total_score >= 2
pbMessage("Not bad! You missed a few.")
else
pbMessage("You missed all the hits.")
end
# Hide Pictures Properly
$game_screen.pictures[1].erase
$game_screen.pictures[2].erase
$game_screen.pictures[3].erase
end
I made my Steel type Gym require a little mining to forge their own badge. The mining part wasn't too hard to figure out, but I admittedly used ChatGPT to help me make the forging part. After a bit of back and forth, I got it to work. Sort of and much to my surprise. The hammering part feels like a sham, and I don't understand what I'm looking at well enough to know better. It tells you to push the button at the right time, but it feels like it's just picking a random number and basing the success on that. Button mashing does seem to yield more success on average though which is why I am so unsure. Is the window just tiny? There's also nothing on screen to indicate anything at all. Just the text box until it I press the button, and it tell me if it succeeded or not. Pretty boring. Ideally, I would like to have a bar pop up with an arrow that needs stopped in the sweet spot. Not very original but is that even possible to do in Essentials 21.1? I'm not asking for anyone to do it for me, but I can't find a definitive answer online. If it is possible, how difficult would it be for someone with little experience to do? Is there a link someone could provide to point me in the right direction? I appreciate the help and the pointers. Thank you. Sorry for all the questions.
def forgeMinigame
# Initialize Variables
$game_variables[26] = 25 # Temperature Level (Starts at 25)
$game_variables[27] = 0 # Hammer Hits Counter (Starts at 0)
pbMessage("You place the materials into the forge. The metal begins to heat up!")
# Heating Phase
loop do
choice = pbMessage("Adjust the temperature:", ["Increase Heat", "Decrease Heat", "Proceed to Hammering"])
case choice
when 0 # Increase Heat
$game_variables[26] += rand(8..15) # Raise temperature randomly
pbMessage("You add fuel. The forge burns hotter!")
when 1 # Decrease Heat
$game_variables[26] -= rand(8..15) # Lower temperature randomly
pbMessage("You cool the forge slightly.")
when 2 # Proceed to Hammering
# Check if temperature is good before moving to hammering
if $game_variables[26] < 60
pbMessage("The metal is too cold! It will be brittle...")
next # This will loop back to the temperature adjustment part
elsif $game_variables[26] > 70
pbMessage("The metal is overheated! It might be too soft...")
next # This will loop back to the temperature adjustment part
else
pbMessage("The metal is glowing perfectly. Time to hammer it!")
break # This breaks the loop and moves on to the hammering phase
end
end
end
# Hammering Phase (3 Successful Hits Needed)
3.times do
pbMessage("Press Accept at the right moment to hammer!")
# Simulate a random timing for the right moment
wait_time = 20 + rand(10)
time_counter = 0
# Wait for the right timing while checking for input
loop do
break if time_counter >= wait_time || Input.trigger?(Input::C) # C is the Accept key
Graphics.update
Input.update
time_counter += 1
end
# If the button was pressed at the right moment (within a certain time window)
if time_counter <= wait_time && Input.trigger?(Input::C)
# 70% chance of success
if rand(10) > 3
$game_variables[27] += 1
pbMessage("Clang! A perfect hit!")
else
pbMessage("You missed the timing!")
end
else
pbMessage("You missed the timing!")
end
end
# Check Hammering Success
if $game_variables[27] >= 2
pbMessage("You shape the metal perfectly into a badge!")
else
pbMessage("The badge is a bit misshapen... but it still works!")
end
pbMessage("You have forged your own Gym Badge!")
end
[/ISPOILER]
Forge Minigame Plugin Download
UPDATE 1.5: Found Interpolation movement like 10 minutes after updating this but it's 4am. I need to sleep. FL was kind enough to provide me with some resources to learn how to use ruby and i was able to get the minigame much closer to my desired point. The only issue that remains is that it misses button presses quite a bit. I have plenty of mid loop checks but i think the way I scripted it essentially made it a frame perfect input. Wasnt sure how else to get the arrow movement to be smooth. I'm not giving up. Help would be awesome but I'll crack this eventually.
![[PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance [PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance](https://data.pokecommunity.com/attachments/87/87651-79f7d404599b1b4b700bc9ed24682fd2.jpg)
![[PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance [PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance](https://data.pokecommunity.com/attachments/87/87652-6e35820c5035ddd147920924b99c3b0b.jpg)
![[PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance [PokeCommunity.com] Update 2: 21.1 Forge Minigame Assistance](https://data.pokecommunity.com/attachments/87/87653-78e90e6dfcd41b2cd6066f51c4b24dfc.jpg)
If your just looking to use it and are pretty new like me, these pictures need to go into your game file under Graphics/Pictures. In the main script of the game itself, I made a new tab in the minigame section and put all of this in there. I named the tab "forgeMinigame" and call it at an event with "pbforgeMinigame".
Spoiler: Updated Script. 2.0 i guess?
def forgeMinigame
# Initialize Variables
$game_variables[26] = 25 # Temperature Level (Starts at 50)
$game_variables[27] = 0 # Hammer Hits Counter (Starts at 0)
pbMessage("You place the materials into the forge. The metal begins to heat up!")
# Heating Phase
loop do
choice = pbMessage("Adjust the temperature:", ["Increase Heat", "Decrease Heat", "Proceed to Hammering"])
case choice
when 0 # Increase Heat
$game_variables[26] += rand(8..15) # Raise temperature randomly
pbMessage("You add fuel. The forge burns hotter!")
when 1 # Decrease Heat
$game_variables[26] -= rand(8..15) # Lower temperature randomly
pbMessage("You cool the forge slightly.")
when 2 # Proceed to Hammering
# Check if temperature is good before moving to hammering
if $game_variables[26] < 60
pbMessage("The metal is too cold! It will be brittle...")
next # This will loop back to the temperature adjustment part
elsif $game_variables[26] > 70
pbMessage("The metal is overheated! It might be too soft...")
next # This will loop back to the temperature adjustment part
else
pbMessage("The metal is glowing perfectly. Time to hammer it!")
break # This breaks the loop and moves on to the hammering phase
end
end
end
# Initialize QTE Variables
$game_variables[28] = 192 # Sweet Spot Y
$game_variables[29] = rand(208..304) # Sweet Spot X (Initial Random)
$game_variables[30] = 176 # Arrow X Start
$game_variables[31] = 192 # Arrow Y (Fixed)
$game_variables[32] = 3 # Arrow Speed (Starts at 3)
total_score = 0 # Variable to track total score over 3 attempts
tries = 0
direction = 1 # 1 for right, -1 for left
# Show Static Pictures
$game_screen.pictures[1].show("QTEbar", 1, 256, 192, 100, 100, 255, 0)
$game_screen.pictures[2].show("QTEsweetspot", 1, $game_variables[29], 192, 100, 100, 255, 0)
$game_screen.pictures[3].show("QTEarrow", 1, $game_variables[30], 168, 100, 100, 255, 0)
# Small initial wait to allow the arrow to show
Graphics.update
Input.update
pbMessage("Press 'Accept' when arrow is above green.")
# Start Attempt Loop
while tries < 3
# Adjust arrow speed based on attempt number
case tries
when 0
$game_variables[32] = 3 # Keep first attempt's sweet spot fixed
when 1
$game_variables[32] = 5
$game_variables[29] = rand(208..304) # New sweet spot for second attempt
$game_screen.pictures[2].show("QTEsweetspot", 1, $game_variables[29], 192, 100, 100, 255, 0)
when 2
$game_variables[32] = 7
$game_variables[29] = rand(208..304) # New sweet spot for third attempt
$game_screen.pictures[2].show("QTEsweetspot", 1, $game_variables[29], 192, 100, 100, 255, 0)
end
# Arrow Movement Loop (runs until player presses C)
loop do
# **Buffered Input Check**
Input.update
if Input.trigger?(Input::C)
break
end
# Update Arrow Position with smoother movement
$game_variables[30] += $game_variables[32] * direction
# Reverse direction at edges
if $game_variables[30] >= 336
$game_variables[30] = 336
direction = -1
elsif $game_variables[30] <= 176
$game_variables[30] = 176
direction = 1
end
# Re-draw Arrow at New Position
$game_screen.pictures[3].show("QTEarrow", 1, $game_variables[30], 168, 100, 100, 255, 0)
# Ensure the screen updates and handles input without freezing
Graphics.update
Input.update
# **More Frequent Mid-Frame Checks**
if Input.trigger?(Input::C)
break
end
# Adjust wait time based on speed
if $game_variables[32] == 3
pbWait(0.005) # Faster frame update for speed 3
else
pbWait(0.01) # Normal speed for other attempts
end
end
# **Process Player's Input**
hit_distance = ($game_variables[30] - $game_variables[29]).abs
if hit_distance <= 8
total_score += 2
pbMessage("Great swing!")
elsif hit_distance <= 32
total_score += 1
pbMessage("Good swing!")
else
pbMessage("Poor swing!")
end
# Increment attempt counter
tries += 1
# Short buffer to prevent input spam
pbWait(0.15)
# Message between attempts
if tries < 3
pbMessage("Attempt #{tries} complete! Speed will now increase.")
end
end
# Determine Outcome based on total_score
if total_score >= 6
pbMessage("Perfect! You scored high!")
elsif total_score >= 4
pbMessage("Good effort! You did well!")
elsif total_score >= 2
pbMessage("Not bad! You missed a few.")
else
pbMessage("You missed all the hits.")
end
# Hide Pictures Properly
$game_screen.pictures[1].erase
$game_screen.pictures[2].erase
$game_screen.pictures[3].erase
end
I made my Steel type Gym require a little mining to forge their own badge. The mining part wasn't too hard to figure out, but I admittedly used ChatGPT to help me make the forging part. After a bit of back and forth, I got it to work. Sort of and much to my surprise. The hammering part feels like a sham, and I don't understand what I'm looking at well enough to know better. It tells you to push the button at the right time, but it feels like it's just picking a random number and basing the success on that. Button mashing does seem to yield more success on average though which is why I am so unsure. Is the window just tiny? There's also nothing on screen to indicate anything at all. Just the text box until it I press the button, and it tell me if it succeeded or not. Pretty boring. Ideally, I would like to have a bar pop up with an arrow that needs stopped in the sweet spot. Not very original but is that even possible to do in Essentials 21.1? I'm not asking for anyone to do it for me, but I can't find a definitive answer online. If it is possible, how difficult would it be for someone with little experience to do? Is there a link someone could provide to point me in the right direction? I appreciate the help and the pointers. Thank you. Sorry for all the questions.
Spoiler: Original Script
def forgeMinigame
# Initialize Variables
$game_variables[26] = 25 # Temperature Level (Starts at 25)
$game_variables[27] = 0 # Hammer Hits Counter (Starts at 0)
pbMessage("You place the materials into the forge. The metal begins to heat up!")
# Heating Phase
loop do
choice = pbMessage("Adjust the temperature:", ["Increase Heat", "Decrease Heat", "Proceed to Hammering"])
case choice
when 0 # Increase Heat
$game_variables[26] += rand(8..15) # Raise temperature randomly
pbMessage("You add fuel. The forge burns hotter!")
when 1 # Decrease Heat
$game_variables[26] -= rand(8..15) # Lower temperature randomly
pbMessage("You cool the forge slightly.")
when 2 # Proceed to Hammering
# Check if temperature is good before moving to hammering
if $game_variables[26] < 60
pbMessage("The metal is too cold! It will be brittle...")
next # This will loop back to the temperature adjustment part
elsif $game_variables[26] > 70
pbMessage("The metal is overheated! It might be too soft...")
next # This will loop back to the temperature adjustment part
else
pbMessage("The metal is glowing perfectly. Time to hammer it!")
break # This breaks the loop and moves on to the hammering phase
end
end
end
# Hammering Phase (3 Successful Hits Needed)
3.times do
pbMessage("Press Accept at the right moment to hammer!")
# Simulate a random timing for the right moment
wait_time = 20 + rand(10)
time_counter = 0
# Wait for the right timing while checking for input
loop do
break if time_counter >= wait_time || Input.trigger?(Input::C) # C is the Accept key
Graphics.update
Input.update
time_counter += 1
end
# If the button was pressed at the right moment (within a certain time window)
if time_counter <= wait_time && Input.trigger?(Input::C)
# 70% chance of success
if rand(10) > 3
$game_variables[27] += 1
pbMessage("Clang! A perfect hit!")
else
pbMessage("You missed the timing!")
end
else
pbMessage("You missed the timing!")
end
end
# Check Hammering Success
if $game_variables[27] >= 2
pbMessage("You shape the metal perfectly into a badge!")
else
pbMessage("The badge is a bit misshapen... but it still works!")
end
pbMessage("You have forged your own Gym Badge!")
end
[/ISPOILER]
Last edited: