Ldrozd
Piszę skrypty w zeszycie.
Hu guys!
I have problem with my NPC. I dont know what I am doing wrobg. Could help me with it. Tell me what is wrong. I count on you
/travel.lua
/captain_hook.xml
I have problem with my NPC. I dont know what I am doing wrobg. Could help me with it. Tell me what is wrong. I count on you
/travel.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
local getPlayer = getThingFromPos(getPlayerPosition(cid))
-- config --
local position = {x=1122, y=867, z=7}
local itemId = 5896
local count = 1
if(msgcontains(msg, 'orange island')) then
npcHandler:say("You are fucking orange, so I will teleport you to orange island for 5 bear paws. Deal?", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, itemId, count) == TRUE) then
doTeleportThing(cid, position, 0)
npcHandler:say("Good, let's go!", cid)
else
npcHandler:say("You don't have " .. count .. " " .. itemId .. "s you fucking orangesucker!", cid)
end
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
/captain_hook.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hook" script="travel.lua" walkinterval="2000" floorchange="0"> <~~ [b]its correct now, but still doesnt work[/b]
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|."/>
</parameters>
</npc>
Last edited: