用ABLUA重写监狱通关处 - 神奇石器时代技术研究交流
神奇石器技术研究交流网 - 业务联系QQ:420004208

用ABLUA重写监狱通关处

  • 内容
  • 相关

在所有石器时代SF里监狱(迷宫)里都是出去的NPC都是收走身上1/10的石币才让你出去,我记忆里官方的监狱都是需要仙人钓竿才能出去,于是乎用ablua写一个仿官方收仙人钓竿才能出去的NPC。

详细注释就不写了,毕竟在SA60学习了这么久应该都有所了解了。

--NPC对话事件(NPC索引)
function Talked(meindex, talkerindex , szMes, color )
	if npc.isFaceToFace(meindex, talkerindex) == 1 then
		token = "                 『" .. char.getChar(meindex, "名字") .. "』\n\n"
				 .. "    你想通过监狱吗?"
				 .. "\n\n    给我一个仙人钓竿才让你出去!"
		lssproto.windows(talkerindex, "对话框", "确定|取消", 1, char.getWorkInt( meindex, "对象"), token)
	end
end

--NPC窗口事件(NPC索引)
function WindowTalked ( meindex, talkerindex, seqno, select, data)
	if npc.isFaceToFace(meindex, talkerindex) == 1 then
		if seqno == 1 then
			if select == 1 then
				--这一句判断调用的是普通脚本FREE的条件
				if npc.Free(meindex, talkerindex, "ITEM="..needitem) == 1 then
					npc.DelItem(talkerindex, needitem.."*1")
					char.WarpToSpecificPoint(talkerindex, 3000, 94, 97)
				else
				    char.TalkToCli(talkerindex, meindex, "没有仙人钓竿,无法通过!", "红色")
				end
			end
		end
	end
end

function Create(name, metamo, floor, x, y, dir)
	npcindex = npc.CreateNpc(name, metamo, floor, x, y, dir)
	char.setFunctionPointer(npcindex, "对话事件", "Talked", "")
	char.setFunctionPointer(npcindex, "窗口事件", "WindowTalked", "")
end

function data()
	--所需要的物品(仙人钓竿)
	needitem = 2432
end

function main()
	data()
	Create("监狱的通关处", 16204, 117, 4, 5, 4)
end
效果图如下:

jail.gif

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

本文链接:用ABLUA重写监狱通关处 - http://sa60.com/post-222.html

本文标签:

用ABLUA重写监狱通关处