• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

NPC TFS 0.3.5pl1

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello.
I have request for you guys.

I need NPC:
NPC: Hello dear hero! I can {send} you back!
Player: send
NPC: you dont have 1500 gp.
Player: send (for 1500gp)
NPC: teleport you to XYZ, remove 1500 gp and doCreatureSetSkullType(cid, 0).

Rep++
 
Last edited:
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local pos = {x=100, y=100, z=7}
local gold = 1500

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
	elseif msgcontains(msg, 'send') then
		if doPlayerRemoveMoney(cid, gold) then
			npcHandler:releaseFocus(cid)
			doCreatureSetSkullType(cid, 0)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, pos)
			doSendMagicEffect(pos, CONST_ME_TELEPORT)
		else
			npcHandler:say('You don\'t have ' .. gold .. ' gold.')
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "Hello dear hero! I can {send} you back!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top