erikbs
Member
- Joined
- Jul 15, 2010
- Messages
- 41
- Reaction score
- 9
Hi there.
Here is a little script that I found to be cool. Iam just testing it on a closed server with only a limited amount of players, so I have no idea if this makes your server lag when more people are online.
Here is a wand script:
This script has a min and max dmg formula which it bases it damage lvling on.
So in this example, after a player has fired this wand 250 times, it will increase its damage by 3%.
in weapons.xml
Here is how it can be done on a melee weapon, in this case a two handed one:
in weapons.xml
Hope someone finds this usable
Here is a little script that I found to be cool. Iam just testing it on a closed server with only a limited amount of players, so I have no idea if this makes your server lag when more people are online.
Here is a wand script:
This script has a min and max dmg formula which it bases it damage lvling on.
So in this example, after a player has fired this wand 250 times, it will increase its damage by 3%.
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
local executionCounterStorage = 120 -- Set the storage value to track execution count
local damageIncreasePercent = 3 -- Damage increase percentage
local damageIncreaseThreshold = 250 -- Threshold for damage increase
function onGetFormulaValues(player, level, magicLevel)
local min = (level * 1.1) + (magicLevel * 4) + 5
local max = (level * 1.15) + (magicLevel * 6) + 15
-- Check execution count and increase damage if needed
local executionCount = getPlayerStorageValue(player, executionCounterStorage) or 0
local damageIncrease = math.floor(executionCount / damageIncreaseThreshold) * damageIncreasePercent
min = min + (min * damageIncrease / 100)
max = max + (max * damageIncrease / 100)
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
arr1 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
local area = createCombatArea(arr1)
setCombatArea(combat, area)
function onUseWeapon(cid, var)
local executionCount = getPlayerStorageValue(cid, executionCounterStorage) or 0
setPlayerStorageValue(cid, executionCounterStorage, executionCount + 1)
if executionCount % damageIncreaseThreshold == 0 then
local damageIncrease = math.floor(executionCount / damageIncreaseThreshold) * damageIncreasePercent
Player(cid):sendTextMessage(MESSAGE_INFO_DESCR, "You increased the power of the wand by a total of " .. damageIncrease .. "%!")
end
return doCombat(cid, combat, var)
end
in weapons.xml
Lua:
<wand id="26708" level="1" mana="8" script="energywand.lua"> <!-- Your new Wand -->
<vocation name="Mage"/>
<vocation name="Elder Druid"/>
<vocation name="Sorcerer"/>
<vocation name="Master Sorcerer"/>
</wand>
Here is how it can be done on a melee weapon, in this case a two handed one:
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS) -- You can change this to the desired effect
local executionCounterStorage = 200 -- Set the storage value to track execution count
local damageIncreasePercent = 5 -- Damage increase percentage
local damageIncreaseThreshold = 250 -- Threshold for damage increase
function onGetFormulaValues(player, skill, attack)
local min = (player:getLevel() * 2) + (skill * 2.8) + (attack * 1.4) + 25
local max = (player:getLevel() * 3) + (skill * 3.2) + (attack * 1.8) + 50
-- Check execution count and increase damage if needed
local executionCount = getPlayerStorageValue(player, executionCounterStorage) or 0
local damageIncrease = math.floor(executionCount / damageIncreaseThreshold) * damageIncreasePercent
min = min + (min * damageIncrease / 100)
max = max + (max * damageIncrease / 100)
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local area = createCombatArea({{1}})
setCombatArea(combat, area)
function onUseWeapon(cid, var)
local executionCount = getPlayerStorageValue(cid, executionCounterStorage) or 0
setPlayerStorageValue(cid, executionCounterStorage, executionCount + 1)
if executionCount % damageIncreaseThreshold == 0 then
local damageIncrease = math.floor(executionCount / damageIncreaseThreshold) * damageIncreasePercent
Player(cid):sendTextMessage(MESSAGE_INFO_DESCR, "You increased the power of your weapon by a total of " .. damageIncrease .. "%!")
end
return doCombat(cid, combat, var)
end
in weapons.xml
Lua:
<melee id="27024" script="greatsword.lua" />
Hope someone finds this usable