Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=======================================================================
- # ** Random Encounter Control
- # by Valentine
- # Credits: Jet , Valentine
- #-----------------------------------------------------------------------
- # Dieses Script regelt die Random Encounter
- # der Map und Regio-Einstellung.
- # Switch An: Keine zufälligen Gegner
- #=======================================================================
- class Game_Player < Game_Character
- def make_encounter_troop_id
- encounter_list = []
- weight_sum = 0
- $game_map.encounter_list.each do |encounter|
- next unless encounter_ok?(encounter)
- if $game_switches[27] == false # Switch ID Regio
- encounter_list.push(encounter)
- end
- weight_sum += encounter.weight
- end
- if weight_sum > 0
- value = rand(weight_sum)
- encounter_list.each do |encounter|
- value -= encounter.weight
- return encounter.troop_id if value < 0
- end
- end
- return 0
- end
- end
- #=======================================================================
- module AreaCondition
- AREA_SWITCH = 27 # Switch ID Map
- end
- class RPG::Map
- alias val_encounter_list encounter_list unless $@
- def encounter_list(*args, &block)
- if $game_switches[AreaCondition::AREA_SWITCH]
- return []
- else
- val_encounter_list(*args, &block)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement