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

RevScripts Convert spell to revscript

tulio271

New Member
Joined
Jul 15, 2019
Messages
9
Reaction score
2
i need convert this seplls to RevScript, if is possible i need without event. I've tried to perform the conversion in numerous ways and I couldn't, so my last alternative is to ask you for help

Lua:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)



local function onCastSpell1(parameters)
doCombat(parameters.cid, combat1, parameters.var)
end

local function onCastSpell2(parameters)
doCombat(parameters.cid, combat2, parameters.var)
end
local function onCastSpell3(parameters)
doCombat(parameters.cid, combat3, parameters.var)
end




function onCastSpell(cid, var)
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }
addEvent(onCastSpell1, 2, parameters)
addEvent(onCastSpell2, 500, parameters)
addEvent(onCastSpell3, 900, parameters)

return TRUE
end
 
Solution
data/scripts/spellname.lua

without event:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end

spell:name("Spell Name")
spell:words("spell words")
spell:group("attack")
spell:vocation("sorcerer", "master sorcerer")
spell:id(24)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(60)
spell:mana(1000)
spell:needTarget(true)
spell:range(7)
spell:isPremium(true)
spell:register()

with event:
Lua:
local combat...
i need convert this seplls to RevScript, if is possible i need without event. I've tried to perform the conversion in numerous ways and I couldn't, so my last alternative is to ask you for help

Lua:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)



local function onCastSpell1(parameters)
doCombat(parameters.cid, combat1, parameters.var)
end

local function onCastSpell2(parameters)
doCombat(parameters.cid, combat2, parameters.var)
end
local function onCastSpell3(parameters)
doCombat(parameters.cid, combat3, parameters.var)
end




function onCastSpell(cid, var)
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3 }
addEvent(onCastSpell1, 2, parameters)
addEvent(onCastSpell2, 500, parameters)
addEvent(onCastSpell3, 900, parameters)

return TRUE
end
You can use this here


To convert it. You will need to change "TRUE" to true once the conversion is done, in the new script, and to remove the addevents, just remove the addevents and place the function there instead so

change

addEvent(onCastSpell1, 2, parameters)
addEvent(onCastSpell2, 500, parameters)
addEvent(onCastSpell3, 900, parameters)

to

onCastSpell1(parameters)
onCastSpell2(parameters)
onCastSpell3(parameters)


and TRUE to true, then run the converter, and spell should work, but remember, without the addevent(which is still around btw, no need to remove it) there will be no delay in any of the combats, they will all work at same time.
 
You can use this here


To convert it. You will need to change "TRUE" to true once the conversion is done, in the new script, and to remove the addevents, just remove the addevents and place the function there instead so

change

addEvent(onCastSpell1, 2, parameters)
addEvent(onCastSpell2, 500, parameters)
addEvent(onCastSpell3, 900, parameters)

to

onCastSpell1(parameters)
onCastSpell2(parameters)
onCastSpell3(parameters)


and TRUE to true, then run the converter, and spell should work, but remember, without the addevent(which is still around btw, no need to remove it) there will be no delay in any of the combats, they will all work at same time.
i try use this convert but not work here.....

Lua:
error [...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:166: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        ...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:166: in function 'formatInstantSpellStringData'
        ...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:198: in function <...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:196>]
 
i try use this convert but not work here.....

Lua:
error [...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:166: attempt to index a nil value
stack traceback:
        [C]: in function '__index'
        ...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:166: in function 'formatInstantSpellStringData'
        ...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:198: in function <...top\ot\fidelitas\data\scripts\talkactions\god\convet.lua:196>]
It shouldn't be in that folder. It will not work properly that way, must be used as a revscript. If you take my copy provided by the link, and drop it in the proper folder, it will work, needs to be in the data/scripts folder, not in data/talkactions/scripts, place my entire script in the correct directory and remove your registration of it from the talkactions.xml, then run it, and it will work.
 
data/scripts/spellname.lua

without event:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end

spell:name("Spell Name")
spell:words("spell words")
spell:group("attack")
spell:vocation("sorcerer", "master sorcerer")
spell:id(24)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(60)
spell:mana(1000)
spell:needTarget(true)
spell:range(7)
spell:isPremium(true)
spell:register()

with event:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local function executeCombat(cid, variant)
    local creature = Creature(cid)
    if creature then
        combat:execute(creature, variant)
    end
end

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant, isHotkey)
    local cid = creature:getId()
    addEvent(executeCombat, 500, cid, variant)
    addEvent(executeCombat, 900, cid, variant)
    return combat:execute(creature, variant)
end

spell:name("Spell Name")
spell:words("spell words")
spell:group("attack")
spell:vocation("sorcerer", "master sorcerer")
spell:id(24)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(60)
spell:mana(1000)
spell:needTarget(true)
spell:range(7)
spell:isPremium(true)
spell:register()
 
Solution
data/scripts/spellname.lua

without event:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant, isHotkey)
    return combat:execute(creature, variant)
end

spell:name("Spell Name")
spell:words("spell words")
spell:group("attack")
spell:vocation("sorcerer", "master sorcerer")
spell:id(24)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(60)
spell:mana(1000)
spell:needTarget(true)
spell:range(7)
spell:isPremium(true)
spell:register()

with event:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_INFERNALBOLT)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -4, -35, -4, -40)

local function executeCombat(cid, variant)
    local creature = Creature(cid)
    if creature then
        combat:execute(creature, variant)
    end
end

local spell = Spell(SPELL_INSTANT)
function spell.onCastSpell(creature, variant, isHotkey)
    local cid = creature:getId()
    addEvent(executeCombat, 500, cid, variant)
    addEvent(executeCombat, 900, cid, variant)
    return combat:execute(creature, variant)
end

spell:name("Spell Name")
spell:words("spell words")
spell:group("attack")
spell:vocation("sorcerer", "master sorcerer")
spell:id(24)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:level(60)
spell:mana(1000)
spell:needTarget(true)
spell:range(7)
spell:isPremium(true)
spell:register()

bro you helped me a lot, thank you very much! god blessed you.
 
Back
Top