ホムが敵追撃時に敵に重ならないようにする
注意:処理が重くなったり予期せぬ動作をする場合があるかもしれません
注意2:必ずバックアップを取ってから追加してください
USER_AIフォルダにあるAI.luaの修正
ホムの属性を保存するグローバル変数
を検索、その下に羅列されている行に以下を割り込ませる
MyDestXX = 0 -- ★目的位置 x座標+補正用
MyDestYY = 0 -- ★目的位置 y座標+補正用
次に
-- if (MyDestX ~= x or MyDestY ~= y) then
を検索し、その真下に
local xx,yy = GetV (V_POSITION,MyID) -- ★自分のホムの位置を取得
を追加して
追加した一行下にある
MyDestX, MyDestY = GetV (V_POSITION,MyEnemy); -- 敵の位置をホムの目的位置に設定し
の真下に以下を追加
if (xx < x) then -- ★敵の位置に重ならないようにする
MyDestXX = MyDestX - 1
if (yy < y) then
MyDestYY = MyDestY - 1
elseif (yy > y) then
MyDestYY = MyDestY + 1
elseif (yy == y) then
MyDestYY = MyDestY
end
elseif (xx > x) then
MyDestXX = MyDestX + 1
if (yy < y) then
MyDestYY = MyDestY - 1
elseif (yy > y) then
MyDestYY = MyDestY + 1
elseif (yy == y) then
MyDestYY = MyDestY
end
elseif (xx == x) then
MyDestXX = MyDestX
if (yy < y) then
MyDestYY = MyDestY - 1
elseif (yy > y) then
MyDestYY = MyDestY + 1
elseif (yy == y) then
MyDestYY = MyDestY
end
end -- ★ここまで
最後に上記を追加したすぐ下にある
Move (MyID,MyDestX,MyDestY)
を
Move (MyID,MyDestXX,MyDestYY)
に変更
最終更新:2006年10月24日 03:39