用ABLUA写一个查询抗性的NPC - 神奇石器发布网
石器时代发布网 - 神奇石器旗下石器私服技术交流网 - 业务联系QQ:420004208

用ABLUA写一个查询抗性的NPC

  • 内容
  • 相关

在石器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
下面我们来查看下效果:


magiccheck.png

版权声明:若无特殊注明,本文皆为《sa60》原创,转载请保留文章出处。

本文链接:用ABLUA写一个查询抗性的NPC - https://www.sa60.com/post-186.html

本文标签:

用ABLUA写一个查询抗性的NPC