Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
1
Indexable
Never
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

	local player = Player(cid)
 
	if(msgcontains(msg, "i bring a wounded soldier") and getPlayerStorageValue(cid, 204) < 1) then
		npcHandler:say("Damn, what happened?.... And what happened to the rest of the group?.", cid)
		npcHandler.topic[cid] = 1
	elseif(msgcontains(msg, "Some dead and some captured")) then
		if(npcHandler.topic[cid] == 1) then
			npcHandler:say("This is serious, we will attend to the soldier while you talk to the commander and explain what happened.", cid)
			npcHandler.topic[cid] = 0
			if(getPlayerStorageValue(cid, 204) < 1) then
				setPlayerStorageValue(cid, 204, 1)
             m = doRemoveCreature("Helpless Orc", getThingPos(cid))
             doRemoveCreature(cid, m)
            end
				player:setStorageValue(12116, 1) -- The Inquisition Questlog- "Mission 3: Desperate Moments"
				player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())