• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Advanced Weapon TFS 1.3

Adorius Black

Advanced OT User
Joined
Mar 31, 2020
Messages
348
Solutions
3
Reaction score
226
Hi I was searching alot but I cannot find weapon like this. I am looking for weapon for example Solar axe that attack normal but there is 10% chance to hit critical. But critical hit will be like little exevo gran mas vis for example 5x5 SQM. Maybe somebody remember this type of weapon from old veterana OTS.

Thank you
 
Last edited:
Solution
Hello, its my simple weapon witch effects, should help you reach your goal :)

LUA:
--0 - fist - SKILL_FIST
--1 - club - SKILL_CLUB
--2 - sword - SKILL_SWORD
--3 - axe - SKILL_AXE
--4 - distance - SKILL_DISTANCE
--5 - shield - SKILL_SHIELD
--13 - mlvl
-- param - multipler of chance

function chanceToUseSkills(player, skill, param)
    local skillValue = player:getEffectiveSkillLevel(skill)
    local chance = 0.0
    local level = player:getLevel()

    if skill == 13 then
        skillValue = player:getMagicLevel()
    end
    chance = level/100 + (( skillValue /8) * param)
    -- print ("chance: " .. chance .. ", weapon skill " .. skillValue) -- debug info
    return chance
end

local combat1 = createCombatObject()...
Hello, its my simple weapon witch effects, should help you reach your goal :)

LUA:
--0 - fist - SKILL_FIST
--1 - club - SKILL_CLUB
--2 - sword - SKILL_SWORD
--3 - axe - SKILL_AXE
--4 - distance - SKILL_DISTANCE
--5 - shield - SKILL_SHIELD
--13 - mlvl
-- param - multipler of chance

function chanceToUseSkills(player, skill, param)
    local skillValue = player:getEffectiveSkillLevel(skill)
    local chance = 0.0
    local level = player:getLevel()

    if skill == 13 then
        skillValue = player:getMagicLevel()
    end
    chance = level/100 + (( skillValue /8) * param)
    -- print ("chance: " .. chance .. ", weapon skill " .. skillValue) -- debug info
    return chance
end

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 46)

setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
local combat2 = createCombatObject()

setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)

setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

local arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 3, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 0, 1, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0}
 
}
 
local area = createCombatArea(arr)
setCombatArea(combat1, area)
 
function onUseWeapon(cid, var)
    pos = getPlayerPosition(cid)
    rand = math.random(1,100)
    if chanceToUseSkills(cid, SKILL_CLUB, 1.1) >= rand then
        doCombat(cid, combat1, var)
    end
    return doCombat(cid, combat2, var)
end
 
Solution

Similar threads

Back
Top