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

Aol forever

Zonet

Web Developer
Joined
Sep 1, 2008
Messages
4,393
Reaction score
52
Location
Tibia VS RL-life, guess whos back?
Hello there..

I want to do the broken amulet like amulet of loss but never lose the broken amulet always have it.!


can anyone make a script if there's script i know that aol is compiled but if there's script i would be very thanksful for the guy who script it to me:p


Thank you.
 
If you don't want edit sources...
in data/creaturescripts/scripts/login.lua under:
PHP:
function onLogin(cid)
add:
PHP:
registerCreatureEvent(cid, "PlayerDeathPrepare")
in data/creaturescripts/scripts/ make file playerpreparedeath.lua and in this file:
PHP:
function onPrepareDeath(cid, killer)
	if getPlayerItemCount(cid, 8889) >= 1 then
		doSetCreatureDropLoot(cid, 0)
	end
end
getPlayerItemCount(cid, 8889) - with item 8889 (skullcracker armor) players dont lose eq - tested (player can wear this item in backpack, not only armor slot!)
in file data/creaturescripts/creaturescripts.xml under:
PHP:
<creaturescripts>
add:
PHP:
<event type="preparedeath" name="PlayerDeathPrepare" script="playerpreparedeath.lua"/>

Hey guys this is working perfectly for me BUT how can I make it so ONLY when you wear it (Im using broken amulet ID 2196) as an amulet it will work? Because I can just have it on the arrow slot or inside the backpack and I still wont lose anything ;/

Thanks anyways for the help Gesior, I always thought this was only possible by source editing :thumbup:
 
Last edited:
Here it is:

PHP:
function onPrepareDeath(cid, killer)
    if getPlayerSlotItem(cid, 2) == 8889 then
        doSetCreatureDropLoot(cid, 0)
    end
end

Rep :D

Ye I know that should work but for some reason it doesnt, if I do it like that then the amulet wont even work as aol, the items will drop normally..

Maybe what Im asking can only be done with source editing ;(
 
add in login.lua
Code:
registerCreatureEvent(cid, "Aol")
creaturescripts.xml
Code:
<event type="preparedeath" name="Aol" script="aol.lua"/>
aol.lua
Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if getCreatureSkullType(cid) ~= 4 then
    local checkAol = getPlayerSlotItem(cid, 2)
    if checkAol.itemid ==[FONT=monospace] [COLOR=Red]8889[/COLOR] [/FONT]then
        doTransformItem(checkAol.uid,2173)
        doPlayerAddItem(cid,[COLOR=Red]8889[/COLOR],1)
    end
end
return TRUE
end
Change only RED part.
i hope it work.
Not tested.
 
Last edited:
Doesn't work :(, babalow

I edited the playerdeath.lua:
PHP:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if getCreatureSkullType(cid) ~= 4 then
    local checkAol = getPlayerSlotItem(cid, 2)
    if checkAol.itemid == 2196 then
        doTransformItem(checkAol.uid,2196)
        doPlayerAddItem(cid,2196,1)
		doSetCreatureDropLoot(cid, 0)
db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
    end
end
return TRUE
end

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if(config.deathListEnabled == TRUE) then
		local hitKillerName = "field item"
		local damageKillerName = ""
		if(lastHitKiller ~= FALSE) then
			if(isPlayer(lastHitKiller) == TRUE) then
				hitKillerName = getPlayerGUID(lastHitKiller)
			else
				hitKillerName = getCreatureName(lastHitKiller)
			end

			if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
				if(isPlayer(mostDamageKiller) == TRUE) then
					damageKillerName = getPlayerGUID(mostDamageKiller)
				else
					damageKillerName = getCreatureName(mostDamageKiller)
				end
			end
		end

		db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
		local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
		if(rows:getID() ~= -1) then
			local amount = (rows:numRows(true) - config.maxDeathRecords)
			if(amount > 0) then
				if(config.sqlType == "sqlite") then
					for i = 1, amount do
						db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
					end
				else
					db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
				end
			end
		end
	end
end

But now when I die by a monster or player it just says on the website:
1. 31.01.2009, 9:46:31 Test Sorc killed at level 7 by a .
 
Last edited:
Doesn't work :(, babalow

I edited the playerdeath.lua:
PHP:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if getCreatureSkullType(cid) ~= 4 then
    local checkAol = getPlayerSlotItem(cid, 2)
    if checkAol.itemid == 2196 then
        doTransformItem(checkAol.uid,2196)
        doPlayerAddItem(cid,2196,1)
        doSetCreatureDropLoot(cid, 0)
db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
    end
end
return TRUE
end

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
    if(config.deathListEnabled == TRUE) then
        local hitKillerName = "field item"
        local damageKillerName = ""
        if(lastHitKiller ~= FALSE) then
            if(isPlayer(lastHitKiller) == TRUE) then
                hitKillerName = getPlayerGUID(lastHitKiller)
            else
                hitKillerName = getCreatureName(lastHitKiller)
            end

            if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
                if(isPlayer(mostDamageKiller) == TRUE) then
                    damageKillerName = getPlayerGUID(mostDamageKiller)
                else
                    damageKillerName = getCreatureName(mostDamageKiller)
                end
            end
        end

        db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
        local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
        if(rows:getID() ~= -1) then
            local amount = (rows:numRows(true) - config.maxDeathRecords)
            if(amount > 0) then
                if(config.sqlType == "sqlite") then
                    for i = 1, amount do
                        db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
                    end
                else
                    db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
                end
            end
        end
    end
end
But now when I die by a monster or player it just says on the website:

Wth?
PHP:
doTransformItem(checkAol.uid,2196)
WHY!?
....
Try remove
PHP:
doSetCreatureDropLoot(cid, 0)
and change
PHP:
doTransformItem(checkAol.uid,2196)
to
PHP:
doTransformItem(checkAol.uid,2173)
PS: 2173 IS THE AOLID -.-
if deaths not saving.. check if u have
registerCreatureEvent(cid, "PlayerDeath")
in your login.lua.
 
Last edited:
Back
Top