• 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 Red Skull Amulet - Beta Version Released!

Status
Not open for further replies.

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
creaturescripts/creaturescripts.xml
Code:
<event type="preparedeath" name="RedSkullAmulet" event="script" value="script.lua"/>

creaturescripts/scripts/login.lua
Code:
registerCreatureEvent(cid, "RedSkullAmulet")

  • Version 1.0 - Tested and working on 0.3 & 0.4.

creaturescripts/scripts/script.lua
Code:
function onPrepareDeath(cid, deathList)
	if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == [COLOR="red"]2196[/COLOR] then
		if getCreatureSkullType(cid) < 5 and doPlayerRemoveItem(cid, [COLOR="red"]2196[/COLOR], 1) then
			doSetCreatureDropLoot(cid, false)
		end
	end

	return true
end

  • Version 2.0 - Beta

creaturescripts/scripts/script.lua
Code:
local corpse_ids = {
	[0] = 3065,
	[1] = 3058
}

local config = {
	charges = 5
}

function onPrepareDeath(cid, deathList)
	if getCreatureSkullType(cid) < 5 then
		if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2196 then
			if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid < 100 then
				doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid, "aid", (100 + config.charges - 1))
			elseif getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid > 101 then 
				doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid, "aid", (getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid - 1))
			elseif getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid == 101 then 
				doRemoveItem(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid)
			end
		end
	end
	
	return doCreatureSetDropLoot(cid, false) and doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).uid, "description", "It has " .. (getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid - 101) .. "x charge" .. ((getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).actionid - 101) > 1 and "s" or "") .. ".") and 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") .. ".\nHis soul was protected.")
end

  • Update Log - Beta Version 2.0

  1. Charges are now optional for the amulet.
  2. Corpse now creates and has the following description.
  3. The amulet itself will have the amount of charges left.
 
Last edited:
First post updated.
 
Status
Not open for further replies.
Back
Top