• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Well... i have dungeon script and i need NPC.

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello.
I have custom dungeon script like world of warcraft but... i need one npc.

TFS 0.3.5pl1

If i complete the dungeon i go to room, and there will be npc:
- hi
- Welcome. Well... you pass the dangerous dungeon! Congratulations. I have a {reward} for you.
- reward
"There npc gives random 1-20 items (random because u can do dungeon unlimited times xd" and "teleports player to X,y,z"

Anyone can make it ? ;d
 
Ok, try:
data/npc/scripts/mama.lua
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg) end
function onThink()					npcHandler:onThink() end

local items = {
{1,xxxx,1}, ----- {random, itemID, ammount}
{2,xxxx,1},
{3,xxxx,1},
{4,xxxx,1},
{5,xxxx,1},
{6,xxxx,1},
{7,xxxx,1},
{8,xxxx,1},
{9,xxxx,1},
{10,xxxx,1}
}

function creatureSayCallback(cid, type, msg)
if msgcontains(msg, 'reward') then
   for i = 1, #items do
       if (math.random(1,10) == items[i][1]) then
          doPlayerAddItem(cid,items[i][2],items[i][3])
          npcHandler:say('You have been rewarded with a ' .. getItemName(items[i][2]) .. '!')
          doTeleportThing(cid,{x=EDIT, y=EDIT, z=EDIT})
       end
   end
end
return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

data/npc/mama.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mama" script="data/npc/scripts/mama.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="146" head="55" body="115" legs="78" feet="114" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME| you can have a {reward}."/>
		<parameter key="message_farewell" value="Byee!"/>
	</parameters>
</npc>
 
Last edited:
Back
Top