イベントどうしの座標取得からの接触判定という内容になっています。(バグチェックは全くしてません)
改変は可能ですので、ご自由に使われてください。配布でもクレジットには明記してくださいね。
素材単体としての販売はだめですが、暗号化されたゲームであれば商用可能です。





コード: 全て選択
#===============================================================================
# 戦略型ゲーム制作補助スクリプト Ver.1.0a(2016/08/27) by ONOZUKA
#===============================================================================
# 利用規約:クレジットに制作者名を明記してください。改変可能。
# 初心者が作ったものですので改変する知識がある方がご使用ください。
#===============================================================================
Game_Interpreter
def attack_manager #イベントスクリプトでの呼び出しコマンド
#===============================================================================
# 設定部分
$rts01 = [1,2,3] #敵トループ判定数値格納変数
$rts02 = [1,2,3] #味方イベントIDの指定
$rts03 = [1,2,3,4,5,6,7,8,9] #敵方イベントIDの指定
$rts04 = [1,2,3,4,5,6,7,8,9] #敵トループIDの指定
#===============================================================================
# 設定部分 記述説明:[拠点のX座標,拠点のY座標,"拠点の名前"]
$cps01 = [1,1,"A"]
$cps02 = [1,1,"B"]
$cps03 = [1,1,"C"]
$cps04 = [1,1,"D"]
$cps05 = [1,1,"E"]
$cps06 = [1,1,"F"]
$cps07 = [1,1,"G"]
$cps08 = [1,1,"H"]
$cps09 = [1,1,"I"]
#===============================================================================
# 判定変数の代入
$var01 = $rts01[0]
$var02 = $rts01[1]
$var03 = $rts01[2]
#===============================================================================
# 味方イベントIDの代入
$pid01 = $rts02[0]
$pid02 = $rts02[1]
$pid03 = $rts03[2]
#===============================================================================
# 敵イベントIDの代入
$eid01 = $rts03[0]
$eid02 = $rts03[1]
$eid03 = $rts03[2]
$eid04 = $rts03[3]
$eid05 = $rts03[4]
$eid06 = $rts03[5]
$eid07 = $rts03[6]
$eid08 = $rts03[7]
$eid09 = $rts03[8]
#===============================================================================
# 拠点情報のX座標とY座標の取得
$cxy01 = $cps01.pop
$cxy02 = $cps02.pop
$cxy03 = $cps03.pop
$cxy04 = $cps05.pop
$cxy06 = $cps06.pop
$cxy07 = $cps07.pop
$cxy08 = $cps08.pop
$cxy09 = $cps09.pop
#===============================================================================
# 味方イベントのX座標とY座標の取得
$pxp01 = $game_map.events[$pid01].x
$pxp02 = $game_map.events[$pid02].x
$pxp03 = $game_map.events[$pid03].x
$pyp01 = $game_map.events[$pid01].y
$pyp02 = $game_map.events[$pid02].y
$pyp03 = $game_map.events[$pid03].y
#===============================================================================
# 敵イベントのX座標とY座標の取得
$eyp01 = $game_map.events[$eid01].y
$eyp02 = $game_map.events[$eid02].y
$eyp03 = $game_map.events[$eid03].y
$eyp04 = $game_map.events[$eid04].y
$eyp05 = $game_map.events[$eid05].y
$eyp06 = $game_map.events[$eid06].y
$eyp07 = $game_map.events[$eid07].y
$eyp08 = $game_map.events[$eid08].y
$eyp09 = $game_map.events[$eid09].y
#===============================================================================
# 味方、敵、カーソルのX座標とY座標の取得
$pxy01 = [$pxp01,$pyp01]
$pxy02 = [$pxp02,$pyp02]
$pxy03 = [$pxp03,$pyp03]
$exy01 = [$exp01,$eyp01]
$exy02 = [$exp02,$eyp02]
$exy03 = [$exp03,$eyp03]
$exy04 = [$exp04,$eyp04]
$exy05 = [$exp05,$eyp05]
$exy06 = [$exp06,$eyp06]
$exy07 = [$exp07,$eyp07]
$exy08 = [$exp08,$eyp08]
$exy09 = [$exp09,$eyp09]
$cxy00 = [$game_player.x,$game_player.y]
#===============================================================================
# 検索用多次元配列生成
$pxy_z = [$pxy01,$pxy02,$pxy03]
$exy_z = [$exy01,$exy02,$exy03,$exy04,$exy05,$exy06,$exy07,$exy08,$exy09]
$cxy_z = [$cxy01,$cxy02,$cxy03,$cxy04,$cxy05,$cxy06,$cxy07,$cxy08,$cxy09]
#===============================================================================
# 敵トループ用処理
$pxy_a = []
$pxy_b = []
$pxy_c = []
$exy_a = []
$exy_b = []
$exy_c = []
$pxy_z,each_with_index{|n,i| $pxy_a << i if n == $pxy01}
$pxy_z,each_with_index{|n,i| $pxy_b << i if n == $pxy02}
$pxy_z,each_with_index{|n,i| $pxy_c << i if n == $pxy03}
$exy_z,each_with_index{|n,i| $exy_a << i if n == $pxy01}
$exy_z,each_with_index{|n,i| $exy_b << i if n == $pxy02}
$exy_z,each_with_index{|n,i| $exy_c << i if n == $pxy03}
#===============================================================================
# 戦闘イベント起動判定
unless $exy_a.length == 0 then
end
unless $exy_b.length == 0 then
Graphics.wait(3)
end
unless $exy_c.length == 0 then
Graphics.wait(6)
end
#===============================================================================
end #def attack_manager