• 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!

NPC form 8.1 to 8.5

ReDe

New Member
Joined
Mar 5, 2009
Messages
48
Reaction score
0
Hi, i have problems i need npc from 8.1 Evo to my TFS 8.5 ;/

It looks und 8.1
arena.lua :
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 creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end

		if msgcontains(msg, 'arena') then
			selfSay('For 1000 gp i may give you permission to Greenhorn level. For 5000 gp i give you permission to Scrapper level. Warlord level is for 10000 gp.')
		elseif msgcontains(msg, 'greenhorn') then
			selfSay('Do you want permission to Greenhorn level for 1000 gp?')
      			talk_state = 1
		elseif msgcontains(msg, 'scrapper') then
			selfSay('Do you want permission to Scrapper level for 5000 gp?')
      			talk_state = 2
		elseif msgcontains(msg, 'warlord') then
			selfSay('Do you want permission to  Warlord level for 10000 gp?')
      			talk_state = 3
-- --------------------------------- confirm yes ---------------------- 
		elseif msgcontains(msg, 'yes') then
			if talk_state == 1 then
				doPlayerRemoveMoney(cid,1000)
				setPlayerStorageValue(cid, 5029, 1)
				selfSay('Here you go.')
			elseif talk_state == 2 then
				doPlayerRemoveMoney(cid,5000)
				setPlayerStorageValue(cid, 5029, 2)
				selfSay('Here you go.')
			elseif talk_state == 3 then
				doPlayerRemoveMoney(cid,10000)
				setPlayerStorageValue(cid, 5029, 3)
				selfSay('Here you go.')
			end
-- -----------------------------------confirm no ---------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 34) then
selfSay('Ok than.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end

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

And Halvar.xml :
PHP:
<npc name="Halvar" script="data/npc/scripts/arena.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Im leader of the Svargrond Arena." />
</parameters>
</npc>

Please help me :)
 
Back
Top