• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC A Sweaty Cyclops (RPG NPC, 99% like Tibia RL)

Launian

Tsuki~
Joined
Jul 7, 2008
Messages
34
Reaction score
1
Well, I was checking my server to see if it has all the addon items, and I noticed that I didn't had a smith npc yet. So, here it is. It changes certain items for special metals needed on some addons. Needless to say, if you don't have a real addon NPC, it won't be worth putting him in.

data/npcs/cyclops.xml
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Sweaty Cyclops" script="data/npc/scripts/cyclops.lua" walkinterval="2000" floorchange="0" access="5" >
    <health now="150" max="150"/>
    <look type="22" corpse="2212"/>
    
    <parameters>
        <parameter key="message_greet" value="Hum Humm! Welcume lil' Player.."/>
        <parameter key="message_farewell" value="Good bye lil' one."/>
    </parameters>
</npc>

data/npcs/scripts/cyclops.xml
Lua:
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
	local cycmsg = 'Cling Clang!'
	local noimsg = 'Lil\' one no have that thing!'
	local deny	=	'Lil\' one is no sure? Okay'
	local infbolt = 4 -- change this to adjust the number of infernal bolts you want to give to the players for 1 soul orb.


--------------------MESSAGES------------------------------------------------------------------------------
    if msgcontains(msg, 'help') or msgcontains(msg, 'trade') then
		selfSay('Me can make {royal steel}, {draconian steel}, {hell steel} and {crude iron}. Me also make lil\' {infernal bolt}.', cid)
	
	elseif msgcontains(msg, 'royal steel') then
        selfSay('Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil\' one want to trade?', cid)
        talkState[talkUser] = 1
    
    elseif msgcontains(msg, 'draconian steel') then
        selfSay('Firy steel it is. Need green ones\' breath to melt. Or red even better. Me can make from shield. Lil\' one want to trade?', cid)
		talkState[talkUser] = 2

    elseif msgcontains(msg, 'hell steel') then
        selfSay('Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil\' one want to trade?', cid)
		talkState[talkUser] = 3
		
    elseif msgcontains(msg, 'crude iron') then
        selfSay('Good iron is. Me friends use it much for fight. Me can make from weapon. Lil\' one want to trade?', cid)
		talkState[talkUser] = 4
	
	elseif msgcontains(msg, 'infernal bolt') then
		selfSay('Uh. Me can make some nasty lil\' bolt from soul orbs. Lil\' one want to trade all?', cid)
		talkState[talkUser] = 5
		
-------------GETTING METALS FROM HIM-------------------
	
	-- Royal Steel
	elseif talkState[talkUser] == 1 then
		if msgcontains(msg, 'yes') then
			if doPlayerTakeItem(cid, 2487, 1) == true then
				doPlayerAddItem(cid, 5887, 1)
				selfSay(cycmsg, cid)
				talkState[talkUser] = 0
			else
				selfSay(noimsg, cid)
			end
		else
			selfSay(deny, cid)
		end
		talkState[talkUser] = 0
	-- Draconian Steel
	elseif talkState[talkUser] == 2 then
		if msgcontains (msg, 'yes') then
			if doPlayerTakeItem(cid, 2516, 1) == true then
				doPlayerAddItem(cid, 5889, 1)
				selfSay(cycmsg, cid)
				talkState[talkUser] = 0
			else
				selfSay(noimsg, cid)
			end
		else
			selfSay(deny, cid)
		end
		talkState[talkUser] = 0
	-- Hell Steel
	elseif talkState[talkUser] == 3 then
		if msgcontains (msg, 'yes') then
			if doPlayerTakeItem(cid, 2462, 1) == true then
				doPlayerAddItem(cid, 5888, 1)
				selfSay(cycmsg, cid)
				talkState[talkUser] = 0
			else
				selfSay(noimsg, cid)
			end
		else
			selfSay(deny, cid)
		end
		talkState[talkUser] = 0
	-- Crude Iron
	elseif talkState[talkUser] == 4 then
		if msgcontains (msg, 'yes') then
			if doPlayerTakeItem(cid, 2393, 1) == true then
				doPlayerAddItem(cid, 5892, 1)
				selfSay(cycmsg, cid)
				talkState[talkUser] = 0
			else
				selfSay(noimsg, cid)
			end
		else
			selfSay(deny, cid)
		end
		talkState[talkUser] = 0
	elseif talkState[talkUser] == 5 then
		if msgcontains (msg, 'yes') then
			if doPlayerTakeItem(cid, 5944, 1) == true then
				doPlayerAddItem(cid, 6529, infbolt)
				selfSay(cycmsg, cid)
				talkState[talkUser] = 0
			else
				selfSay(noimsg, cid)
			end
		else
			selfSay(deny, cid)
		end
		talkState[talkUser] = 0
	end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Credits goes to the one who made my bank script, altho I don't know his/her name :p I used it as a layout to make this one.

If you see any bugs, just post them and I'll try to fix em (or if you fix them, post the fixed .lua xD) Hope someone finds it usefull.

Edited: Thanks to Cykotitan for giving me advice on making the script cleaner. Hope it helps ya
 
Last edited:
To be honest, I dont even think he made that one :p Ive got the same script and Ive had it since... august or smthing lol
 
Code:
	-- Royal Steel
	elseif talkState[talkUser] == 1 then
		if msgcontains(msg, 'yes') then
			if doPlayerTakeItem(cid, 2487, 1) == true then
				doPlayerAddItem(cid, 5887, 1)
				selfSay(cycmsg, cid)
				[B][COLOR="Red"]talkState[talkUser] = 0[/COLOR][/B]
			else
				selfSay(noimsg, cid)
				[B][COLOR="Red"]talkState[talkUser] = 0[/COLOR][/B]
			end
		else
			selfSay(deny, cid)
			[B][COLOR="Red"]talkState[talkUser] = 0[/COLOR][/B]
		end
to
Code:
	-- Royal Steel
	elseif talkState[talkUser] == 1 then
		if msgcontains(msg, 'yes') then
			if doPlayer[B][COLOR="Red"]Remove[/COLOR][/B]Item(cid, 2487, 1) == [B][COLOR="Red"]TRUE[/COLOR][/B] then
				doPlayerAddItem(cid, 5887, 1)
				selfSay(cycmsg, cid)
			else
				selfSay(noimsg, cid)
			end
		else
			selfSay(deny, cid)
		end
[B][COLOR="Red"]		talkState[talkUser] = 0[/COLOR][/B]
 
Thank you

Thank you so much, I just started having problems with my sweaty cyclops and alas here is a perfect script, THANK YOU REP ++ for your contribution using latest TFS 3.6 forgotten server.

My server thanks you!

Kind Reguards :thumbup:
 
To be honest, I dont even think he made that one :p Ive got the same script and Ive had it since... august or smthing lol


Well, then there's someone out there who has a brain that is an awfull lot like mine, because I sure as hell wasted hours doing that scrip. Yes, I used a layout as I said before, so maybe someone else did it. And also, it's not the first time I post this script: I posted it on Otfans some time ago, so maybe you got it from me as well? It's not the same one, tho. They're just very alike.

I don't know what rep is nor I care about it, but it's not nice when some random stranger goes on telling everyone you're a lier without even having a proof. So, until you do, please keep those comments to yourself.

@Cykotitan: I just noticed why you changed those things xD Thanks a lot for the tip. I'll get to it sometime soon, and update the thread.
 
Last edited:
aint working for me, getting this error:
Code:
[10/02/2010 06:29:39] [Error - LuaScriptInterface::loadFile] data/npc/scripts/A Sweaty Cyclops.lua:119: '<eof>' expected near 'end'
[10/02/2010 06:29:39] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/A Sweaty Cyclops.lua
[10/02/2010 06:29:39] data/npc/scripts/A Sweaty Cyclops.lua:119: '<eof>' expected near 'end'

using tfs 0.3.6
 
aint working for me, getting this error:
Code:
[10/02/2010 06:29:39] [Error - LuaScriptInterface::loadFile] data/npc/scripts/A Sweaty Cyclops.lua:119: '<eof>' expected near 'end'
[10/02/2010 06:29:39] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/A Sweaty Cyclops.lua
[10/02/2010 06:29:39] data/npc/scripts/A Sweaty Cyclops.lua:119: '<eof>' expected near 'end'

using tfs 0.3.6


I'm using TFS 3.6 as well, and it is working with no problem. Can you paste your lua file here? Since I can't think of anything right now :$

Anyways, if it's saying that, then maybe you have an extra end at the end of the document. If you pasted the script over another one, maybe you didn't erased one of the original ends. It happens to me quite often, so check your tags.
 
aint working for me, getting this error:
Code:
[10/02/2010 06:29:39] [Error - LuaScriptInterface::loadFile] data/npc/scripts/A Sweaty Cyclops.lua:119: '<eof>' expected near 'end'
[10/02/2010 06:29:39] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/A Sweaty Cyclops.lua
[10/02/2010 06:29:39] data/npc/scripts/A Sweaty Cyclops.lua:119: '<eof>' expected near 'end'

using tfs 0.3.6

Copy the whole script...

Even copy/paste can't be that difficult... come one...
 
Npc remove the money but don't give the item :S
Edit:Solved

Great script, thanks.
 
eehh please some help the npc only remove the item and dont give the quest item for it im using tfs mystic spirit 0.2.7 please some help
 
Back
Top