3li Xiber
Active Member
- Joined
- Dec 29, 2014
- Messages
- 395
- Reaction score
- 31
i really tried to fix this but i can't
The Problem is My item Don't Lose its Charges when i attack a monster or player.
---------------------------------------------------------
http://otland.net/threads/charges.228893/
---------------------------------------------------------
I had put this in my Actions folder
-----------------------------
<action itemid="2307" event="script" value="charge.lua"/>
---------------------------------------------------
----------------------------
Weapons
------------------------
----------------------------------------------------------------------
------------------------
Items
------------------------
The Problem is My item Don't Lose its Charges when i attack a monster or player.
---------------------------------------------------------
http://otland.net/threads/charges.228893/
---------------------------------------------------------
I had put this in my Actions folder
Code:
local config = {
manaCost = 300,
soulCost = 2
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 2307 and isInArray({2401}, itemEx.itemid)) then
doTransformItem(itemEx.uid, 2433, 1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 53)
return true
elseif(item.itemid == 2307 and isInArray({2433}, itemEx.itemid)) then
local subtype = itemEx.type
doTransformItem(itemEx.uid, 2433, subtype+1)
doRemoveItem(item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), 53)
return true
end
if subtype >= 5 then
return true
end
if(isInArray(enchantableGems, item.itemid)) then
local subtype = item.type
if(subtype == 0) then
subtype = 1
end
local mana = config.manaCost
if(getPlayerMana(cid) < mana) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
return true
end
local soul = config.soulCost
if(getPlayerSoul(cid) < soul) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
return true
end
local a = table.find(enchantableGems, item.itemid)
if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
return false
end
local info = getItemInfo(enchantedGems[a])
doTransformItem(item.uid, enchantedGems[a], info.charges)
doPlayerAddMana(cid, -mana)
doPlayerAddSoul(cid, -soul)
doPlayerAddSpentMana(cid, mana)
doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
return true
end
local b = table.find(enchantedGems, item.itemid)
if(b == nil) then
return false
end
local subtype = itemEx.type
if(not isInArray({2401, 2401}, itemEx.itemid)) then
subtype = 1000
end
doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid], subtype)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
doRemoveItem(item.uid, 1)
doDecayItem(itemEx.uid)
return true
end
-----------------------------
<action itemid="2307" event="script" value="charge.lua"/>
---------------------------------------------------
----------------------------
Weapons
------------------------
Code:
<wand id="2433" level="8" mana="13" min="555" max="755" type="holy" event="function" value="default"> <!-- Death Stick -->
<vocation id="2"/>
</wand>
----------------------------------------------------------------------
------------------------
Items
------------------------
Code:
<item id="2433" article="a" name="Death Stick">
<attribute key="description" value="It is filled with enormous power from the owners."/>
<attribute key="weight" value="2850"/>
<attribute key="weaponType" value="wand"/>
<attribute key="decayTo" value="2401"/>
<attribute key="charges" value="500"/>
<attribute key="showcharges" value="1"/>
<attribute key="range" value="5"/>