• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent NPC Grizzly Adams - almost how RL Tibia.

well, i changed some values and now works!!!!


function onKill(cid, target)
local mob = config[getCreatureName(target)]

to

function onKill(cid, target, lastHit)
local mob = config[getCreatureName(target):lower()]


@edit
now it crashs when I finish the task:

Kill 20 hydras
then kill 21 and crash :(
 
Last edited by a moderator:
I do not know why you getting crashes.
All code should work good... Change your engine on other than you have.
 
15:59 You have killed 19 of 20 hydras.
15:59 You have killed 20 of 20 hydras.
15:59 Congratulations! You have killed enough hydras.
15:59 Your total points is 1.

and then crash :(

maybe something is wrong with this?

Lua:
doPlayerSetStorageValue(cid, main_storage, mob.finished_storage_value)
 
Last edited by a moderator:
No, I think that in this part code is something wrong:
PHP:
elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_boss_storage_value and isInArray({-1,0}, killedMonsters) then
    doPlayerSetStorageValue(cid, bosses_storage, mob.finished_boss_storage_value)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
    if totalpoints < 50 then
        doPlayerSetStorageValue(cid, points, totalpoints + 1)
        doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")    
    end
elseif getPlayerStorageValue(cid, mob.special_storage) == mob.begin_special_task_boss_storage_value then
    if mob.boss == "no" then
        if killedMonsters <= mob.count and getPlayerStorageValue(cid, main_storage) == mob.begin_storage_main_value then
            doPlayerSetStorageValue(cid, mob.storage, killedMonsters + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..getCreatureName(target)..".")
            if getPlayerStorageValue(cid, mob.storage) == mob.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target)..".")
                doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
                doPlayerSetStorageValue(cid, storages.main_storage, mob.finished_storage_main_value)
            end
        end
    elseif mob.boss == "yes" then
        if isInArray({-1,0}, killedMonsters) then
            doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
        end
    end
I you remove it then work good?
 
if i remove it then the msg does not appear, and even if i kill 999999999999 hydras the npc does not talks to me xd
 
PHP:
local config = {    
    ["carniphila"] = {storage = 9999, ace_name = "carniphilas", begin_storage_value = 1, finished_storage_value = 2, count = 150},
    ["crocodile"] = {storage = 9998, race_name = "crocodiles", begin_storage_value = 3, finished_storage_value = 4, count = 300},
    ["tarantula"] = {storage = 9997, race_name = "tarantulas", begin_storage_value = 5, finished_storage_value = 6, count = 300},
    ["stone golem"] = {storage = 9996, race_name = "stone golems", begin_storage_value = 7, finished_storage_value = 8, count = 200},
    ["mammoth"] = {storage = 9995, race_name = "mammoths", begin_storage_value = 9, finished_storage_value = 10, count = 300},

    ["ice golem"] = {storage = 9994, race_name = "ice golems", begin_storage_value = 11, finished_storage_value = 12, count = 300},

    ["quara constrictor scout"] = {storage = 9993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
    ["quara hydromancer scout"] = {storage = 9993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
    ["quara mantassin scout"] = {storage = 9993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
    ["quara pincher scout"] = {storage = 9993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
    ["quara predator scout"] = {storage = 9993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
    
    ["quara constrictor"] = {storage = 9992, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
    ["quara hydromancer"] = {storage = 9992, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
    ["quara mantassin"] = {storage = 9992, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
    ["quara pincher"] = {storage = 9992, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
    ["quara predator"] = {storage = 9992, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},

    ["fire elemental"] = {storage = 9991, race_name = "fire elementals", begin_storage_value = 28, finished_storage_value = 29, count = 7},
    ["massive fire elemental"] = {storage = 9991, race_name = "fire elementals", begin_storage_value = 28, finished_storage_value = 29, count = 70},

    ["water elemental"] = {storage = 9990, race_name = "water elementals", begin_storage_value = 30, finished_storage_value = 31, count = 70},
    ["massive water elemental"] = {storage = 9990, race_name = "water elementals", begin_storage_value = 30, finished_storage_value = 31, count = 70},

    ["earth elemental"] = {storage = 9989, race_name = "earth elementals", begin_storage_value = 32, finished_storage_value = 33, count = 70},
    ["massive earth elemental"] = {storage = 9989, race_name = "earth elementals", begin_storage_value = 32, finished_storage_value = 33, count = 70},

    ["energy elemental"] = {storage = 9988, race_name = "energy elementals", begin_storage_value = 34, finished_storage_value = 35, count = 70},
    ["massive energy elemental"] = {storage = 9988, race_name = "energy elementals", begin_storage_value = 34, finished_storage_value = 35, count = 70},
    
    ["mutated rat"] = {storage = 9987, race_name = "mutated rats", begin_storage_value = 13, finished_storage_value = 14, count = 200},
    ["giant spider"] = {storage = 9986, race_name = "giant spiders", begin_storage_value = 15, finished_storage_value = 16, count = 500},

    ["hydra"] = {storage = 9985, race_name = "hydras", begin_storage_value = 17, finished_storage_value = 18, count = 2000},
    ["sea serpent"] = {storage = 9984, race_name = "sea serpents", begin_storage_value = 19, finished_storage_value = 20, count = 2000},
    ["behemoth"] = {storage = 9983, race_name = "behemoths", begin_storage_value = 21, finished_storage_value = 22, count = 20},
    ["serpent spawn"] = {storage = 9982, race_name = "serpent spawns", begin_storage_value = 23, finished_storage_value = 24, count = 1500},

    ["demon"] = {boss = "no", begin_storage_main_value = 36, finished_storage_main_value = 37, special_storage = 10007, storage = 9981, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1, count = 6666},
    
    --bosses
    ["demodras"] = {boss = "yes", special_storage = 10005, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
    ["tiquandas revenge"] = {boss = "yes", special_storage = 10006, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
    
    ["the snapper"] = {storage = 9978, begin_boss_storage_value = 1, finished_boss_storage_value = 2},
    ["hide"] = {storage = 9977, begin_boss_storage_value = 3, finished_boss_storage_value = 4},
    ["the bloodtusk"] = {storage = 9976, begin_boss_storage_value = 5, finished_boss_storage_value = 6},
    ["shardhead"] = {storage = 9975, begin_boss_storage_value = 7, finished_boss_storage_value = 8},
    ["esmeralda"] = {storage = 9973, begin_boss_storage_value = 9, finished_boss_storage_value = 10},
    ["the old widow"] = {storage = 9972, begin_boss_storage_value = 11, finished_boss_storage_value = 12},
    ["the many"] = {storage = 9971, begin_boss_storage_value = 13, finished_boss_storage_value = 14},
    ["leviathan"] = {storage = 9970, begin_boss_storage_value = 15, finished_boss_storage_value = 16},
    ["stonecracker"] = {storage = 9969, begin_boss_storage_value = 17, finished_boss_storage_value = 18},
    ["the noxious spawn"] = {storage = 9968, begin_boss_storage_value = 19, finished_boss_storage_value = 20},
    ["thul"] = {storage = 9974, begin_boss_storage_value = 21, finished_boss_storage_value = 22}
    }
local points = 10002
local main_storage = 10001
local bosses_storage = 10003

function onKill(cid, target)
local mob = config[getCreatureName(target)]
if not(mob and isPlayer(target) ~= true) then
    return true
end
local killedMonsters = getPlayerStorageValue(cid, mob.storage)
local totalpoints = getPlayerStorageValue(cid, points)
if(totalpoints == -1) then
    totalpoints = 0
end
if getPlayerStorageValue(cid, main_storage) == mob.begin_storage_value then 
	if killedMonsters <= mob.count then
		doPlayerSetStorageValue(cid, mob.storage, getPlayerStorageValue(cid, mob.storage) + 1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..mob.race_name..".")
            if getPlayerStorageValue(cid, mob.storage) == mob.count then
				doPlayerSetStorageValue(cid, main_storage, mob.finished_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..mob.race_name..".")
					if totalpoints < 50 then
						if mob.count < 1500 then
							doPlayerSetStorageValue(cid, points, totalpoints + 1)
							doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")    
						else
							doPlayerSetStorageValue(cid, points, totalpoints + 3)
							doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")    
						end
					end
			end
elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_boss_storage_value then
	if killedMonsters > -1 and killedMonsters < 1 then
		doPlayerSetStorageValue(cid, bosses_storage, mob.finished_boss_storage_value)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
			if totalpoints < 50 then
				doPlayerSetStorageValue(cid, points, totalpoints + 1)
				doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")    
			end
elseif getPlayerStorageValue(cid, mob.special_storage) == mob.begin_special_task_boss_storage_value then
    if mob.boss == "no" then
        if killedMonsters <= mob.count and getPlayerStorageValue(cid, main_storage) == mob.begin_storage_main_value then
            doPlayerSetStorageValue(cid, mob.storage, killedMonsters + 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..getCreatureName(target).."s.")
            if getPlayerStorageValue(cid, mob.storage) == mob.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target).."s.")
                doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
                doPlayerSetStorageValue(cid, storages.main_storage, mob.finished_storage_main_value)
            end
        end
    elseif mob.boss == "yes" then
        if killedMonsters > -1 and killedMonsters < 1 then
            doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
        end
    end    
end
return true
end
Now will be work... I think so.
 
still crash :(:(:(:(

11:20 You have killed 19 of 20 hydras.
11:20 You have killed 20 of 20 hydras.
11:20 Congratulations! You have killed enough hydras.
11:20 Your total points is 1.
then crash if I kill one more
 
i cant do it =/ but thanks for the help, the only choice left is to use the another killing in the name of... but that is not almost how RL tibia :(
 
Some one knows wy some tasks reset the number of killed monsters, like the hydras task?
I heave another problem too, wen kiled all monsters, i talk with grizzly , he thells, go kill boss, but i cant enter tp, but if i put the storage direct in the data base i can enter tp.
 
Last edited:
Good job! Really good scripts, thank you for this, I using in my ots :)
ŁAP REPA OSKAR heheh :p

Please fixed this bug (tfs 0.4):
Code:
[18:20:27.544] [Error - NpcScript Interface]
[18:20:27.544] data/npc/scripts/adam.lua:onCreatureSay
[18:20:27.544] Description:
[18:20:27.544] data/npc/scripts/adam.lua:263: attempt to call global 'doNPCTalkALot' (a nil value)
[18:20:27.544] stack traceback:
[18:20:27.544]  data/npc/scripts/adam.lua:263: in function 'callback'
[18:20:27.544]  data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[18:20:27.544]  data/npc/scripts/adam.lua:13: in function <data/npc/scripts/adam.lua:13>
 
Last edited:
data/NPC/lib and search npc.lua and paste (if you haven't this function):
PHP:
function doNPCTalkALot(cid,delay,messages)
		for i = 1,#messages do
			addEvent(doCreatureSay,delay * i, getNpcCid(), messages[i], TALKTYPE_PRIVATE_NP, false, cid)
		end
end
 
data/NPC/lib and search npc.lua and paste (if you haven't this function):
PHP:
function doNPCTalkALot(cid,delay,messages)
		for i = 1,#messages do
			addEvent(doCreatureSay,delay * i, getNpcCid(), messages[i], TALKTYPE_PRIVATE_NP, false, cid)
		end
end

I have done this but I have still this error :( TFS 0.4
 
it was working fine for me but when i clean up my database
then creat new player and want talk with Grizzly Adams he dont want answer me :<
he answer only for "hi" and "bye"
how can i fix it ?
 
the system without quest log is reseting tasks, i cant add the system with quest log in my server, because i cant compile my server i lost my sources and its my best executable, can you fix the problem? or you system only work 100% with quest log?
 
Back
Top