royalpala
Well-Known Member
- Joined
- Dec 31, 2019
- Messages
- 85
- Solutions
- 1
- Reaction score
- 68
Hi, guys, need a little help with the following script, it works this way:
you have to attack using a specific bow and arrow in order to activate this effect and when you attack there´s a chance to change to another vocation for 3 seconds and when those 3 seconds end you come back to your normal vocation
can anyone help me check if the code is Ok? or give me some insight on this issue?
you have to attack using a specific bow and arrow in order to activate this effect and when you attack there´s a chance to change to another vocation for 3 seconds and when those 3 seconds end you come back to your normal vocation
can anyone help me check if the code is Ok? or give me some insight on this issue?
Lua:
------------------------------------------------------------------------
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.5, 1.5, 1.8, 2.5)
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat1, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat1, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)
setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 1.5, 1.5, 1.8, 2.5)
local condition = createConditionObject(setPlayerVocation(cid) == 5)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)
setCombatCondition(combat1, condition)
local function onUseWeapon1(parameters)
doCombat(parameters.cid, combat1, parameters.var)
end
function onUseWeapon(cid, var)
local parameters = { cid = cid, var = var, combat=combat, combat1 = combat1, condition=condition }
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8858 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8858 and getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 4 then
local chance = math.random(1,10)
if chance == 1 then
addEvent(onUseWeapon1, 1, parameters)
doSendAnimatedText(getPlayerPosition(cid),"DEVILEYE FRENZY!", TEXTCOLOR_GREEN)
else
return doCombat(cid, combat, var)
end
else
doPlayerSendCancel(cid, 'You need a crystal bow to shoot this arrow')
end
end