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.
Code:
#==============================================================================
# TDS Random Monster Groups Formation
# Version: 1.2
# This script aliases the call_battle method in Scene Map
#==============================================================================
#------------------------------------------------------------------------------
# This script will make automatic groups from the troops that appear in the map
#==============================================================================
# Switch to activate and De activate the effect.
RANDOM_EFFECT_SWTICH = 50
#==============================================================================
# Intructions:
# To not use the effect of having random groups in battle simply switch on the
# RANDOM_EFFECT_SWTICH.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Battle Call
#--------------------------------------------------------------------------
alias tds_random_monster_groups_map_call_battle call_battle
def call_battle
tds_random_monster_groups_map_call_battle
if $game_switches[RANDOM_EFFECT_SWTICH ] == false
if $game_player.encounter_count != 0 and $game_map.encounter_list != [] and
$game_system.map_interpreter.running? == false
# Makes a variable to grab a monster ID from the monster list.
group_id_one = rand($game_map.encounter_list.size)
# Makes the variable troop_id be the same ID as group_id_one this will
# Randomize each choice to a certain monster group.
troop_id = $game_map.encounter_list[group_id_one]
# Makes the troop ID from the encounter list.
group = rand($game_map.encounter_list.size)
# Takes a random troop ID from variable variable above
random_troop_id = $game_map.encounter_list[group]
# Makes the current troop ID from the variable Above
$game_temp.battle_troop_id = random_troop_id
# Makes the variable troop the same as the current troop ID so I can
# modify it from it.
if $game_temp.battle_troop_id != nil
troop = $data_troops[$game_temp.battle_troop_id]
# Makes a random number from size of the battle troop
@random_effect = rand(troop.members.length)
for x in 0...troop.members.length
# Choose a random monster from the group and gives it the ID of a random
# Monster from a random index chosen by the troop_id variables.
troop.members[@random_effect].enemy_id = $data_troops[troop_id].members[rand(2)].enemy_id
end
end
end
end
end
end