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

Lua Magical weapon

Spo teh pro

New Member
Joined
Jan 3, 2008
Messages
319
Reaction score
1
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)

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

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

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_SPEED, -500)
setCombatCondition(combat, condition)

function getCombatFormulas(cid, level, magicLevel)
	local formula_min = -(level * 0 + magicLevel * 0) * 0 -	500
	local formula_max = -(level * 0 + magicLevel * 0) * 0 - 1000
	return formula_min, formula_max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas")

function onUseWeapon(cid, var)
    doCombat(cid, combat, var)
end

Well, this is what i got yet..
It's a weapon that shots everytime a "holy area", tho I dont want that, I want it to be critical and also it should paralyze the target

Does anyone know how to add that to the script?
Would be very kind of you, thanks!
 
Sometimes crit or all the time??

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)


local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_SPEED, -500)
setCombatCondition(combat, condition)


function onUseWeapon(cid, var)
    doCombat(cid, combat, var)
end

This is the wep without crit and without holy dmg anyways.
 
It shots holy damage around the target, its as huge like a explosion rune

Tho the weapon does that all the time and i want it to make it only sometimes (critical)
 
Last edited:
Code:
local chance = 10

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)

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

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

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionFormula(condition, -0.9, 0, -0.9, 0)
setCombatCondition(combat, condition)

function getCombatFormulas(cid, level, magicLevel)
	local formula_min = -(level * 0 + magicLevel * 0) * 0 -	500
	local formula_max = -(level * 0 + magicLevel * 0) * 0 - 1000
	return formula_min, formula_max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas")

function onUseWeapon(cid, var)
	if math.random(100) <= chance then
		doCombat(cid, combat, var)
	end
end
 
Code:
local chance = 10

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)

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

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

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionFormula(condition, -0.9, 0, -0.9, 0)
setCombatCondition(combat, condition)

function getCombatFormulas(cid, level, magicLevel)
	local formula_min = -(level * 0 + magicLevel * 0) * 0 -	500
	local formula_max = -(level * 0 + magicLevel * 0) * 0 - 1000
	return formula_min, formula_max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas")

function onUseWeapon(cid, var)
	if math.random(100) <= chance then
		doCombat(cid, combat, var)
	end
end

Okay, so this script is having a chance of 60% that it shots
I would like to have, that if you chose a target, it always shot and its a chance of 10% that you make critical (paralyze)

:p thats actually what I ment cus when I add local chance then it doesn't shot only with a chance of 10%
 
Code:
local chance = 10

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

function getCombatFormulas1(cid, level, magicLevel)
	local formula_min = -(level * 0 + magicLevel * 0) * 0 -	500
	local formula_max = -(level * 0 + magicLevel * 0) * 0 - 1000
	return formula_min, formula_max
end

function getCombatFormulas2(cid, level, magicLevel)
	local formula_min = -(level * 0 + magicLevel * 0) * 0 -	1000
	local formula_max = -(level * 0 + magicLevel * 0) * 0 - 2000
	return formula_min, formula_max
end

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionFormula(condition, -0.9, 0, -0.9, 0)

local combat = {}
for i = 1, 2 do
	table.insert(combat, createCombatObject())
	setCombatParam(combat[i], COMBAT_PARAM_BLOCKARMOR, 1)
	setCombatParam(combat[i], COMBAT_PARAM_BLOCKSHIELD, 1)
	setCombatParam(combat[i], COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
	setCombatParam(combat[i], COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
	local area = createCombatArea(arr)
	setCombatArea(combat[i], area)
	if i == 1 then
		setCombatCallback(combat[i], CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas1")
	else
		setCombatCallback(combat[i], CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas2")
		setCombatCondition(combat[i], condition)
	end
end

function onUseWeapon(cid, var)
	return doCombat(cid, combat[math.random(100) <= chance and 2 or 1], var)
end
 
thanks ^^

we just moved the arr in these lines :

Code:
else
		setCombatCallback(combat[i], CALLBACK_PARAM_LEVELMAGICVALUE, "getCombatFormulas2")
		setCombatCondition(combat[i], condition)
	        local area = createCombatArea(arr)
	        setCombatArea(combat[i], area)
 
hi xd
Code:
local chance = 10
local arr = {{0, 1, 0}, {1, 3, 1}, {0, 1, 0}}

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionFormula(condition, -0.9, 0, -0.9, 0)

local combat = {}
for i = 1, 2 do
	table.insert(combat, createCombatObject())
	setCombatParam(combat[i], COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
	if i == 1 then
		setCombatParam(combat[i], COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
		setCombatParam(combat[i], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
		setCombatFormula(combat[i], COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
	else
		setCombatParam(combat[i], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
		setCombatParam(combat[i], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
		setCombatFormula(combat[i], COMBAT_FORMULA_SKILL, 2, 0, 2, 0)
		setCombatCondition(combat[i], condition)
		local area = createCombatArea(arr)
		setCombatArea(combat[i], area)
	end
end

function onUseWeapon(cid, var)
	return doCombat(cid, combat[math.random(100) <= chance and 2 or 1], var)
end
 
Last edited:
used ur script

error =

Code:
[27/11/2009 17:50:47] Lua Script Error: [Weapon Interface] 
[27/11/2009 17:50:47] data/weapons/scripts/crystal_arrow.lua

[27/11/2009 17:50:47] luaSetCombatParam(). Combat not found

[27/11/2009 17:50:47] Lua Script Error: [Weapon Interface] 
[27/11/2009 17:50:47] data/weapons/scripts/crystal_arrow.lua

[27/11/2009 17:50:47] luaSetCombatParam(). Combat not found
 
Back
Top