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

[Weapon] Weapon with healing (healing % of weapon damage)

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -2.3, -1000, -3, -1400)

function onUseWeapon(cid, var)
if isPlayer(target) then
doCreatureAddMana(cid,mana)
doSendAnimatedText(getPlayerPosition(cid),"+"..Mana.."", TEXTCOLOR_BLUE)
doCombat(cid, combat, var)
else
doCreatureAddMana(cid, xmana)
doSendAnimatedText(getPlayerPosition(cid),"+"..xmana.."", TEXTCOLOR_BLUE)
doCombat(cid, combat, var)
end
return true
end
 
Can i ask for a weapon that have a chance to increase its atack speed by skill level?
 
sigh Let's just inject one line of my pro code from Frozen into this and make in a lot better.

Edit: Changed my mind. Make that two lines and a lookup table.

How about we do this: replace the lines starting from onUseWeapon to the assignment of 'mat' with this code:
Code:
function onUseWeapon(cid, var)
    local skillType = {
        [WEAPON_FIST ] = SKILL_FIST     ;
        [WEAPON_CLUB ] = SKILL_CLUB     ;
        [WEAPON_SWORD] = SKILL_SWORD    ;
        [WEAPON_AXE  ] = SKILL_AXE      ;
        [WEAPON_DIST ] = SKILL_DISTANCE ;
        } ;
    local attackWeapon   = getItemAttribute(getPlayerWeapon(cid, true).uid,  "attack") or getItemInfo(getPlayerWeapon(cid,  true)["itemid"])["attack"] ;
    local skill = getPlayerSkill(cid, skillType[getItemWeaponType(getPlayerWeapon(cid, true).uid)]) ;
    local level = getPlayerLevel(cid)/5 ;
    local mat = ( 0.085 * attackWeapon * skill + level ) ;

Now you don't have to multiple copies of this script with just one thing changed for different weapons, it will just read the value from the item itself. Additionally, any upgrade system that modifies the items attributes properly will properly be interactive with this.

Very very good brow !!!

and how can i do this if level?
is something like that

Lua:
if getPlayerLevel(cid) >= (LEVEL WEAPON) then

.....
Someone can help me?
 
Back
Top