Gubailovo
Well-Known Member
- Joined
- Dec 19, 2013
- Messages
- 407
- Solutions
- 2
- Reaction score
- 62
I need weapons that increase their level with the number of hits.
I have an example of a staff.
But it works the other way around.
After applying a certain number of hits, it disappears.
\data\actions\lib\actions
\data\items\items
\data\actions\actions
\data\actions\scripts\stuff_astral_wand.lua
i tried adding to the library
But it didn't work. Perhaps you need to link this to a database. How to do it?
Thanks in advance for any hint.
I have an example of a staff.
But it works the other way around.
After applying a certain number of hits, it disappears.
\data\actions\lib\actions
Code:
function removeCharge(cid, itemuid)
charge = itemUseCharge(itemuid)
-- doPlayerSendTextMessage(cid,18,"заряды: "..charge )
if charge < 0 then
--doPlayerRemoveItem(cid, itemid, 1)
doRemoveItem(itemuid, 1)
doPlayerSendTextMessage(cid,20,"Заряды предмета закончились.")
end
end
function tryUseStuff(item)
charges = getItemCharges(item.uid)
if chrages >= 1 then
setItemCharges(item.uid, charges - 1)
return true
else
return false
end
end
\data\items\items
XML:
<item id="2453" isStuff="1" minLevel="10" charges="50000" priceSC="10">
<buff title="Death damage" func_name="buff_death_damage" value="1"/>
</item>
XML:
<action itemid="2453" script="stuff_astral_wand.lua" />
Lua:
attackType = ATTACK_DEATH
animationEffect = NM_ANI_SUDDENDEATH
hitEffect = NM_ME_MORT_AREA
damageEffect = NM_ME_DRAW_BLOOD
animationColor = BLACK
offensive = true
drawblood = true
SuddenDeathObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)
function onAttack(cid, cid2, item, frompos, topos, damage)
mana = 2
if tryUseAutomaticStuff(cid, topos, mana) == false then
return 0
end
removeCharge(cid, item.uid)
centerpos = {x=topos.x, y=topos.y, z=topos.z}
SuddenDeathObject.minDmg = stuffDamageMin(cid, 5.1)
SuddenDeathObject.maxDmg = stuffDamageMax(cid, 8.1)
doTargetMagicNoExhaustion(cid, centerpos, SuddenDeathObject:ordered())
return 1
end
i tried adding to the library
Lua:
function tryUseSword(item)
charges = getItemCharges(item.uid)
if chrages >= 1 then
setItemCharges(item.uid, charges + 1)
return true
else
return false
end
end
Thanks in advance for any hint.