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

Broken Amulet

Rexanilator

New Member
Joined
Oct 3, 2009
Messages
297
Reaction score
2
I am looking for a script for a broken amulet (2196) that would act as an amulet of loss for red skull players.

I have tried every script on here and none of them seem to work...one even made my server zombies - everyone would drop to 0 hitpoints - but would not die. That was a fun-day having players levelling up on monsters and doing quest they would not have been able to do if they could have died...

I am using TFS 0.3.6pl1...

The amulet would be for premium players only and protect them from losing items with red skull. I would also like for it to have like 5 charges before it runs out...and poofs away!

Thanks!
 
Thanks JDB - obviously it works great...just a couple of things would be nice and probably are so simple as well! First - when the player dies - his corpse disappears...which is okay - but would be better if there were still a dead body there that says Killed by...

Second if we were able to have charges on it...

Regardless - thanks for the script - rep given!

The reason I posted the request again was because I've tried all scripts here and they end up turning all players into zombies. Yours was the only one that even came close to working! Thanks again!
 
I added charges to the amulet - inside of items.xml and it shows that it has charges - but the amulet still disappears on death. Any ideas how to make it just remove a charge instead of disappear until the final charge?

Here is the way it is listed in items.xml:

Code:
<item id="2196" article="a" name="broken amulet">
		<attribute key="description" value="This amulet serves as an aol for red skulls." />
		<attribute key="weight" value="420" />
		<attribute key="charges" value="5" />
		<attribute key="showcharges" value="1" />
		<attribute key="slotType" value="necklace" />
	</item>
 
This is the script - could you help me with what I need to add to make it 5 charges?

Code:
function onPrepareDeath(cid, deathList)
	if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
		if getCreatureSkullType(cid) < 5 and doPlayerRemoveItem(cid, 2196, 1) then
			doSetCreatureDropLoot(cid, false)
		end
	end

	return true
end
 
The best way I can think of is to give it actionid 1005, and subtract it by 1 each time the script is executed. Have it check for actionid 1000 each time, and once the check passes have it remove the item. I'm sure someone else could think of a better way though
 
function onPrepareDeath(cid, deathList)
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
if getCreatureSkullType(cid) < 5 and doPlayerRemoveItem(cid, 2196, 1) then
doSetCreatureDropLoot(cid, false)
end
end

return true
end
doPlayerRemoveItem(cid, 2196, 1)


Delete this line why? in item.xml you set charges and add in movements.xml...
if you add this line you cancel the charges by the function removeitem.
bb
 
Put this instead of the script you have
Lua:
local corpse_ids = {
        [0] = 3065, -- female
        [1] = 3058 -- male
}
local charges = 5

local id = 2126    -- put your necklace id
function onPrepareDeath(cid, deathList)
    local n = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)


	if n.itemid == id then
	     if n.actionid < 100 then
		        doItemSetAttribute(n.uid,"aid", ( 100+charges-1 ) )
		        doItemSetAttribute(n.uid,"description","Charges left [".. (charges - 1 ).."].")
		        doCreatureSetDropLoot(cid, false)
			doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(deathList[1]) and "a "..string.lower(getCreatureName(deathList[1])) or isCreature(deathList[1]) and getCreatureName(deathList[1]) or "a field item")..".\n[Aol protection]") 

	     elseif n.actionid > 101 then 
		        doItemSetAttribute(n.uid,"aid", ( n.actionid - 1 ) )
			doItemSetAttribute(n.uid,"description","Charges left [".. (n.actionid - 101 ) .."].")
	                doCreatureSetDropLoot(cid, false)
		        doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(deathList[1]) and "a "..string.lower(getCreatureName(deathList[1])) or isCreature(deathList[1]) and getCreatureName(deathList[1]) or "a field item")..".\n[Aol protection]") 
	    
	     elseif n.actionid == 101 then 
		        doCreatureSetDropLoot(cid, false)
		        doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(deathList[1]) and "a "..string.lower(getCreatureName(deathList[1])) or isCreature(deathList[1]) and getCreatureName(deathList[1]) or "a field item")..".\n[Aol protection]") 
                        doRemoveItem(n.uid)
		end
	end

	return true
end

then go to items.xml
and search for the id of the aol
Remove the charges thing you made , also remove show charges , and add this attribute
Code:
 <attribute key="description" value="Charges left [5]." />

Ofc you can edit the charges left, by changing them in the script and in items.xml
 
Last edited:
@ Damadger - Tried this code and not only did the amulet not have charges...I lost everything with red skull - Including the amulet that still says it has 5 charges! Back to the drawing board... :(
 
Good work Damadger, I have updated my red skull amulet thread and edited the code quite a bit.
 
Back
Top