麦克雷 Mavom.cn

标题: 关于地图编辑器的一个问题,求大佬指教 [打印本页]

作者: WilliamCon    时间: 3 天前
标题: 关于地图编辑器的一个问题,求大佬指教
在discord那张图里面,有一个拿到 佑福便鞋 战斗中亡灵就不会复生的情况,但是实际玩起来有这个宝物还是没用,我用编辑器进入地图script里面找了一下相关代码
function UndeadFight(hero, ghost)
if IsHumanHero(hero) then
Hero=hero;
Ghost=ghost;
if Ghost=="ship1" then
ghosts_number=24;
StartCombat(hero, nil, 3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, '/Maps/SingleMissions/FirstMap/CombatScript2.xdb#xpointer(/Script)', "RemoveGhosts");
end;
if Ghost~="ship1" then
ghosts_number = GetObjectCreatures(ghost, CREATURE_GHOST);
if HasArtefact(hero, 68)==nil then
StartCombat(hero, nil, 3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, '/Maps/SingleMissions/FirstMap/CombatScript2.xdb#xpointer(/Script)', "RemoveGhosts");
end;
if HasArtefact(hero, 68) then
StartCombat(hero, nil, 3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, '/Maps/SingleMissions/FirstMap/CombatScript3.xdb#xpointer(/Script)', "RemoveGhosts");
end;
end;
else
return not nil;
end;
end;
function RemoveGhosts()
if IsHeroAlive(Hero)==true and Ghost~="ship1" then
RemoveObject(Ghost);
end;
if IsHeroAlive(Hero)==true and Ghost=="ship1" then
Trigger(OBJECT_TOUCH_TRIGGER, "ship1", nil);
GiveArtefact(Hero,68);
end;
end;
作者: WilliamCon    时间: 3 天前
我看了下这个LUA语言的逻辑,核心判断应该在这里
if HasArtefact(hero, 68)==nil then
StartCombat(hero, nil, 3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, '/Maps/SingleMissions/FirstMap/CombatScript2.xdb#xpointer(/Script)', "RemoveGhosts");
end;
if HasArtefact(hero, 68) then
StartCombat(hero, nil, 3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, CREATURE_GHOST, ghosts_number/3, '/Maps/SingleMissions/FirstMap/CombatScript3.xdb#xpointer(/Script)', "RemoveGhosts");
也就是说英雄有68号物品,那么战斗执行CombatScript3,判断为否的话,战斗执行CombatScript2,CombatScript2应该就是打死一次复活一次(通过在原位置添加一队同样数量的幽灵来实现应该),CombatScript3应该就是作者设计的本意,有佑福便鞋 战斗中亡灵就不会复生。
作者: WilliamCon    时间: 3 天前
那现在该怎么排查问题?
是         佑福便鞋 在3.1编号不等于 68?
还是说  这个if 的check在游戏中错误的没有被执行?
还是说   CombatScript3被调用失败?

(, 下载次数: 0) 还请大佬指教
作者: WilliamCon    时间: 3 天前
/Maps/SingleMissions/FirstMap/CombatScript2.xdb#xpointer(/Script)', "RemoveGhosts"   这个编辑器里面的script选项里面看的脚本,其中引用到CombatScript,这个请问在哪看啊
作者: WilliamCon    时间: 3 天前
终于找到源代码了,我对游戏理解出现了错误
的确是有 佑福便鞋 就会让怪物不能复活,但是!
这里面还有一个判断语句
CrType=GetCreatureType( creatureName );
kills=kills+1;
if (kills<=3)
意思是说他得先复活三次,然后才停止复活。地图作者的表述让人以为是一次都不复活,也即kills<=1,这种说话不清的太容易让人误解了,总算找到战斗脚本源代码搞清楚了游戏内机制问题
(, 下载次数: 0)
-------------------------------
function Start()
EnableAutoFinish(nil);
EnableCinematicCamera(not nil);
kills=0;
creatures=GetDefenderCreatures();
for i, c in creatures do
Number=GetCreatureNumber(c);
end;
end;
function DefenderCreatureDeath(creatureName)
CrType=GetCreatureType( creatureName );
kills=kills+1;
if (kills<=3) then
x,y=GetUnitPosition(creatureName);
sleep(1);
AddCreature(DEFENDER, CrType,Number, x, y);
end;
local defenders = GetDefenderCreatures();
if (length(defenders) == 0) then Finish(ATTACKER) end;
end;
function AttackerCreatureDeath()
local attackers = GetAttackerCreatures();
if (length(attackers) == 0) then Finish(DEFENDER) end;
end




欢迎光临 麦克雷 Mavom.cn (https://www.mavom.cn/) Powered by Discuz! X3.5