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

Solved TFS 1.2 Npc's?

Heatblade12

Member
Joined
Aug 12, 2013
Messages
24
Reaction score
6
Well, i got my server up, i placed the NPCs found in the folder, but there where no weapon/armor traders, no tanner to make money from, ect.

i tried making a custom NPC based on Tom the tanner, just changed the name because i needed to reload it in a map editor blah blah blah

Code's below.

what i would really like is if there was NPC's that i just paste into the npc folder in the TFS 1.2 Server that work the basics in the game. ie: Tanner to make money for players, and Weapon and armor smiths to buy gear with the cash.

the problem i met with the NPC below, is that i cant sell any items to him. tried both wold corpse and rabbit corpse. the npc just wont take them.
what can i do to improve myself here?


XML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Harld" script="Harld.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="144" head="113" body="115" legs="58" feet="115" addons="1"/>
    <parameters>
        <parameter key="message_greet" value="Hey there, |PLAYERNAME|. I'm Harld the tanner. If you have fresh corpses, leather or paws, trade with me."/>
        <parameter key="message_farewell" value="Good bye."/>
        <parameter key="message_walkaway" value="D'oh?"/>
        <parameter key="message_idletimeout" value="D'oh?"/>
        <parameter key="message_sendtrade" value="Sure, check what I buy."/>
        <parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="" />
        <parameter key="shop_sellable" value="bear paw,5896,50;dead rabbit,2992,25;dead rat,2813,25;dead wolf,2826,50;minotaur leather,5878,100;wolf paw,5897,15" />
    </parameters>
</npc>

LUA
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}


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


function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg,'oracle') then
selfSay('It\'s in the academy, just above {Seymour}. Go there once you are level 8 to leave this place.', cid)

elseif msgcontains(msg,'seymour') then
selfSay('He sticks his nose too much in books.', cid)

elseif msgcontains(msg,'cipfried') then
selfSay('I\'m not what you\'d call a \'believer\'.', cid)

elseif msgcontains(msg,'Harld') then
selfSay('Yep.', cid)

elseif msgcontains(msg,'tanner') then
selfSay('That\'s my job. It can be dirty at times but it provides enough income for my living.', cid)

elseif msgcontains(msg,'corpses') then
selfSay('I\'m buying fresh {corpses} of rats, rabbits and wolves. I don\'t buy half-decayed ones. If you have any for sale, {trade} with me.', cid)

elseif msgcontains(msg,'monster') then
selfSay('Good monsters to start with are rats. They live in the {sewers} under the village of {Rookgaard}.', cid)

elseif msgcontains(msg,'sewers') then
selfSay('The nearest sewer entrance is just to the right of this building.', cid)

elseif msgcontains(msg,'corpse') then
selfSay('I\'m buying fresh {corpses} of rats, rabbits and wolves. I don\'t buy half-decayed ones. If you have any for sale, {trade} with me.', cid)

elseif msgcontains(msg,'sewer') then
selfSay('The nearest sewer entrance is just to the right of this building.', cid)

elseif msgcontains(msg,'troll') then
selfSay('Troll leather stinks. Can\'t use it.', cid)

elseif msgcontains(msg,'orc') then
selfSay('I don\'t buy orcs. Their skin is too scratchy.', cid)

elseif msgcontains(msg,'dallheim') then
selfSay('He\'s okay.', cid)

elseif msgcontains(msg,'Amber') then
selfSay('Now that\'s an interesting woman.', cid)

elseif msgcontains(msg,'rookgaard') then
selfSay('This island has its own problems, but all in all it\'s a decent place to live.', cid)

elseif msgcontains(msg,'main') then
selfSay('You can go there once you are level 8 and have talked to the {oracle}.', cid)

elseif msgcontains(msg,'mainland') then
selfSay('You can go there once you are level 8 and have talked to the {oracle}.', cid)

elseif msgcontains(msg,'obi') then
selfSay('He is such a hypocrite.', cid)

elseif msgcontains(msg,'dixi') then
selfSay('She buys my fine leather clothes.', cid)

elseif msgcontains(msg,'lily') then
selfSay('She always comes and preaches about how one should not wear animal skin.', cid)

elseif msgcontains(msg,'al dee') then
selfSay('He\'s an apple polisher.', cid)

elseif msgcontains(msg,'wares') then
selfSay('I\'m buying fresh {corpses} of rats, rabbits and wolves. I don\'t buy half-decayed ones. If you have any for sale, {trade} with me.', cid)

elseif msgcontains(msg,'job') then
selfSay('I\'m the local {tanner}. I buy fresh animal {corpses}, tan them, and convert them into fine leather clothes which I then sell to {merchants}.', cid)

elseif msgcontains(msg,'merchant') then
selfSay('{Dixi} and {Lee\'Delle} sell my leather clothes in their shops.', cid)

elseif msgcontains(msg,'merchants') then
selfSay('{Dixi} and {Lee\'Delle} sell my leather clothes in their shops.', cid)

elseif msgcontains(msg,'lee\'delle') then
selfSay('Her nose is a little high in the air, I think. She never shakes my hand.', cid)

elseif msgcontains(msg,'weapon') then
selfSay('Nope, sorry, don\'t sell that. Ask {Obi} or {Lee\'Delle}.', cid)

elseif msgcontains(msg,'shields') then
selfSay('Nope, sorry, don\'t sell that. Ask {Dixi} or {Lee\'Delle}.', cid)

elseif msgcontains(msg,'willie') then
selfSay('I kinda like him. At least he says what he thinks.', cid)

elseif msgcontains(msg,'billy') then
selfSay('He\'s a better cook than his cousin {Willie}, actually.', cid)

elseif msgcontains(msg,'trade') then
selfSay('Sure, check what I buy.', cid)

elseif msgcontains(msg,'norma') then
selfSay('I like her beer.', cid)

elseif msgcontains(msg,'human') then
selfSay('Are you crazy?!', cid)
npcHandler:releaseFocus(cid)

end
return TRUE
end

function thinkCallback()
talk = math.random(1,200)
if talk == 1 then
doCreatureSay(getNpcCid(), "Oh yeah, I'm also interested in wolf paws and bear paws.", TALKTYPE_YELL)
elseif talk == 2 then
doCreatureSay(getNpcCid(), "Also buying minotaur leather.", TALKTYPE_YELL)
elseif talk == 3 then
doCreatureSay(getNpcCid(), "Buying fresh corpses of rats, rabbits and wolves.", TALKTYPE_YELL)
end
return TRUE
end

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


Note: im new the forums, my goal is the make a server i can host and just play singleplayer on it with no one else. otherwise i would just go play on the actual servers. a Vanilla map with all the npcs, monsters, ect, with no premium restrictions is the dream, but for now, im just using the TFS 1.2 Server since its the first one i tried.

Edit: Code credit to QuaS. pulled from https://otland.net/threads/rookgard-npcs-100-real-will-be-updated.50750/
 
Greets!

That NPCs might not work with TFS 1.X series as its old and say 0.3.5, I believe that might be your problem.

Here you go:

The NPC August: (XML)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="August" script="general.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="39" body="95" legs="0" feet="39" addons="1"/>
<voices>
<voice text="Need Supplies?" interval2="120" margin="1" yell="no"/>
</voices>
<parameters>
  <parameter key="message_greet" value="Welcome |PLAYERNAME|! Would you like to {trade} today?" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="help;item" />
<parameter key="keyword_reply1" value="Im at your service, any items?" />
<parameter key="keyword_reply2" value="Lets see, where should I start? Torch, rope, shovel, pick, brown backpack, blue backpack, red backpack and different health aswell as mana potions, please read the blackboard. I guess thats all. Oh! I will also buy back empty vials." />
</parameters>
</npc>

Explanation:
{trade}
= will be highlighted in darkblue to help players know what to respond.
trade will automaticly be possible at any NPC who sells or buys items, I just highlighted mine to keep it simple and clear.
keywords are different things the NPC will respond to.


general.lua
Code:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addSellableItem({'vial'}, 7636, 5, 'vial')    --SELLABLE = Items you are able to SELL to the NPC
shopModule:addSellableItem({'vial'}, 7634, 10, 'vial')
shopModule:addSellableItem({'vial'}, 7635, 15, 'vial')

shopModule:addBuyableItem({'shovel'}, 2554, 25, 'shovel')  --BUYABLE = Items you are able to BUY from the NPC
shopModule:addBuyableItem({'torch'}, 2050, 2, 'torch')
shopModule:addBuyableItem({'rope'}, 2120, 20, 'rope') --
shopModule:addBuyableItem({'pick'}, 2553, 50, 'pick')
shopModule:addBuyableItem({'scythe'}, 2550, 100, 'scythe')
shopModule:addBuyableItem({'fishing rod'}, 2580, 100, 'fishing rod')
shopModule:addBuyableItem({'worm'}, 3976, 1, 'worm')

shopModule:addBuyableItem({'brown backpack'}, 1988, 20, 'brown backpack')
shopModule:addBuyableItem({'green backpack'}, 1998, 20, 'green backpack')
shopModule:addBuyableItem({'yellow backpack'}, 1999, 20, 'yellow backpack')
shopModule:addBuyableItem({'red backpack'}, 2000, 20, 'red backpack')
shopModule:addBuyableItem({'purple backpack'}, 2001, 20, 'purpe backpack')
shopModule:addBuyableItem({'blue backpack'}, 2002, 20, 'blue backpack')
shopModule:addBuyableItem({'grey backpack'}, 2003, 20, 'grey backpack')
shopModule:addBuyableItem({'orange backpack'}, 2004, 20, 'orange backpack')

shopModule:addBuyableItem({'health potion'}, 7618, 30, 'health potion'
shopModule:addBuyableItem({'strong health potion'}, 7588, 200, 'strong health potion')
shopModule:addBuyableItem({'great health potion'}, 7591, 380, 'great health potion')
shopModule:addBuyableItem({'ultimate health potion'}, 8473, 620, 'great health potion')

shopModule:addBuyableItem({'mana potion'}, 7620, 60, 'mana potion')
shopModule:addBuyableItem({'strong mana potion'}, 7589, 160, 'strong mana potion')
shopModule:addBuyableItem({'great mana potion'}, 7590, 240, 'great mana potion')

shopModule:addBuyableItem({'great spirit potion'}, 8472, 380, 'great spirit potion')

npcHandler:setMessage(MESSAGE_FAREWELL, "Goodbye!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Explanation:
-SELLABLE = Items you are able to SELL to the NPC
-BUYABLE = Items you are able to BUY from the NPC
-({'shovel'}, 2554, 25, 'shovel') = -({'shovel'}, itemID, gold amount, 'shovel')

Try to import this one, should work. :)
Good luck!

Kind Regards,
Eldin.
[/code]
 
my sellable items look like this as i changed them.

Code:
shopModule:addSellableItem({'vial'}, 7636, 5, 'vial')    --SELLABLE = Items you are able to SELL to the NPC
shopModule:addSellableItem({'vial'}, 7634, 10, 'vial')
shopModule:addSellableItem({'vial'}, 7635, 15, 'vial')
shopModule:addSellableItem({'dead rabbit'}, 2992, 5, 'dead rabbit')
shopModule:addSellableItem({'dead rat'}, 2813, 5, 'dead rat')
shopModule:addSellableItem({'dead wolf'}, 2826, 15, 'dead wolf')
shopModule:addSellableItem({'wolf paw'}, 5897, 15, 'wolf paw')
shopModule:addSellableItem({'minotaur leather'}, 5878, 100, 'minotaur leather')

and i cant manage to sell the 2 dead rabbits in my inventory. i dont know what i did wrong,
 
Is everything else working?

I guess you have the wrong "dead rat ID" or simply became "wrong" as the rat rotted (decayed) to another ID.

Bodies rot so make sure you have the right sell ID depending on how fast you want to force a player to sell the body. You could also change the rot time (decay time) in items.xml if you prefer them to stay longer.

Kind Regards,
Eldin.
 
well, the Rabbit did not Decay, its still a dead Rabbit... i know there is 3+ different id's for a single dead rabbit, same thing with dead wolves ect, but i never got around to testing them since i never killed one yet. so, a lazy fix is to have all the dead rabbit id's for the sellable items? ie

Dead rabbit id = 2992
Dead rabbit id = 3119
Dead rabbit id = 6017

should i use all three?

edit:

i mean, should this work?
Code:
shopModule:addSellableItem({'dead rabbit'}, 2992, 5, 'dead rabbit')
shopModule:addSellableItem({'dead rabbit'}, 3119, 5, 'dead rabbit')
shopModule:addSellableItem({'dead rabbit'}, 6017, 5, 'dead rabbit')

edit 2: it was a cheap fix, but it seemed to work... is sloppy looking tho when looking at 3 different dead rabbits to sell, where only one or two work. (he will not take rotten/decayed corpses)
i just feel like do i have to do the same thing to the wolf corpse? blagh!
 
Last edited:
Unless you want the rabbit to be Sellable after it decays you could only use the single line that sells the 1 rabbit body you want to sell, now do the same with the wolf. :)

Kind Regards,
Eldin.
 
Last edited:
the 3 dead rabbit ID's i used are all dead rabbit id,s non of them are decayed ID's or skeleton ID's.
what im trying to say is that, when i looked into the corpse ID, it brought back 3 different "Dead rabbit" corpses, along with 3 different decayed rabbits, 3 different skeleton rabbits, ect.

the cheap fix i did above is working so far for me. as when i kill a rabbit, i dont know what "Dead rabbit" ID is dropped.
just seemed cluttered to have 3+ of the same thing,
 
The is kinda the general base:
1. The dead original body.
2. Will reach this decayed status fast.
3. Last or/and not lootable.

Try with a GM, click on the rabbit once you killed it, wait alittle and click it again, you'll see how the IDs are changing.
You would have to Think of the ID you want to sell and use that in the shop, probably ID/decay nr 2.

You may still change the decay time if you want you/your players to have more time until they sell their corpse.

Kind Regards,
Eldin
.
 
Try with a GameMaster or a God ^^
Click the body and you'll see an ID like you see on a sword, wall or anything else.

I assume you are online as you are testing the NPC, do you have some kind of God/GM or do you try with an original player?
If you don't have a God/GM, do you know how make on? :)

Kind Regards,
Eldin.
 
im using PHPMyAdmin, im running the server privately, all i have been using was the default "original player" i suppose.
Edit:
i figured it out, now my mission to kill rabbits and wolves and see there ids
 
Last edited:
Back
Top