• 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 Help with weapon

owned

Excellent OT User
Joined
Nov 9, 2008
Messages
2,001
Solutions
3
Reaction score
563
Location
New York
Im trying to make it so that theres a 5% chance to para the target when hit. could someone help me. this is what i currently have:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

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

function onUseWeapon(cid, var)
local ret = doCombat(cid, combat, var)
if(ret == false) then
return false
end

local target = variantToNumber(var)
if(target ~= 0) then

local chance = math.random(0, 100)
if(chance = 1,5) then
ret = doCombat(cid, combat, var)
end
end
return ret
end
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

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

function onUseWeapon(cid, var)
	local ret = doCombat(cid, combat, var)
	if not ret then
		return false
	end

	local target = variantToNumber(var)
	if isCreature(target) then
		local chance = math.random(100)
		if chance <= 5 then
			doAddCondition(target, condition)
		end
	end
	return true
end
 
Back
Top