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

Amulet of Loss in .lua code needed

Demnish

Tibian Hero
Joined
Sep 28, 2011
Messages
402
Solutions
2
Reaction score
65
Location
Sweden
I'm using the distro Cryingdamson 0.3.6 8.60 V5.

My Amulet of Loss is bugged inside the items.xml for a unknown reason.

So therefore, if anyone can help me out with a simple Amulet of Loss actionscript or w/e to get it working, also I need it to be an item that prevent the loss,
I would appreciate it very much and that person could expect something nice in return.


Yours, Demnish.
 
Last edited:
Code:
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid,10000) == true then
   doPlayerAddItem(cid,2173,1)
   doSendMagicEffect(getPlayerPosition(cid),12)
   doCreatureSay(cid,'AOL',TALKTYPE_ORANGE_1)
   doPlayerSendTextMessage(cid,22,"You've succesfully purchased an aol!")
else
	doPlayerSendCancel(cid,"You don't have enough money.")
   doSendMagicEffect(getPlayerPosition(cid),2)
end
return true
end

?
 
Code:
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid,10000) == true then
   doPlayerAddItem(cid,2173,1)
   doSendMagicEffect(getPlayerPosition(cid),12)
   doCreatureSay(cid,'AOL',TALKTYPE_ORANGE_1)
   doPlayerSendTextMessage(cid,22,"You've succesfully purchased an aol!")
else
	doPlayerSendCancel(cid,"You don't have enough money.")
   doSendMagicEffect(getPlayerPosition(cid),2)
end
return true
end

?

Maybe read before you post codes?
He asked for a script that enables the No-itemloss function by lua function, not to buy an aol.
 
This work like amulet of loss, normal players dont drop but redskull players drop^_^

add in creaturescripts.xml
XML:
<event type="preparedeath" name="AmuletOfLoss" event="script" value="aol.lua"/>


add in login.lua under

Lua:
registerCreatureEvent(cid, "Mail")

this
Lua:
registerCreatureEvent(cid, "AmuletOfLoss")


and save the script with name aol.lua

Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(isPlayer(cid) == TRUE and getPlayerSkullType(cid) ~= SKULL_RED) then
		doCreatureSetDropLoot(cid, false)
	end
	return true
end
 
Last edited:
@Acubens: And is it possible to connect this to an item? If I want to have lets say, amulet of loss and amulet of life?
 
Of course, just add the itemid here
Lua:
getPlayerItemCount(cid, xxxx)

Lua:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(isPlayer(cid) == TRUE and getPlayerItemCount(cid, xxxx) > 0 and getPlayerSkullType(cid) ~= SKULL_RED) then
		doCreatureSetDropLoot(cid, false)
	end
	return true
end
 
And everything should still be in creaturescripts? Why not actionscript if I might ask? Maybe I'll learn something until next time!

EDIT: Added the item Lightning Amulet's(Which I renamed Amulet of Loss) ID into the script and tested but it did not work, dropped bag anyway.. :/
If you know how to fix this, could you show me how to make so it have SLOT also? So people dont need to have it in their backpacks for it to work.

Help me and you will recieve real candy, since this is a major problem for me.
 
Last edited:
Only can be done in creaturescripts an alternative is editing your sources (more hard), test now i guess you use the id 7889 right?

Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(isPlayer(cid) == TRUE and [COLOR="#008000"][B]getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 7889)[/B][/COLOR] and getPlayerSkullType(cid) ~= SKULL_RED) then
		doCreatureSetDropLoot(cid, false)
	end
	return true
end
 
Already tested that but it did not work tho, I think there is a problem with my event type (preparedeath) even tested (ondeath) and even (death) but did not work, I am willing to source edit, but I dunno which lines should be modified, if you can point me in the right direction I would be really glad.
 
Back
Top