- Joined
- Jul 7, 2007
- Messages
- 4,049
- Reaction score
- 238
Hey
I always try to make unique stuff, some may be useful, some may not, I am doing this mostly to think of new unique ideas, so here goes a new one
I am here to show my newest spell, which I have called "Storm of the Century"
Youtube Video:
"Okay, that was weird" is what you may be thinking, allow me to explain:
This spell has no fixed area, the spell's area is calculated during the casting of the spell, which means that every time a player uses this spell, a different area is affected, some tiles might even get hit more then once!
This was tested in TFS 0.4, but it should work on TFS 0.3.7 also, not sure about TFS 0.2, if someone could try it and let me know if it works I'd be grateful
I always try to make unique stuff, some may be useful, some may not, I am doing this mostly to think of new unique ideas, so here goes a new one
I am here to show my newest spell, which I have called "Storm of the Century"
Youtube Video:
"Okay, that was weird" is what you may be thinking, allow me to explain:
This spell has no fixed area, the spell's area is calculated during the casting of the spell, which means that every time a player uses this spell, a different area is affected, some tiles might even get hit more then once!
Code:
local config = {
minAttacks = 100, --Change the minimum number of attacks here
maxAttacks = 300, --Change the maximum number of attacks here
expansionInterval = 300, --Change here how many ms it takes at max between expansions(it can be a random value between 0 and this value)
spreadPercent = 20, --Change here the expansion %
combatType = COMBAT_ENERGYDAMAGE, --Change here the combat type
effectType = { {90, 10}, {CONST_ME_ENERGYHIT, CONST_ME_BIGCLOUDS} } --Change here the effect types, in the first table you set the chance of each effect to happen(must always sum to 100) and in the second table you set what effects appear
}
local function damageFormula(cid)
local minDmg = (getPlayerLevel(cid) / -5 + getPlayerMagLevel(cid) * 1) * -5 + -5
local maxDmg = (getPlayerLevel(cid) / -5 + getPlayerMagLevel(cid) * 1) * -5 + -12
return {min = minDmg, max = maxDmg}
end
local function stormSpreads(cid, pos, remainingArea)
if remainingArea[1] <= 0 or not isCreature(cid) then
return false
end
remainingArea[1] = remainingArea[1] - 1
local dmg = damageFormula(cid)
--Random effect calculation
local eff = config.effectType[2][1]
local efc = math.random(1, 100)
for i = 1, #config.effectType[1] do
if(efc < config.effectType[1]) then
eff = config.effectType[2]
break
else
efc = efc - config.effectType[1]
end
end
--/Random effect calculation
doCombatAreaHealth(cid, config.combatType, pos, nil, dmg.min, dmg.max, eff)
--Random area calculations
local posArray = {
[1] = {{x = pos.x, y = pos.y - 1, z = pos.z}, {2,4}}, --North
[2] = {{x = pos.x - 1, y = pos.y, z = pos.z}, {1,3}}, --East
[3] = {{x = pos.x, y = pos.y + 1, z = pos.z}, {2,4}}, --South
[4] = {{x = pos.x + 1, y = pos.y, z = pos.z}, {1,3}} --West
}
local i = math.random(1, 4)
addEvent(stormSpreads, config.expansionInterval, cid, posArray[1], remainingArea, i)
if math.random(1, 100) <= config.spreadPercent then
if isSightClear(pos, posArray[posArray[2][1]][1], true) then
addEvent(stormSpreads, math.random(0, config.expansionInterval), cid, posArray[posArray[2][1]][1], remainingArea, i)
end
end
if math.random(1, 100) <= config.spreadPercent then
if isSightClear(pos, posArray[posArray[2][2]][1], true) then
addEvent(stormSpreads, math.random(0, config.expansionInterval), cid, posArray[posArray[2][2]][1], remainingArea, i)
end
end
--/Random area calculations
return true
end
function onCastSpell(cid, var)
return stormSpreads(cid, getCreaturePosition(cid), {math.random(config.minAttacks, config.maxAttacks)})
end
Last edited by a moderator: