roriscrave
Advanced OT User
- Joined
- Dec 7, 2011
- Messages
- 1,188
- Solutions
- 34
- Reaction score
- 200
tfs 1.3 8.6
I'm creating a fight npc, after talking to him, you will fight with him.
my idea is after talking, the npc will enter ghost mode (like GM), and summon a monster with the same appearance as the NPC, for the player to fight.
but I'm not able to use the set ghost function for npc, is it possible?
I'm creating a fight npc, after talking to him, you will fight with him.
my idea is after talking, the npc will enter ghost mode (like GM), and summon a monster with the same appearance as the NPC, for the player to fight.
but I'm not able to use the set ghost function for npc, is it possible?
Code:
quest/npc1.lua:17: attempt to call method 'setGhostMode' (a nil value)
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
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if npcHandler.topic[cid] == 0 then
if msgcontains(msg, "fight") then
Npc():setGhostMode(true)
npcHandler:say("Lets fight!", cid)
npcHandler.topic[cid] = 1
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())