This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
Well.... This isent that much, but this is my first ever venture into the world of Ruby.... So i wanted to share it, and get some opinions on where i should take this. anyways, heres what i edited-
Step 1
Go to Scene_Battle 2 and find "Def Phase_5" delete everything under there and put in this-
Code:
#--------------------------------------------------------------------------
# ● Phase 5(Battle end phase)
#--------------------------------------------------------------------------
def start_phase5
# Sets phase number
@phase = 5
# End battle bgm
$game_system.bgm_stop
#Play battle end BGM(Edit to your battle ending song)Put a # on the next line when using ME
Audio.bgm_play("Audio/BGM/Your battle ending")
#Play battle end ME(Default is commented out, remove the "#" for ME)
#$game_system.me_play($game_system.battle_end_me)
# Start reward totals
exp = 0
gold = 0
treasures = []
# Find enemy
for enemy in $game_troop.enemies
# Checks to see if enemy is hidden
unless enemy.hidden
# Finds enemies gold and exp gain
exp += enemy.exp
gold += enemy.gold
# Finds if you won a treasure
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Setting treasures
treasures = treasures[0..5]
# Find Exp won
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Find Gold won
$game_party.gain_gold(gold)
# Find Items and treasures won
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Show result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
#Sets up wait until battle can be exited
@phase5_wait_count = 1
end
#--------------------------------------------------------------------------
# ● Update Phase 5(Battle End Phase)
#--------------------------------------------------------------------------
def update_phase5
# Checks if wait between win and ability to end battle scene is up
if @phase5_wait_count > 0
# Checks if wait between win and ability to end battle scene is up
@phase5_wait_count -= 1
# Checks if wait between win and ability to end battle scene is up
if @phase5_wait_count == 0
# Shows Result window(set this to flase if using a custom level script)
@result_window.visible = true
# Turns of battle phases(keeps the battle from going on after you win)
$game_temp.battle_main_phase = false
# Refresh your status window(for level ups and such)
@status_window.refresh
end
return
end
# Waits for key press to end battle(Remove this if using a custom level up script)
if Input.trigger?(Input::C)
# Play Map bgm(upon exit from battle)
$game_system.bgm_play($game_temp.map_bgm)
# Stops battle end ME when Battle is exited(Default is commented out, to use ME just remove the "#")
#$game_system.me_stop
# End the Battle
battle_end(0)
end
end
end
Step 2
Go to Game_System and find
Code:
#--------------------------------------------------------------------------
# ● SE の停止
#--------------------------------------------------------------------------
def se_stop
Audio.se_stop
end
under that add this -
Code:
#--------------------------------------------------------------------------
# ● Stop ME
#--------------------------------------------------------------------------
def me_stop
Audio.me_stop
end
What it does is-
1.Allows you to exit a battle instantly, instead of having to wait a certain time (Default in xp is 20 frames)
2.Stops all music before the battle is exited, Thus allowing your me's or bgms to be as long as you want.
3.Allows the use of BGM's as well as ME's(This was becuase(and if you can help me please do), i couldent figure how to get the ME's to loop, but bgms loop perfect.
4.I made english comments, and heavily commented how to use my new stuff.
Its not hard to use, just folow what the script says. If you cant figure out how to use ME instead of bgm, just comment this line-Audio.bgm_play("Audio/BGM/Your battle ending") and remove the # from these 2- #$game_system.me_stop
and
#Play battle end ME(Default is commented out, remove the "#" for ME)
I dont need any credit for this, since its so small, but please dont flame me :crybaby: this is just my first try to script, and im still just learning.