在石器SF里可以查看人物的抗性但没有宠物抗性,所以我们就来写一个人物和宠物抗性的查询NPC。
下面我直接贴全套代码:
function Talked(meindex, talkerindex , szMes, color ) if npc.isFaceToFace(meindex, talkerindex) == 1 then token = "" token = token .. string.format("玩家名字:%-16s地抗性:%-8d水抗性:%-8d\n 火抗性:%-8d风抗性:%-8d\n\n", char.getChar(talkerindex, "名字"), char.getInt(talkerindex, "地魔法抗性"), char.getInt(talkerindex, "水魔法抗性"), char.getInt(talkerindex, "火魔法抗性"), char.getInt(talkerindex, "风魔法抗性")) for i=0,4 do petindex = char.getCharPet(talkerindex, i) if i == 0 then num = "一" elseif i == 1 then num = "二" elseif i == 2 then num = "三" elseif i == 3 then num = "四" elseif i == 4 then num = "五" end if char.check(petindex) == 1 then token = token .. string.format("宠物栏%s:%-16s地抗性:%-8d水抗性:%-8d\n 火抗性:%-8d风抗性:%-8d\n\n", num, char.getChar(petindex, "名字"), char.getInt(petindex, "地魔法抗性"), char.getInt(petindex, "水魔法抗性"), char.getInt(petindex, "火魔法抗性"), char.getInt(petindex, "风魔法抗性")) else token = token .. string.format("宠物栏%s:%-16s地抗性:%-8d水抗性:%-8d\n 火抗性:%-8d风抗性:%-8d\n\n", num, "无宠物", -1, -1, -1, -1) end end lssproto.windows(talkerindex, "宽对话框", "确定", 1, char.getWorkInt( meindex, "对象"), token) end end function Create() npcindex = npc.CreateNpc("魔法抗性查询", 100000, 2000, 60, 78, 4) char.setFunctionPointer(npcindex, "对话事件", "Talked", "") end function main() Create() end
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。