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

Spell Sticky C4

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
Fresh from Bleach project requested this spell :D
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>
../data/spells/scripts/attack/sticky_c4.lua
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
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]
 
Last edited:
@Up

Find this line:
Lua:
		doTargetCombatHealth(attacker, cid, COMBAT_UNDEFINEDDAMAGE, -dmg_min, -dmg_max, CONST_ME_EXPLOSIONAREA)

And change the
Lua:
 COMBAT_UNDEFINEDDAMAGE
to one of these:

Lua:
COMBAT_NONE = 0
COMBAT_PHYSICALDAMAGE = 1
COMBAT_ENERGYDAMAGE = 2
COMBAT_EARTHDAMAGE = 4
COMBAT_POISONDAMAGE = 4
COMBAT_FIREDAMAGE = 8
COMBAT_UNDEFINEDDAMAGE = 16
COMBAT_LIFEDRAIN = 32
COMBAT_MANADRAIN = 64
COMBAT_HEALING = 128
COMBAT_DROWNDAMAGE = 256
COMBAT_ICEDAMAGE = 512
COMBAT_HOLYDAMAGE = 1024
COMBAT_DEATHDAMAGE = 2048
 
I set damage undefined to make it unblockable by any monster/player immunities/elements.
@Mooosie
:huh: I didn't know why it does not show damage. Thx for information ^_^
 
Thanks , i loved the spell but can you make it a rune for me?

Yours Tobbe :)
XML:
	<rune name="Sticky C4" id="2295" allowfaruse="1" charges="5" lvl="50" maglv="35" exhaustion="2000" needtarget="1" blocktype="solid" event="script" value="attack/sticky_c4.lua">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="5" showInDescription="0"/>
		<vocation id="6" showInDescription="0"/>
	</rune>
Not tested, but should work. Change item ID, because I set id of rune already configured in TFS spells.xml
 
XML:
	<rune name="Sticky C4" id="2295" allowfaruse="1" charges="5" lvl="50" maglv="35" exhaustion="2000" needtarget="1" blocktype="solid" event="script" value="attack/sticky_c4.lua">
		<vocation id="1"/>
		<vocation id="2"/>
		<vocation id="5" showInDescription="0"/>
		<vocation id="6" showInDescription="0"/>
	</rune>
Not tested, but should work. Change item ID, because I set id of rune already configured in TFS spells.xml

Thanks alot mate it worked rep+!: )
 
Back
Top