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

Action distance effect for Spells.

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,904
Solutions
82
Reaction score
2,007
Location
Germany
Hello guys I need quick help. I got a distance effect for my manarune at Action script but since I changed my manarune to spells script, the distance effect doesnt work anymore ^^ is it possible to add it somehow in the manarune? or can just someone edit this action distance effect script to spell distance effect?

Lua:
    doSendDistanceShoot({x=pos.x+2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x+2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)

Tfs 0.4
 
Solution
Lua:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
    setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
    local mana = math.random((getCreatureMaxMana(cid) / 100) * 15, (getCreatureMaxMana(cid) / 100) * 15)
    local color = 210 -- which color you want.
    local pos = getCreaturePosition(cid)
   
    doSendDistanceShoot({x=pos.x+2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x+2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)...
I can't help you here. I am assuming its because pos isn't set in the code. You need to do something like:

Lua:
local pos = getCreaturePosition(cid)
local x = -2
local y = -2

while x < 2 do
       while y < 2 do
                doSendDistanceShoot({x = x, y = y, z = pos.z}, pos, CONST_ANI_HOLY})
                x = x + 1
                y = y + 1
         end
end

Without the full code I cant see what is missing or anything.
 
Lua:
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local mana = math.random((getCreatureMaxMana(cid) / 100) * 15, (getCreatureMaxMana(cid) / 100) * 15)
local color = 210 -- which color you want.
doPlayerAddMana(cid, mana)
doNewSendAnimatedText(getPlayerPosition(cid),mana,color)
    return doCombat(cid, combat, var)
end
 
Where must I put it exactly? Tried it in some ways but didnt work

did it like that: Idk if its right

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local mana = math.random((getCreatureMaxMana(cid) / 100) * 15, (getCreatureMaxMana(cid) / 100) * 15)
local color = 210 -- which color you want.
local pos = getCreaturePosition(cid)
local x = -2
local y = -2
while x < 2 do
       while y < 2 do
                doSendDistanceShoot({x = x, y = y, z = pos.z}, pos, CONST_ANI_HOLY})
                x = x + 1
                y = y + 1
         end
end
doPlayerAddMana(cid, mana)
doNewSendAnimatedText(getPlayerPosition(cid),mana,color)
    return doCombat(cid, combat, var)
end
 
T1MoS.png
 
Lua:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
    setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
    local mana = math.random((getCreatureMaxMana(cid) / 100) * 15, (getCreatureMaxMana(cid) / 100) * 15)
    local color = 210 -- which color you want.
    local pos = getCreaturePosition(cid)
   
    doSendDistanceShoot({x=pos.x+2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x+2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)
   
    doPlayerAddMana(cid, mana)
    doNewSendAnimatedText(getPlayerPosition(cid),mana,color)
    return doCombat(cid, combat, var)
end
 
Solution
Lua:
local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
    setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
    setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
    local mana = math.random((getCreatureMaxMana(cid) / 100) * 15, (getCreatureMaxMana(cid) / 100) * 15)
    local color = 210 -- which color you want.
    local pos = getCreaturePosition(cid)
  
    doSendDistanceShoot({x=pos.x+2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x+2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y-2,z=pos.z},pos, CONST_ANI_HOLY)
    doSendDistanceShoot({x=pos.x-2,y=pos.y+2,z=pos.z},pos, CONST_ANI_HOLY)
  
    doPlayerAddMana(cid, mana)
    doNewSendAnimatedText(getPlayerPosition(cid),mana,color)
    return doCombat(cid, combat, var)
end

working thx
 
No problem. The problem was: pos was not set in the code. So you needed to add: local pos = getCreaturePosition(cid)
 
Back
Top