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

Evolutions NPC's into Tfs

Crewe

Ravens
Joined
Feb 25, 2008
Messages
1,137
Reaction score
1
Well I need help. I was hosting a server with Npcs from the evolution server, but I decided to change inte Tfs instead. My problem is that the npc's wont work. (I know that evolution npcs are slightly different from tfs)
Does anyone know what to do?

Here is the error
Lua Script Error: [Npc Interface]
data/npc/scripts/amulet.lua

data/npc/scripts/amulet.lua:1: attempt to index global 'KeywordHandler' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/amulet.lua
This isnt the only ascript that isnt working...
 
Npcs from evolution wont work in Tfs since tfs got another npc System, You need to rewrite them or take some with new npc system.
 
@KaczooH
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end


function onCreatureTurn(creature)

end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! I sell all amulets.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'amulets') then
selfSay('I sell aol (10k), ancient amulet (1.6k), broken amulet (20k), bronze amulet (100gps), bronzen necklace (300gps), crystal necklace (250gps), dragon necklace (400gps), garlic necklace (450gps), golden amulet (3k), platinum amulet (3.5k), protection amulet (300gps), elven amulet (500gps), ruby necklace (2k), scarab amulet (1.3k), scarf (500gps), silver amulet (300gps), silver necklace (1k), star amulet (1.2k), stone skin amulet (3k), strange symbol (200gps), strange talisman (350gps) and wolves teeth chain (50gps).')

elseif msgcontains(msg, 'amulet of loss') or msgcontains(msg, 'aol') then
buy(cid,2173,1,10000)

elseif msgcontains(msg, 'ancient amulet') then
buy(cid,2142,1,1600)

elseif msgcontains(msg, 'broken amulet') then
buy(cid,2196,1,20000)

elseif msgcontains(msg, 'bronze amulet') then
buy(cid,2172,1,100)

elseif msgcontains(msg, 'bronzen necklace') then
buy(cid,2126,1,300)

elseif msgcontains(msg, 'crystal necklace') then
buy(cid,2125,15,250)

elseif msgcontains(msg, 'dragon necklace') then
buy(cid,2201,15,400)

elseif msgcontains(msg, 'garlic necklace') then
buy(cid,2199,10,450)

elseif msgcontains(msg, 'golden amulet') then
buy(cid,2130,6,3000)

elseif msgcontains(msg, 'platinum amulet') then
buy(cid,2171,6,3500)

elseif msgcontains(msg, 'protection amulet') then
buy(cid,2200,15,300)

elseif msgcontains(msg, 'elven amulet') then
buy(cid,2198,4,500)

elseif msgcontains(msg, 'ruby necklace') then
buy(cid,2133,5,2000)

elseif msgcontains(msg, 'scarab amulet') then
buy(cid,2135,1,1300)

elseif msgcontains(msg, 'scarf') then
buy(cid,2135,1,500)

elseif msgcontains(msg, 'silver amulet') then
buy(cid,2170,1,300)

elseif msgcontains(msg, 'silver necklace') then
buy(cid,2132,1,1000)

elseif msgcontains(msg, 'star amulet') then
buy(cid,2131,1,1200)

elseif msgcontains(msg, 'stone skin amulet') then
buy(cid,2197,1,3000)

elseif msgcontains(msg, 'strange symbol') then
buy(cid,2319,1,200)

elseif msgcontains(msg, 'strange talisman') then
buy(cid,2161,1,350)

elseif msgcontains(msg, 'wolves teeth chain') then
buy(cid,2129,1,50)
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end



function onThink()
if focus > 0 then
x, y, z = creatureGetPosition(focus)
myx, myy, myz = selfGetPosition()

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
selfTurn(1)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(3)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(0)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(2)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(0)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(3)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(1)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(2)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(0)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(3)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(1)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(2)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(0)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(3)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(1)
end
end

if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end

@Sasir

How do I do that?
 
Here is an NPC for TFS that will sell the same stuff as that old outdated Evolutions crap.

data/npc/scripts/amulets.lua
Code:
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


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell aol (10k), ancient amulet (1.6k), broken amulet (20k), bronze amulet (100gps), bronzen necklace (300gps), crystal necklace (250gps), dragon necklace (400gps), garlic necklace (450gps), golden amulet (3k), platinum amulet (3.5k), protection amulet (300gps), elven amulet (500gps), ruby necklace (2k), scarab amulet (1.3k), scarf (500gps), silver amulet (300gps), silver necklace (1k), star amulet (1.2k), stone skin amulet (3k), strange symbol (200gps), strange talisman (350gps) and wolves teeth chain (50gps).'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())

data/npc/Hazeel.xml
Code:
<npc name="Hazeel" script="data/npc/scripts/amulets.lua" autowalk="25" floorchange="0" access="3" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="137" head="114" body="0" legs="11" feet="0" addons="3" corpse="2212"/>
	<parameters>
<parameter key="module_shop" value="1"/>
<parameter key="message_greet" value="Greetings |PLAYERNAME|. I sell all amulets." />
<parameter key="shop_sellable" value="amulet of loss,2173,10000;aol,2173,10000;ancient amulet,2142,1600;broken amulet,2196,20000;bronze amulet,2172,100;bronzen necklace,2126,300;crystal necklace,2125,250;dragon necklace,2201,400;garlic necklace,2199,450;golden amulet,2130,3000;platinum amulet,2171,3500;protection amulet,2200,300; elven amulet,2198,500;ruby necklace,2133,2000;scarab amulet,2135,1300;scarf,2135,500;silver amulet,2170,300;silver necklace,2132,1000;star amulet,2131,1200;stone skin amulet,2197,3000;strange symbol,2319,200;strange talisman,2161,350;wolves teeth chain,2129,50" />
</parameters>
</npc>
 
Yep. Use the one from Thuggeh. I think it's kina simple and not messy (look how many lines did your script take). The functions in Evo are different from the ones in TFS (ie buy, pay in Evo).
 
I need more scripts to be fixed :S

These are the NPCs that I need scripts for.

I need scripts for these npcs that work with tfs.
 

Attachments

Back
Top