• 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 Create Aleatory Condition/Malus From Pos X,Y,Z

alejandro762

Well-Known Member
Joined
Sep 6, 2021
Messages
225
Reaction score
63
Hello,

Since Great Thanks to @Sarah Wesker and @Xikini kini for the scripts we are recreating a system like diablo, the Ancestral Rift.

We don't know if is possible to create from pos X Y Z to pos X Y Z a condition / malus for the players, totally random ( from existing conditions ).
If anyone could help me to finish this system will be greatful to introduce it to the server. ( Server Open Source, update upcoming.)

We are using TFS 1.3,

Regards,
 
Solution
Ok , so i got it now working.

But not using the first part of your script, as onStepIn using an UID on each tile, fromPosition to Position isn't working and i can't get it,

This, add conditions Curse to a player walking on a tile using UID 9999. Change curse to another to add a different condition.
If anyone know how to do it fromPositio to Position ( instead of add 9999 to 2000 Tiles on Remeres ) it will be fantastic👍

Lua:
local condition = Condition(CONDITION_CURSED, CONDITIONID_COMBAT)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:setParameter(CONDITION_PARAM_MINVALUE, 20)
condition:setParameter(CONDITION_PARAM_MAXVALUE, 70)
condition:setParameter(CONDITION_PARAM_STARTVALUE, 50)...
Lua:
local topLeftCorner = Position(1000, 1000, 7)
local bottomRightCorner = Position(1100, 1100, 7)

for _, player in pairs(Game.getPlayers()) do
    if player:getPosition():isInRange(topLeftCorner, bottomRightCorner) then
        -- do something
    end
end
 
Lua:
local topLeftCorner = Position(1000, 1000, 7)
local bottomRightCorner = Position(1100, 1100, 7)

for _, player in pairs(Game.getPlayers()) do
    if player:getPosition():isInRange(topLeftCorner, bottomRightCorner) then
        -- do something
    end
end

Im not sure if im on the right way,


Lua:
local riftCond = CreatureEvent("riftCond")

local topLeftCorner = Position(32377, 32241, 7)
local bottomRightCorner = Position(32387, 32249, 7)

local condition = Condition(CONDITION_CURSED)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_TYPE, CONDITION_CURSED)
condition:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DEATH)
local parameters = {
    {key = CONDITION_PARAM_TICKS, value = 10 * 1000},
}

-- local target = creature:getTarget()
function riftCond.xxxxxxxx(creature, variant) -- Creature / player ? is onCastSpell the right function ?
for _, player in pairs(Game.getPlayers()) do
    target:addAttributeCondition(parameters) -- Not sure addDamage / target:addCondition(condition) 
-- condition:addDamage(5,1000, -20)
-- condition:addCondition(condition)
-- condition:execute(creature, var)
    end
    condition:execute(creature, variant)
    return true
end

riftCond:register()
 
Im not sure if im on the right way,


Lua:
local riftCond = CreatureEvent("riftCond")

local topLeftCorner = Position(32377, 32241, 7)
local bottomRightCorner = Position(32387, 32249, 7)

local condition = Condition(CONDITION_CURSED)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_TYPE, CONDITION_CURSED)
condition:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DEATH)
local parameters = {
    {key = CONDITION_PARAM_TICKS, value = 10 * 1000},
}

-- local target = creature:getTarget()
function riftCond.xxxxxxxx(creature, variant) -- Creature / player ? is onCastSpell the right function ?
for _, player in pairs(Game.getPlayers()) do
    target:addAttributeCondition(parameters) -- Not sure addDamage / target:addCondition(condition)
-- condition:addDamage(5,1000, -20)
-- condition:addCondition(condition)
-- condition:execute(creature, var)
    end
    condition:execute(creature, variant)
    return true
end

riftCond:register()

Choose one. lol

I can't direct you to a solution, because I have no idea what you're trying to do / what trigger you need.
 

Choose one. lol

I can't direct you to a solution, because I have no idea what you're trying to do / what trigger you need.
Oh, yeah right.

I just dont know what is the right function for a condition, onSpell, etc.

A Map with condition cursed from pos x y z,
Fire, ice,holy, earth, energy, poison, physical, per script, then another script with 2, conditions, then increasing this difficulty.
Example;
Map 1: Infinity ticks, 155 curse each 3 seconds
Map 2: Infinity ticks, 155 fire
each 3 seconds.
Etc.


The script i tried just doesnt give any error.
And not taking damage. I will check others right created but the majority are conditions on cast spell, there is on map walk and didnt know the function.
 
Last edited:
After read and check on Revscripts,
We didn't find about what we are looking for, the most conditions are based using spells onCast, to monsters or players, or is called different.
So i manage to try add this script as a globalevent with interval, but i didn't know how to register it since condition:execute( player, var) is giving an error,

Lua:
local riftCond = GlobalEvent("riftCond")


local topLeftCorner = Position(32377, 32241, 7)
local bottomRightCorner = Position(32387, 32249, 7)

local condition = Condition(CONDITION_CURSED)
condition:setParameter(CONDITION_PARAM_TYPE, CONDITION_CURSED)
condition:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_DEATH)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 1000)


function riftCond.onThink(player, var)
for _, player in pairs(Game.getPlayers()) do
    condition:addDamage(5,1000, -20)
    end
    condition:execute(player, var)
end

riftCond:interval(5000)
riftCond:register()
 

Choose one. lol

I can't direct you to a solution, because I have no idea what you're trying to do / what trigger you need.

Ok , so i got it now working.

But not using the first part of your script, as onStepIn using an UID on each tile, fromPosition to Position isn't working and i can't get it,

This, add conditions Curse to a player walking on a tile using UID 9999. Change curse to another to add a different condition.
If anyone know how to do it fromPositio to Position ( instead of add 9999 to 2000 Tiles on Remeres ) it will be fantastic👍

Lua:
local condition = Condition(CONDITION_CURSED, CONDITIONID_COMBAT)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:setParameter(CONDITION_PARAM_MINVALUE, 20)
condition:setParameter(CONDITION_PARAM_MAXVALUE, 70)
condition:setParameter(CONDITION_PARAM_STARTVALUE, 50)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 6000)
condition:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local riftCond = MoveEvent()

function riftCond.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    player:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS)
    player:addCondition(condition)
    return true
end

riftCond:type("stepin")
riftCond:uid(9999)
riftCond:register()
 
Ok , so i got it now working.

But not using the first part of your script, as onStepIn using an UID on each tile, fromPosition to Position isn't working and i can't get it,

This, add conditions Curse to a player walking on a tile using UID 9999. Change curse to another to add a different condition.
If anyone know how to do it fromPositio to Position ( instead of add 9999 to 2000 Tiles on Remeres ) it will be fantastic👍

Lua:
local condition = Condition(CONDITION_CURSED, CONDITIONID_COMBAT)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:setParameter(CONDITION_PARAM_MINVALUE, 20)
condition:setParameter(CONDITION_PARAM_MAXVALUE, 70)
condition:setParameter(CONDITION_PARAM_STARTVALUE, 50)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 6000)
condition:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local riftCond = MoveEvent()

function riftCond.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    player:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS)
    player:addCondition(condition)
    return true
end

riftCond:type("stepin")
riftCond:uid(9999)
riftCond:register()
Ah, you didn't ping me in previous post or I would've helped sooner xP

Lua:
local topLeftCorner = Position(32377, 32241, 7)
local bottomRightCorner = Position(32387, 32249, 7)

local condition = Condition(CONDITION_CURSED, CONDITIONID_COMBAT)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:setParameter(CONDITION_PARAM_MINVALUE, 20)
condition:setParameter(CONDITION_PARAM_MAXVALUE, 70)
condition:setParameter(CONDITION_PARAM_STARTVALUE, 50)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 6000)
condition:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local riftCond = GlobalEvent("riftCond")

function riftCond.onThink(interval)
    for _, player in pairs(Game.getPlayers()) do
        local position = player:getPosition()
        if position:isInRange(topLeftCorner, bottomRightCorner) then
            position:sendMagicEffect(CONST_ME_GREEN_RINGS)
            player:addCondition(condition)
        end
    end
    return true
end

riftCond:interval(5000) -- will be executed every 5000ms
riftCond:register()
 
Solution
Ah, you didn't ping me in previous post or I would've helped sooner xP

Lua:
local topLeftCorner = Position(32377, 32241, 7)
local bottomRightCorner = Position(32387, 32249, 7)

local condition = Condition(CONDITION_CURSED, CONDITIONID_COMBAT)
condition:setParameter(CONDITION_PARAM_DELAYED, true)
condition:setParameter(CONDITION_PARAM_MINVALUE, 20)
condition:setParameter(CONDITION_PARAM_MAXVALUE, 70)
condition:setParameter(CONDITION_PARAM_STARTVALUE, 50)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 6000)
condition:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local riftCond = GlobalEvent("riftCond")

function riftCond.onThink(interval)
    for _, player in pairs(Game.getPlayers()) do
        local position = player:getPosition()
        if position:isInRange(topLeftCorner, bottomRightCorner) then
            position:sendMagicEffect(CONST_ME_GREEN_RINGS)
            player:addCondition(condition)
        end
    end
    return true
end

riftCond:interval(5000) -- will be executed every 5000ms
riftCond:register()

I Forget i think i was trying all night, to make it working, i tried a lot of wierd things on code , a lot of errors, then finally i start from 0 again, and finally got it.

Thanks For the reply, you are genious !
 
Back
Top