local combat = {}
local hits = 3 -- default sword attacks per hit is 3
local interval = math.floor(2000 / hits)
for x = 1, hits do
combat[x] = Combat()
combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function damage()
min = -225
max = -275
return min, max
end
combat[x]:setCallback(CALLBACK_PARAM_SKILLVALUE, "damage")
end
function onUseWeapon(player, var)
for x = 1, hits do
addEvent(function() combat[x]:execute(player, var) end, x * interval)
end
return true
end
Ahh nice man! thank!! do you know if whilst using this if you "reload items" it crashes the server? its the only problem with the script i'm using. Its just been way down on the priorities list..also had the nil value error. i tried to fix it for like 30mins.. but then gave up and remade the entire script.
This works without errors for me [TFS 1.0]
Code:local combat = {} local hits = 3 -- default sword attacks per hit is 3 local interval = math.floor(2000 / hits) for x = 1, hits do combat[x] = Combat() combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) function damage() min = -225 max = -275 return min, max end combat[x]:setCallback(CALLBACK_PARAM_SKILLVALUE, "damage") end function onUseWeapon(player, var) for x = 1, hits do addEvent(function() combat[x]:execute(player, var) end, x * interval) end return true end
local combat = Combat()
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, 1)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setFormula(COMBAT_FORMULA_SKILL, 0.8, 0, 0.8, 0)
local function addCombat(cid, combat, var)
local player = Player(cid)
if not player then
return false
end
if not player:getTarget() then
return false
end
return combat:execute(cid, var)
end
function onUseWeapon(player, var)
addEvent(addCombat, 1000, player:getId(), combat, var)
return combat:execute(player, var)
end
are you "reload items" while game is online?
i assume reload items is something similar to "reload server"
else i have no idea what are you talking about. i'm quite new for OT slang.
If my assumption is correct, maybe someone had addEvent unfinished and it crashed? [all i could think of]
also had the nil value error. i tried to fix it for like 30mins.. but then gave up and remade the entire script.
This works without errors for me [TFS 1.0]
Code:local combat = {} local hits = 3 -- default sword attacks per hit is 3 local interval = math.floor(2000 / hits) for x = 1, hits do combat[x] = Combat() combat[x]:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) function damage() min = -225 max = -275 return min, max end combat[x]:setCallback(CALLBACK_PARAM_SKILLVALUE, "damage") end function onUseWeapon(player, var) for x = 1, hits do addEvent(function() combat[x]:execute(player, var) end, x * interval) end return true end
same problem with your code too.just use the one i posted and its fixed haha evan is the mvp.
bleed.what error are you getting with the code i posted? that bleed? or the nil?
bleed.
Its not an error, its a bug.
You can see for yourself in your own server.
Hit the enemy once and escape from target (You shouldn't be able to hit the second hit, but the combat event has already been set with first hit)