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

[Spell] Freezing Storm

cesar10

Active Member
Joined
Aug 4, 2009
Messages
428
Reaction score
37
Hello well i rly would like someone to do this for me cuz i cant :/ as you all know i suck at scripts xDD well what is it? its a spell [maby talkaction xD] that makes a magic efec around you [like 5x5] and when theres a player on the area it sends a distance efect and freez him for 1 seconds [sets a snowman outfit and he cant move after that he gets his outfit back xD] can someone help me? here is efects:

Magic Efec: 52
Distance Efect: 28 or 36


Can someone please help me? sry for asking much help its only cuz i want a good ot server and im not good at making scripts :/
 
this is my winter sweep
LUA:
function chooseA(...)
    local arg = {...}
    return arg[math.random(1,#arg)]
end
 
local area = {
    {
        {0, 1, 0},
        {1, 2, 1},
        {0, 1, 0},    
    },
    {
        {0, 1, 1, 1, 0},
        {1, 0, 0, 0, 1},
        {1, 0, 2, 0, 1},
        {1, 0, 0, 0, 1},
        {0, 1, 1, 1, 0},
    },
    {
        {0, 1, 1, 1, 1, 1, 0},
        {1, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 2, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 1},
        {0, 1, 1, 1, 1, 1, 0}
    },
    {
        {0, 1, 1, 1, 1, 1, 1, 1, 0},
        {1, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 2, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 1},
        {0, 1, 1, 1, 1, 1, 1, 1, 0}
    },    
    {
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
        {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    }
}
 
function restore(cid)
    if isCreature(cid) then 
        doCreatureSetNoMove(cid, false)
        doSendMagicEffect(getThingPos(cid), CONST_ME_ICEATTACK)
    end
end
 
function meltIce(pos)
    return getTileItemById(pos, 6966).uid > 0 and doRemoveItem(getTileItemById(pos, 6966).uid, 1), doSendMagicEffect(pos, CONST_ME_ICEATTACK)
end
 
function onTargetTile(cid, pos)
    if doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR and math.random(50) > 35 then
        doCreateItem(6966, pos)
        addEvent(meltIce, 5000, pos)
    end
    pos.stackpos = 253
    local thing = getThingFromPos(pos).uid
    if isPlayer(thing) or isMonster(thing) and thing ~= cid then
        doCreatureSetNoMove(thing, true)
        doSendMagicEffect(pos, CONST_ME_GIANTICE)
        addEvent(restore, 5000, thing)
        doSetItemOutfit(thing, chooseA(7171,7172,7173), 5000)
    end
end    
 
local combat = {}
for i = 1, 5 do
    combat[i] = createCombatObject()
    setCombatArea(combat[i], createCombatArea(area[i]))
    setCombatParam(combat[i], COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
    setCombatParam(combat[i], COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
    setCombatParam(combat[i], COMBAT_PARAM_EFFECT, CONST_ME_ICEATTACK)
    condition = createConditionObject(CONDITION_FREEZING)
    setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
    addDamageCondition(condition, 10, 2000, -10)
    setCombatCondition(combat[i], condition)
    setCombatFormula(combat[i], COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -15, 5, 5, 1.8, 3, -20, -40)
    _G['onTargetTile' .. i] = onTargetTile
    setCombatCallback(combat[i], CALLBACK_PARAM_TARGETTILE, 'onTargetTile' .. i)
end

function onCastSpell(cid, var)
    doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, 10000))
    local position = getThingPos(cid)
    for i = 1, 10 do
        doSendDistanceShoot({x = position.x + math.random(-12, 12), y = position.y + math.random(-5, 5), z = position.z}, position, CONST_ANI_SMALLICE)
    end
    for i = 1, 5 do
        addEvent(doCombat, 400*i, cid, combat[i], var)
    end
    return true
end
you do the spells.xml part
 
Last edited:
bettar?
LUA:
function meltIce(pos)
    return getTileItemById(pos, 6966).uid > 0 and doRemoveItem(getTileItemById(pos, 6966).uid, 1), doSendMagicEffect(pos, CONST_ME_ICEATTACK)
end
No.
LUA:
function meltIce(pos)
	local v = getTileItemById(pos, 6966).uid
	if v ~= 0 then
		doRemoveItem(v)
		doSendMagicEffect(pos, CONST_ME_ICEATTACK)
	end
end
  • Calling getTileItemById only once
  • ~= is faster than >
  • Passing only 1 parameter to doRemoveItem since using count=1 when item is not stackable makes no sense.
  • Not returning anything because it's also faster
  • Defining local variable v
 
Back
Top