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

Help fix spell script! REP++

Zeeh1997

New Member
Joined
Jan 1, 2010
Messages
29
Reaction score
0
Anyone can help me to fix a spell script that i've been made?
I am a Lua begginer so please calm down

That's the code:

Lua:
local luck = math.random(1,10)

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, TRUE)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.0, 0, 1.8, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSYCALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat2, COMBAT_PARAM_USECHARGES, TRUE)
setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 1.6, 0, 3.2, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_BLOCKARMOR, TRUE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat3, COMBAT_PARAM_USECHARGES, TRUE)
setCombatFormula(combat3, COMBAT_FORMULA_SKILL, 2.4, 0, 6.4, 0)

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

local area2 = createCombatArea(AREA_CIRCLE2X2)
setCombatArea(combat2, area2)

local area3 = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onCastSpell(cid,var)
         if luck <= 6 then
         return doCombat(cid,combat,var)
         doSendAnimatedText(cid,"Weak Charge",89)
         elseif luck <= 9 then
         return doCombat(cid,combat2,var)
         doSendAnimatedText(cid,"Strong Charge!!!",5)         
         elseif luck == 10 then
         return doCombat(cid,combat3,var)
         doSendAnimatedText(cid,"Maximum Charge Haaa!!!",180)
         end
return TRUE
end

And the error message:
PHP:
ERROR: Unstable Berserk.lua:36: 'end' expected (to close 'if' at line 34) near 'doSendAnimatedText'

I try to put an end on the last line,so it's not worked,so I need help.

Bye Bye :p
 
Code:
local luck = math.random(1, 10)
local conditions = {}
for i = 1, 3 do
	conditions[i] = createCombatObject()
	setCombatParam(conditions[i], COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
	setCombatParam(conditions[i], COMBAT_PARAM_BLOCKARMOR, true)
	setCombatParam(conditions[i], COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
	setCombatParam(conditions[i], COMBAT_PARAM_USECHARGES, true)
	for k = 1.0, 2.4 do
		for _ = 1.8, 6.4 do
			setCombatFormula(conditions[i], COMBAT_FORMULA_SKILL, k, 0, _, 0)
		end
	end
end
conditions[1].area = createCombatArea(AREA_SQUARE1X1)
conditions[2].area = createCombatArea(AREA_CIRCLE2X2)
conditions[3].area = createCombatArea(AREA_CIRCLE3X3)
for condition, area in ipairs(conditions) do
	setCombatArea(condition, area.area)
end

function onCastSpell(cid,var)
	if luck <= 6 then
		doCombat(cid, conditions[1], var)
		doSendAnimatedText(cid,"Weak Charge",89)
	elseif luck <= 9 then
		doCombat(cid, conditions[2], var)
		doSendAnimatedText(cid,"Strong Charge!!!",5)        
	elseif luck == 10 then
		doCombat(cid, conditions[3], var)
		doSendAnimatedText(cid,"Maximum Charge Haaa!!!",180)
	end
	return true
end
 
Code:
local luck = math.random(1, 10)
after
PHP:
onCastSpell
plax or there is no luck it's just the same all time..
 
Thks to all,I will rep you guys, later I test Summ's method.
Bye :)

Yes! i removed the return's and moved the luck to the place that Summ telled,and the otscript debug and the own server no detected errors =D
 
Last edited:
Back
Top