Skip to content

Instantly share code, notes, and snippets.

@cacao-soft
Created February 12, 2021 15:40
Show Gist options
  • Save cacao-soft/9856706df9a3d2938c02097f26a9e509 to your computer and use it in GitHub Desktop.
Save cacao-soft/9856706df9a3d2938c02097f26a9e509 to your computer and use it in GitHub Desktop.
RGSS3 エンカウントリスト動的追加
# エンカウントリストに追加
#
# イベントコマンド「スクリプト」
# $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
@cacao-soft
Copy link
Author

cacao-soft commented Feb 12, 2021

自動実行のイベントで追加する。

SS2102133159748

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment