sircurse
Curseria RTG - TFS 1.1
I finish this code, there is the npc script working 100%.
The function of this npc is give to the player the key storage that allows him talk with one djinn only, he need choose what of the 2 djinns he want be able to negotiate.
Tested and working =)
NPC
Script:
The function of this npc is give to the player the key storage that allows him talk with one djinn only, he need choose what of the 2 djinns he want be able to negotiate.
Tested and working =)
NPC
PHP:
<?xml version="1.0"?>
<npc name="Emperor Orc" lookdir="2" script="data/npc/scripts/emperor_orc.lua" autowalk="2" floorchange="0" access="5" level="1" maglevel="1">
<health now="1" max="1"/>
<look type="19" head="20" body="30" legs="40" feet="50"/>
<parameters>
<parameter key="message_farewell" value="..." />
<parameter key="message_walkaway" value="..." />
</parameters>
</npc>
Script:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function greetCallback(cid)
if(getPlayerStorageValue(cid, 9965) == -1 and getPlayerStorageValue(cid, 9964) == -1) then
if(getPlayerStorageValue(cid, 9966) == -1) then
pos1 = {x=180, y=364, z=9}
pos2 = {x=176, y=365, z=9}
pos3 = {x=177, y=369, z=9}
pos4 = {x=178, y=370, z=9}
pos5 = {x=180, y=376, z=9}
pos6 = {x=181, y=375, z=9}
pos7 = {x=190, y=374, z=9}
pos8 = {x=185, y=366, z=9}
pos9 = {x=186, y=367, z=9}
pos10 = {x=187, y=368, z=9}
pos11 = {x=188, y=371, z=9}
pos12 = {x=189, y=372, z=9}
pos13 = {x=175, y=374, z=9}
pos14 = {x=191, y=376, z=9}
pos15 = {x=182, y=365, z=9}
pos16 = {x=190, y=370, z=9}
pos17 = {x=176, y=369, z=9}
pos18 = {x=178, y=375, z=9}
pos19 = {x=177, y=376, z=9}
pos20 = {x=181, y=370, z=9}
pos21 = {x=189, y=369, z=9}
pos22 = {x=188, y=368, z=9}
pos23 = {x=183, y=367, z=9}
pos24 = {x=184, y=370, z=9}
pos25 = {x=185, y=371, z=9}
pos26 = {x=179, y=373, z=9}
pos27 = {x=191, y=376, z=9}
doSummonCreature("Orc Warlord", pos1)
doSummonCreature("Orc Warlord", pos2)
doSummonCreature("Orc Warlord", pos3)
doSummonCreature("Orc Warlord", pos4)
doSummonCreature("Orc Warlord", pos5)
doSummonCreature("Orc Berserker", pos6)
doSummonCreature("Orc Berserker", pos7)
doSummonCreature("Orc Berserker", pos8)
doSummonCreature("Orc Berserker", pos9)
doSummonCreature("Orc Berserker", pos10)
doSummonCreature("Orc Berserker", pos11)
doSummonCreature("Orc Berserker", pos12)
doSummonCreature("Orc Rider", pos13)
doSummonCreature("Orc Rider", pos14)
doSummonCreature("Orc Rider", pos15)
doSummonCreature("Orc Rider", pos16)
doSummonCreature("Orc Rider", pos17)
doSummonCreature("Orc Leader", pos18)
doSummonCreature("Orc Leader", pos19)
doSummonCreature("Orc Leader", pos20)
doSummonCreature("Orc Leader", pos21)
doSummonCreature("Orc Leader", pos22)
doSummonCreature("Orc Leader", pos23)
doSummonCreature("Slime", pos24)
doSummonCreature("Slime", pos25)
doSummonCreature("Slime", pos26)
doSummonCreature("Slime", pos27)
setPlayerStorageValue(cid, 9966, 1)
return true
else
return true
end
else
npcHandler:say('You already borred me, now LEAVE!')
return false
end
end
-- Set the greeting callback function
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_GREET, 'INTRUDER!! WHAT ARE YOU LOOKING FOR |PLAYERNAME|?!')
function djinnMafree(cid, message, keywords, parameters)
if(getPlayerStorageValue(cid, 9965) == -1 and getPlayerStorageValue(cid, 9964) == -1) then
npcHandler:say('The Djinn Mafree sent you here? He always want to test his loosers friends. But say that I\'m not a test! Next time I gonna kill you!')
setPlayerStorageValue(cid, 9965, 1)
return true
else
npcHandler:say('You already borred me, now LEAVE!')
return false
end
end
function djinnIgnium(cid, message, keywords, parameters)
if(getPlayerStorageValue(cid, 9965) == -1 and getPlayerStorageValue(cid, 9964) == -1) then
npcHandler:say('The Djinn Ignium sent you here? He always want to test his loosers friends. But say that I\'m not a test! Next time I gonna kill you!')
setPlayerStorageValue(cid, 9964, 1)
return true
else
npcHandler:say('You already borred me, now LEAVE!')
return false
end
end
local node = keywordHandler:addKeyword({'djinn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Who sent you here?'})
local node1 = node:addChildKeyword({'mafree'}, djinnMafree)
local node1 = node:addChildKeyword({'ignium'}, djinnIgnium)
-- Make it react to hi/bye etc.
npcHandler:addModule(FocusModule:new())
Last edited: