• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved How to make magic wall spell in direction of player?

Samaster

Raptorserver.ddns.net
Joined
Jun 9, 2013
Messages
291
Reaction score
23
Location
UK
Hey guys, can someone make a script for me of a magic wall spell.. i want it to create a magic wall in the direction of the player and i dont know how to do it? :/
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatParam(combat, COMBAT_PARAM_CREATEITEM, 1497)
casterTargetOrDirection="1"

function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

like this?
 
No you must add that in your xml, not the lua. here is an example:

Code:
<instant name="Thundersotm" words="Exevo rain" lvl="250" maglv="80" mana="5000" exhaustion="3000" prem="0" needlearn="0" casterTargetOrDirection="1" blockwalls="0" aggressive="1" event="script" value="newspells/s250.lua">
    <vocation id="1"/>
    <vocation id="5"/>
    <vocation id="9"/>
</instant>
 
This is for a wand, you can do the same thing with other weapons.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

function onGetFormulaValues(cid, level, maglevel)
   min = (maglevel*2) + level/5 + 10
   max = (maglevel*3) + level/5 + 20
  
   health = math.random(min/5, max/5)
   doCreatureAddHealth(cid, health)  

   return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
     return doCombat(cid, combat, var)
end
 
[12/12/2013 17:58:04] [Error - LuaScriptInterface::loadFile] data/weapons/scripts/2h druid staff.lua:12: 'end' expected (to close 'function' at line 7) near 'health'
[12/12/2013 17:58:04] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/2h druid staff.lua)
[12/12/2013 17:58:04] data/weapons/scripts/2h druid staff.lua:12: 'end' expected (to close 'function' at line 7) near 'health'
 
yeah haha :P didnt realise.. I want it to deal damage to the target but heal me, like lifesteal

With this script
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_CARNIPHILA)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -850, -1, -980, 5, 5, 31, 32)

function onGetFormulaValues(cid, level, maglevel)
  min = (maglevel*9.1) +level*3 +4000
  max = (maglevel*9.1) +level*3 +5100
 
  health = math.random(min/10, max/10)
  doCreatureAddHealth(cid, health)
  return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
    return doCombat(cid, combat, var)
end

I get this error

Code:
[12/12/2013 18:05:02] [Error - Weapon Interface]
[12/12/2013 18:05:02] In a callback: data/weapons/scripts/2h druid staff.lua:onGetFormulaValues
[12/12/2013 18:05:02] (Unknown script file)
[12/12/2013 18:05:02] Description:
[12/12/2013 18:05:02] data/weapons/scripts/2h druid staff.lua:11: bad argument #2 to 'random' (interval is empty)
 
Back
Top