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

Lua Speed up effect

Muska

New Member
Joined
May 29, 2010
Messages
3
Reaction score
0
Hi , i wanna change time effect in spell "speed up"(utani hur)

Script:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 4)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 90000)
setConditionFormula(condition, 0.6, 8, 0.7, 8.2)
setCombatCondition(combat, condition)

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



I want to change the spell effect time to a permanent effect during the speed up.
i fresh in lua ! ;O
 
permament effect what does that even mean? It will last forever or what?
If yes then:
Code:
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
 
no , my think is i want stay the effect
Code:
setCombatParam(combat, COMBAT_PARAM_EFFECT, 4)

stay that long how work speed
 
no , my think is i want stay the effect
Code:
setCombatParam(combat, COMBAT_PARAM_EFFECT, 4)

stay that long how work speed
Only possible when you modify client sprite length, not possible with scripting.
 
Its totally possible with scripting.
easy as this:
Code:
times = {0,1,2,3,4,5,6,7,8,9,10}

local function shine(cid)
  local cid = Creature(cid)
  local position = cid:getPosition()
  position:sendMagicEffect(CONST_ME_MAGIC_RED)
end

onSpellCast(creature, var)
  for i = 1, #times do
    addEvent(shine, times[i] * 1000, creature.uid)
  end
  return true
end

This will cast the effect magic red, 11 times, 1 each second. You can modify it to the length of your spell.
 
Its totally possible with scripting.
easy as this:
Code:
times = {0,1,2,3,4,5,6,7,8,9,10}

local function shine(cid)
  local cid = Creature(cid)
  local position = cid:getPosition()
  position:sendMagicEffect(CONST_ME_MAGIC_RED)
end

onSpellCast(creature, var)
  for i = 1, #times do
    addEvent(shine, times[i] * 1000, creature.uid)
  end
  return true
end

This will cast the effect magic red, 11 times, 1 each second. You can modify it to the length of your spell.
Why do you use an array instead of a simple var initialiez at 11, then use i*1000
 
Dunno LoL. it works anyway, just coded it asap on situ and wanted to make a point by showing how can you loop an animation without source or sprite modifications.
 
Why the need for the table of times if you are just using 10 seconds?

Its better to write it like this
Lua:
-- how many seconds it will loop
local times = 10
local function shine(cid)
    local c = Creature(cid)
    -- be sure that the creature still exists
    if c then
        c:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    end
end

function onCastSpell(creature, var)
    -- only needs to be called once
    local cid = creature:getId()
    for i = 1, times do
        addEvent(shine, i * 1000, cid)
    end
    return true
end

Of course you could store the events for efficiency & to see if its already active etc.. but we can keep it simple.
 
Its totally possible with scripting.
easy as this:
Code:
times = {0,1,2,3,4,5,6,7,8,9,10}

local function shine(cid)
  local cid = Creature(cid)
  local position = cid:getPosition()
  position:sendMagicEffect(CONST_ME_MAGIC_RED)
end

onSpellCast(creature, var)
  for i = 1, #times do
    addEvent(shine, times[i] * 1000, creature.uid)
  end
  return true
end

This will cast the effect magic red, 11 times, 1 each second. You can modify it to the length of your spell.
You can just spam one effect repeatedly, this is not making the effect length longer.
 
Its just a way to see it. For me, a longer effect means a loop of sprites. The only difference is that one comes from client, and the other from server.

He asked that the effect is visible for the duration of the speed buff, i offered a solution. No pun intended.
 
Back
Top