Created
February 12, 2021 15:40
-
-
Save cacao-soft/9856706df9a3d2938c02097f26a9e509 to your computer and use it in GitHub Desktop.
RGSS3 エンカウントリスト動的追加
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# エンカウントリストに追加 | |
# | |
# イベントコマンド「スクリプト」 | |
# $game_map.add_encounter(グループID, 重み, リージョンIDの配列) | |
# $game_map.add_encounter(グループIDの配列, 重み, リージョンIDの配列) | |
# 重みを省略すると 10 、リージョンを省略すると 全体 | |
# | |
class Game_Map | |
#-------------------------------------------------------------------------- | |
# ● セットアップ | |
#-------------------------------------------------------------------------- | |
alias _cao_encount_setup setup | |
def setup(map_id) | |
_cao_encount_setup(map_id) | |
@encounter_list = @map.encounter_list.dup | |
end | |
#-------------------------------------------------------------------------- | |
# ● エンカウントリストに追加 | |
#-------------------------------------------------------------------------- | |
def add_encounter(troop_id, weight = 10, region_set = []) | |
[*troop_id].each do |id| | |
@encounter_list << RPG::Map::Encounter.new.tap do |e| | |
e.troop_id = id | |
e.weight = weight | |
e.region_set = region_set | |
end | |
end | |
self | |
end | |
attr_accessor :encounter_list | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
自動実行のイベントで追加する。