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

Nokturno

Not a human
Joined
Aug 7, 2009
Messages
566
Solutions
2
Reaction score
401
hello ppl, hope u r doing fine today.
i hope someone can create this for me, i need a npc that yells any text continiously like " hurry up , we are leaving!", also when you speak to him he gives you this text:

you: Hi
NPC: This is the worst place to be if you want to Leave i can take bla bla bla
you: leave
npc: take this with you it may be helpful


and he gives to you X item and teleport you xxx,xxx,x
 
TFS 1.2...
Create a 'NPC.xml' on 'data/npc' and paste this inside:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="NPC Name" script="NPC.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100" />
<look type="153" head="39" body="39" legs="39" feet="76" addons="0" />
</npc>

And now create a file called 'NPC.lua' inside of 'data/npc/scripts' and paste this inside:
Lua:
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
-- Voices
local voices = {
    { text = "Hurry up , we are leaving!" },
    { text = "Hurry hurry, let's leave this cursed place!" }
}
npcHandler:addModule(VoiceModule:new(voices))
-- Voices.

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
   
    local player = Player(cid)

    if(msgcontains(msg, "leave")) then
        npcHandler:say("Good luck! also take this with you it may be helpful", cid)
        player:addItem(XXXX, 1, false)
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:teleportTo({x = XXXX, y = YYYY, z = Z}, false)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    end
    return true
end


npcHandler:setMessage(MESSAGE_GREET, "Hi |PLAYERNAME|, this is the worst place to be, if you want to {leave} I can take you back.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Hold on!.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Die then.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top