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

Why does this script not work?

Problem 1:

You don't need anything in the MONSTER.XML file.

Script:
Code:
function onKill(cid, target)
	if isMonster(target) then
		if getCreatureName(target) == "[COLOR="red"]name[/COLOR]" then
			local storage = 45459
			if getPlayerStorageValue(cid, storage) == -1 then
				setPlayerStorageValue(cid, storage, 1)
				doCreatureSay(cid, 'Congratulations! You slaughted The Haunted dragon, Get your rewards in the room in the west.', TALKTYPE_ORANGE_1)
				doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
			end
		end
	end
	
	return true
end

Problem 2:

Explain it specifically, what the NPC is supposed to do, step by step and I can probably make it for you.
 
Last edited:
cg.lua fixed
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function pick_quest(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local level = getPlayerLevel(cid)
    for k, v in pairs(wow_like_quests) do
        local required = tonumber(k)
        if(level >= required) then
            for i, v in ipairs(v) do    
		if getPlayerLevel(cid) >= 80 then
                    setPlayerStorageValue(cid,66226,1)
                    npcHandler:say("Our city keep getting earthquakes please help us go to the larva cave and find out who is responsible for this and kill him!", cid)
                    parameters.quest = v
                    return true
                end
		npcHandler:resetNpc()
                return true
	    end
        end
    end
    npcHandler:say("I have no quests to offer you at the moment. Come back when your stronger", cid)
    npcHandler:resetNpc()
    return true
end    
function accept_quest(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local quest = node:getParent():getParameters().quest
    local storage = quest.storage
    setPlayerStorageValue(cid, storage, 0)
    npcHandler:say("I'm expecting to hear from you again. Don't dissapoint me.", cid)
    if(quest.on_accept) then quest.on_accept(cid, quest) end
    npcHandler:resetNpc()
    return true
end

-- Keyword "Quest" will pick lowest undone quest for you. 
local questNode = keywordHandler:addKeyword({'quest'}, pick_quest, {})
    questNode:addChildKeyword({'yes'}, accept_quest, {})
    questNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too hard for you, eh?'})

    
npcHandler:addModule(FocusModule:new())
 
Monster_Portal4.lua:
Code:
local m = {
    ["Cursed Behemoth"] = {
		time = 60, -- Seconds
        to = { x = 1202, y = 1214, z = 10 }, -- Where Teleport Goes
        tp = { x = 1235, y = 1205, z = 10 } -- Where Teleport Creates
    }
}
function onKill(cid, target, lastHit)
    local monster = m[getCreatureName(target)]    
    if(monster) then
        doCreateTeleport(1387, monster.to, monster.tp)
        addEvent(reset, monster.time*1000, monster)
        doCreatureSay(cid, "You have " .. monster.time .. " seconds to escape!", TALKTYPE_ORANGE_1)
    end
return true
end  

function deleteTeleport(monster)
    local teleport = getTileItemById(monster.tp, 1387)
    if(teleport.uid > 0) then
		doRemoveItem(teleport.uid, 1)
		doSendMagicEffect(monster.tp, CONST_ME_POFF)
        doSendAnimatedText(monster.tp, "Closed", TEXTCOLOR_RED)
    end
return true
end

function reset(monster)
    addEvent(deleteTeleport, 0, monster)
end
 
CG got this errror!:(
30nhpn5.png


and the haunted dragon script shows no error but it also does nothing.
and the monster portal succeed thanks!
 
Last edited:
Problem 4 -
I think the error is in this line: ( I do not know if it works or not. )
Lua:
 ["Fortress golem"] = {
Change to:
Lua:
 ["Fortress Golem"] = {
Save file and test.
 
Last edited:
Thanks it worked i only tried Fortress golem and not Fortress Golem because on the custommonsters.xml it was called Fortress golem hehe thanks it worked!
 
Back
Top