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

LUA script Translation from 1.0 to 0.3

beliar34

Member
Joined
Feb 28, 2012
Messages
307
Solutions
7
Reaction score
11
Can somebody translate this script from tfs 1.x to tfs 0.3.x ?
:) :*
Code:
local monsterName, monsterCount = "demon", 4 -- time is in seconds
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 2) + 20 -- completely random
    local max = (player:getLevel() / 5) + 93
    return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local function checkPosition(cid, variant)
    local creature = Creature(cid)
    if not creature then
        return true
    end
    local target = creature:getTarget()
    if not target or not creature:getMaster() then
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        creature:remove()
        return true
    end
    if creature:getPosition():getDistance(target:getPosition()) <= 1 then
        combat:execute(creature:getMaster(), variant)
        creature:remove()
        return true
    end
    addEvent(checkPosition, 2 * 1000, cid, variant)
    return true
end
function onCastSpell(creature, variant)
    for i = 1, monsterCount do
        local summon = Game.createMonster(monsterName, creature:getPosition(), true, false)
        if summon then
            creature:addSummon(summon)
            addEvent(checkPosition, 2 * 1000, summon.uid, variant)
        end
    end
    return true
end
 
Last edited by a moderator:
Spell. TFS 1.0+. Other person's script.
No. No. No.

"other person script" what do you mean ? yup this is cript writed by @Thexamx for my request but he writed for tfs 1.x cuz i didnt say which version i use :( :D

Can be writed for tfs 0.3.6-0.4 (i can remake these script cuz they look very similiar to my 0.3.5)
i call every text in lua "script" becouse this is script :)
 
"other person script" what do you mean ? yup this is cript writed by @Thexamx for my request but he writed for tfs 1.x cuz i didnt say which version i use :( :D

Can be writed for tfs 0.3.6-0.4 (i can remake these script cuz they look very similiar to my 0.3.5)
i call every text in lua "script" becouse this is script :)
I just meant I hate looking at other people's code in general.
There's multiple reasons why I can't touch this.
tldr It's not within my skill range
 
Hope this work for you! regards :D
LUA:
local monsterName, monsterCount = "demon", 4 -- time is in seconds
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local min = (getPlayerLevel(cid) / 2) + 20 -- completely random
    local max = (getPlayerLevel(cid) / 5) + 93
    return -min, -max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local function checkPosition(cid, var)
    if not cid then
        return true
    end
    local target = getCreatureTarget(cid)
    if not target or not getCreatureMaster(cid) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        doRemoveCreature(cid)
        return true
    end
    if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target)) <= 1 then
        doCombat(getCreatureMaster(cid), var)
        doRemoveCreature(cid)
        return true
    end
    addEvent(checkPosition, 2 * 1000, cid, var)
    return true
end
function onCastSpell(cid, var)
    for i = 1, monsterCount do
        local summon = doSummonCreature(monsterName, getCreatureposition(cid))
        if summon then
            doConvinceCreature(cid, summon)
            addEvent(checkPosition, 2 * 1000, summon.uid, var)
        end
    end
    return true
end
 
Back
Top