• 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 wand loop trough all damage types in lua

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,454
Solutions
1
Reaction score
627
Location
Estonia
Im not good with Scripting and i'm trying to make:
onUseWeapon to shuffel trough all the listed damage types and then do 1 attack with each attack type.
(this all also should happen in 1 attack)

EDIT: Fixed code. This script will do 5 different elemental damages in singel hit
LUA:
local combat, types = {}, {COMBAT_FIREDAMAGE, COMBAT_EARTHDAMAGE, COMBAT_ICEDAMAGE, COMBAT_ENERGYDAMAGE, COMBAT_DEATHDAMAGE}
for x = 1, #types do
  combat[x] = Combat()
  combat[x]:setParameter(COMBAT_PARAM_TYPE, types[x])
  combat[x]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
  combat[x]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

  function onGetFormulaValues(cid, level, maglevel)
  min = -10
  max = -10
  return min, max
  end
  combat[x]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
end

function onUseWeapon(player, var)
  for x = 1, #types do
  addEvent(function()  combat[x]:execute(player, var) end, x * 100)
  end
  return true
end
 
Last edited:
Back
Top