aioriusox
New Member
- Joined
- Apr 8, 2009
- Messages
- 70
- Reaction score
- 0
Elemental Powers
When one of the elemental powers is used, the player is surrounded by effects, and who are near and fall on purpose, take damage.
The damage is related to the level and magic level of the player who used the elemental power.
name: Elemental powers
version: 8.4x
type of script: Action
tested server: The forgotten server 0.3.3
author: Pivigu
When one of the elemental powers is used, the player is surrounded by effects, and who are near and fall on purpose, take damage.
The damage is related to the level and magic level of the player who used the elemental power.
Add in Actions.xml
PHP:
<action itemid="2177" script="elemental power.lua"/>
<action itemid="5809" script="elemental power.lua"/>
<action itemid="2176" script="elemental power.lua"/>
<action itemid="2141" script="elemental power.lua"/>
add in data/actions/scripts
elemental power.lua
PHP:
- Summary
- When the character using the script, will show different effects
- Around him and the monsters or players who are
- The damage will take place on the level and magic level.
- End
local conf = {
chance = 35,
damageOnlyInMonsters = FALSE,
dano = {gelo = 5, fogo = 5, terra = 6, energia = 6, min = 10, max = 0},
ids = {gelo = 2177, fogo = 2141, terra = 2176, energia = 5809},
radius = {gelo = 3, fogo = 3, terra = 4, energia = 4},
intervalo = {gelo = 1, fogo = 1, terra = 1.5, energia = 1.5},
quantidade = {gelo = 5, fogo = 5, terra = 3, energia = 3},
effect = {gelo = CONST_ME_GIANTICE, fogo = CONST_ME_FIREWORK_RED, terra = CONST_ME_BIGPLANTS, energia = CONST_ME_ENERGYAREA},
shot = {gelo = CONST_ANI_ICE, fogo = CONST_ANI_FIRE, terra = CONST_ANI_POISON, energia = CONST_ANI_ENERGYBALL},
color = {gelo = TEXTCOLOR_LIGHTBLUE, fogo = TEXTCOLOR_RED, terra = TEXTCOLOR_GREEN, energia = TEXTCOLOR_BLUE},
mana = {gelo = 100, fogo = 100, terra = 80, energia = 80},
soul = {gelo = 10, fogo = 10, terra = 8, energia = 8},
}
function onUse(cid, item, pos, toPos)
if getPlayerStorageValue(cid, 34805) > 0 then
return FALSE
end
if item.itemid == conf.ids.gelo then
if (getPlayerMana(cid) < conf.mana.gelo or getPlayerSoul(cid) < conf.soul.gelo) and getPlayerAccess(cid) < 3 then
doPlayerSendCancel(cid, "You have no need to use the elemental power.")
return FALSE
end
doRemoveItem(item.uid, 1)
doCreatureAddMana(cid, conf.mana.gelo * (-1))
doPlayerAddSoul(cid, conf.soul.gelo * (-1))
doAddDamageRadius(cid, 1, conf.radius.gelo, conf.shot.gelo, conf.effect.gelo, conf.color.gelo, conf.dano.gelo, conf.intervalo.gelo, conf.quantidade.gelo)
end
if item.itemid == conf.ids.energia then
if (getPlayerMana(cid) < conf.mana.energia or getPlayerSoul(cid) < conf.soul.energia) and getPlayerAccess(cid) < 3 then
doPlayerSendCancel(cid, "You have no need to use the elemental power.")
return FALSE
end
doRemoveItem(item.uid, 1)
doCreatureAddMana(cid, conf.mana.energia * (-1))
doPlayerAddSoul(cid, conf.soul.energia * (-1))
doAddDamageRadius(cid, 1, conf.radius.energia, conf.shot.energia, conf.effect.energia, conf.color.energia, conf.dano.energia, conf.intervalo.energia, conf.quantidade.energia)
end
if item.itemid == conf.ids.terra then
if (getPlayerMana(cid) < conf.mana.terra or getPlayerSoul(cid) < conf.soul.terra) and getPlayerAccess(cid) < 3 then
doPlayerSendCancel(cid, "You have no need to use the elemental power.")
return FALSE
end
doRemoveItem(item.uid, 1)
doCreatureAddMana(cid, conf.mana.terra * (-1))
doPlayerAddSoul(cid, conf.soul.terra * (-1))
doAddDamageRadius(cid, 1, conf.radius.terra, conf.shot.terra, conf.effect.terra, conf.color.terra, conf.dano.terra, conf.intervalo.terra, conf.quantidade.terra)
end
if item.itemid == conf.ids.fogo then
if (getPlayerMana(cid) < conf.mana.fogo or getPlayerSoul(cid) < conf.soul.fogo) and getPlayerAccess(cid) < 3 then
doPlayerSendCancel(cid, "You have no need to use the elemental power.")
return FALSE
end
doRemoveItem(item.uid, 1)
doCreatureAddMana(cid, conf.mana.fogo * (-1))
doPlayerAddSoul(cid, conf.soul.fogo * (-1))
doAddDamageRadius(cid, 1, conf.radius.fogo, conf.shot.fogo, conf.effect.fogo, conf.color.fogo, conf.dano.fogo, conf.intervalo.fogo, conf.quantidade.fogo)
end
return TRUE
end
function doAddDamageRadius(cid, type, radius, shot, effect, color, danoD, intervalo, quantidade)
if getTilePzInfo(getThingPos(cid)) == TRUE then
setPlayerStorageValue(cid, 34805, 0)
return FALSE
end
setPlayerStorageValue(cid, 34805, 1)
pos = {from = {x=getThingPos(cid).x-radius, y=getThingPos(cid).y-radius, z=getThingPos(cid).z, stackpos = 1}, to = {x=getThingPos(cid).x+radius, y=getThingPos(cid).y+radius, z=getThingPos(cid).z, stackpos = 1}}
local getCreature = getThingFromPos(pos.from)
local posNow = pos.from
local mlv = getPlayerMagLevel(cid)
local lvl = getPlayerLevel(cid)
local formula = math.floor(((mlv + 1) * 3 + (lvl + 1) * 2) * danoD * 0.01 + math.random(0,200))
for i = pos.from.x, pos.to.x do
for n = pos.from.y, pos.to.y do
if math.random(1,100) < conf.chance then
if getThingFromPos(getThingPos(cid)).uid ~= cid then
return FALSE
end
posNow = {x=i, y=n, z=pos.from.z, stackpos = 253}
getCreature = getThingFromPos(posNow)
formula = math.floor(((mlv + 1) * 3 + (lvl + 1) * 2) * danoD * 0.01 + math.random(0,200))
if formula < conf.dano.min and conf.dano.min > 0 then
formula = conf.dano.min
elseif formula > conf.dano.max and conf.dano.max > 0 then
formula = conf.dano.max
end
if (doTileQueryAdd(cid, posNow) == 1 or isCreature(getCreature.uid) == TRUE) and getTilePzInfo(posNow) == FALSE and isNpc(getCreature.uid) == FALSE then
if formula > 0 then
doSendDistanceShoot({x=posNow.x-10, y=posNow.y-10, z=posNow.z}, posNow, shot)
if isPlayer(getCreature.uid) == TRUE then
if conf.damageOnlyInMonsters == FALSE then
if getPlayerAccess(getCreature.uid) > 1 then
doSendMagicEffect(posNow, CONST_ME_POFF)
else
doSendMagicEffect(posNow, effect)
if isCreature(getCreature.uid) == TRUE and getCreature.uid ~= cid then
doCreatureAddHealth(getCreature.uid, formula * (-1))
doSendAnimatedText(posNow, formula, color)
end
end
end
else
doSendMagicEffect(posNow, effect)
if isCreature(getCreature.uid) == TRUE and getCreature.uid ~= cid then
doCreatureAddHealth(getCreature.uid, formula * (-1))
doSendAnimatedText(posNow, formula, color)
end
end
else
doSendMagicEffect(posNow, CONST_ME_POFF)
end
end
end
end
end
if quantidade > 1 then
addEvent(doAddDamageRadius, intervalo * 1000, cid, type, radius, shot, effect, color, danoD, intervalo, quantidade-1)
else
setPlayerStorageValue(cid, 34805, 0)
end
return TRUE
end
Last edited: