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

Exori that power depends on skill

KaczooH

Co tu wpisac?
Joined
Oct 12, 2007
Messages
904
Reaction score
0
Hiho all :)

I'm not even nooby in LUA scripts but I made up some script which DOESN'T work now. Console doesn't show any error in syntax or so. I wish ask you if could you improve it.

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
-- setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.2, -30, -1.1, 0)

function onCastSpell(cid, var)

local sword = getPlayerSkill(cid,2)
local axe = getPlayerSkill(cid,3)
local club = getPlayerSkill(cid,1)

if sword > axe then
	if sword > club then local skill = sword
	else local skill = club
	end
else local skill = axe
end



local damage_min = skill
local damage_max = skill

local combat = math.random(damage_min, damage_max)

setCombatFormula(combat, var)

local arr = {
{1, 1, 1},
{1, 2, 1},
{1, 1, 1}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)


	return doCombat(cid, combat, var)
end

Best regards.
 
Last edited:
Yup, algorithm is mine but this one doesnt work right. If someone who is well-know in lua could check it it would be great :)

BTW. It's my first "released" "script" ;)

Oh, it's in this section of forum cause before reorganisation it was Spell section (not finished)
 
Last edited:
oke i'v made it really gast since i'm in class now i'v seen 1 bug in the script but you can fix it here try this

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(cid, level, maglevel)
	min = -(local skill * 22) / 10
	max = -(local skill * 38.5) /10
	
	return min, max
end

function onCastSpell(cid, var)

local sword = getPlayerSkill(cid,2)
local axe = getPlayerSkill(cid,3)
local club = getPlayerSkill(cid,1)

if sword < axe then local skill = axe
else
local skill = sword
elseif sword < club then local skill = club
	end

local combat = math.random(min, max)

setCombatFormula(combat, var)

local arr = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 1, 2, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
end
 
oke i'v made it really gast since i'm in class now i'v seen 1 bug in the script but you can fix it here try this

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(cid, level, maglevel)
	min = -(local skill * 22) / 10
	max = -(local skill * 38.5) /10
	
	return min, max
end

function onCastSpell(cid, var)

local sword = getPlayerSkill(cid,2)
local axe = getPlayerSkill(cid,3)
local club = getPlayerSkill(cid,1)

if sword < axe then local skill = axe
else
local skill = sword
elseif sword < club then local skill = club
	end

local combat = math.random(min, max)

setCombatFormula(combat, var)

local arr = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 1, 2, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
end

Lua Script Error: [Spell Interface]
data/spells/scripts/berserk.lua:eek:nCastSpell

data/spells/scripts/berserk.lua:24: bad argument #1 to 'random' (number expected, got nil)
Warning: [Event::loadScript] Can not load script. data/spells/scripts/berserk.lua
data/spells/scripts/berserk.lua:5: unexpected symbol near 'local'
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(cid, level, maglevel)
	min = -(level * 22) / 10
	max = -(level * 38.5) / 10
	
	return min, max
end

function onCastSpell(cid, var)


local sword = getPlayerSkill(cid,2)
local axe = getPlayerSkill(cid,3)
local club = getPlayerSkill(cid,1)

if sword < axe then local skill = axe
else
local skill = sword
elseif sword < club then local skill = club
	end

local combat = math.random(min, max)

setCombatFormula(combat, var)

local arr = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 1, 2, 1, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0}
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
end

If this doesn't works fix it and give i give rep++.
 
Back
Top