还是不大明白怎么取消生命体的主动攻击
RT另,问下,羊的位置交换能帮主人挡攻击么? 我怎么觉得不行? alt+t 那样的话,叫他攻击之后貌似又变成主动的了……………… alt+t是切换攻击和不攻击的 -------------------------------------------
-- 攻击型态选择(以生命体类型为条件) GetMyEnemy
-------------------------------------------
function GetMyEnemy (myid)
local result = 0
local type = GetV (V_HOMUNTYPE,myid)
if (type == LIF or type == LIF_H or type == AMISTR or type == AMISTR_H) then
result = GetMyEnemy[color=red]A[/color] (myid)
elseif (type == FILIR or type == FILIR_H or type == VANILMIRTH or type == VANILMIRTH_H) then
result = GetMyEnemy[color=red]A[/color] (myid)
end
return result
end
-------------------------------------------
-- 非主动攻击型 GetMyEnemyA
-------------------------------------------
function GetMyEnemyA (myid)
local result = 0
local owner = GetV (V_OWNER,myid)
local actors = GetActors ()
local enemys = {}
local index = 1
local target
for i,v in ipairs(actors) do
if (v ~= owner and v ~= myid) then
target = GetV (V_TARGET,v)
if (target == myid) then
enemys[index] = v
index = index+1
end
end
end
local min_dis = 100
local dis
for i,v in ipairs(enemys) do
dis = GetDistance2 (myid,v)
if (dis < min_dis) then
result = v
min_dis = dis
end
end
return result
end
--]]
-------------------------------------------
-- 主动攻击型 GetMyEnemyB
-------------------------------------------
function GetMyEnemy (myid)
local result = 0
local owner = GetV (V_OWNER,myid)
local actors = GetActors ()
local enemys = {}
local index = 1
local type
for i,v in ipairs(actors) do
if (v ~= owner and v ~= myid) then
-- 这里可以插入判断怪物属性的程式
if (1 == IsMonster(v)) then
enemys[index] = v
index = index+1
end
end
end
local min_dis = 100
local dis
for i,v in ipairs(enemys) do
dis = GetDistance2 (myid,v)
if (dis < min_dis) then
result = v
min_dis = dis
end
end
return result
end
进游戏以后 打/hoai
PS:红字部分 我是准备所有生命体 都是被动的
这样做对不对 请高手赐教
[[i] 本帖最后由 WAKATA 于 2006-1-10 22:28 编辑 [/i]]
页:
[1]