Fresh from Bleach project requested this spell
spells.xml
../data/spells/scripts/attack/sticky_c4.lua
How it works?
Player throw C4 bomb that explode after 3 (config) seconds.
If attacker die before bomb count to 0 (it show 3,2,1 over attacked player head), it will not explode.
[video=youtube;l0JEzWDdbHE]http://www.youtube.com/watch?v=l0JEzWDdbHE[/video]
spells.xml
XML:
<instant name="Sticky C4" words="exori bomb" lvl="150" mana="20" prem="0" range="5" needtarget="1" blockwalls="1" exhaustion="1500" needlearn="0" event="script" value="attack/sticky_c4.lua">
<vocation id="1"/>
<vocation id="2"/>
<vocation id="5"/>
<vocation id="6"/>
</instant>
Lua:
-- config
local delay_time = 3
local dmg_min = 10
local dmg_max = 20
-- script
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
function C4check(cid, attacker, time)
if(not isCreature(attacker) or not isCreature(cid)) then
if(isCreature(cid)) then
local pos = getThingPosition(cid)
doSendAnimatedText(pos, "Miss", 18)
doSendMagicEffect(pos, CONST_ME_POFF)
end
return
end
local pos = getThingPosition(cid)
if(time > 0) then
doSendAnimatedText(pos, time, 180)
addEvent(C4check, 1000, cid, attacker, time - 1)
else
doTargetCombatHealth(attacker, cid, COMBAT_UNDEFINEDDAMAGE, -dmg_min, -dmg_max, CONST_ME_EXPLOSIONAREA)
end
end
function onCastSpell(cid, var)
local target = variantToNumber(var)
if(isCreature(target) and doCombat(cid, combat, var)) then
C4check(target, cid, delay_time)
return true
end
return false
end
Player throw C4 bomb that explode after 3 (config) seconds.
If attacker die before bomb count to 0 (it show 3,2,1 over attacked player head), it will not explode.
[video=youtube;l0JEzWDdbHE]http://www.youtube.com/watch?v=l0JEzWDdbHE[/video]
Last edited: