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

C++ decay

theduck

Member
Joined
Dec 6, 2018
Messages
246
Reaction score
20
I created a pillar that uses it to rotate I'm using the decay function is working the problem is that sometimes the pillar starts to rotate very fast as if the decay had a shorter time


Code:
 local transformTo = {
    [36309] = 36310,
    [36310] = 36311,
    [36311] = 36312,
    [36312] = 36309
}

 

function onUse(player, item, fromPosition, target, toPosition, isHotkey) 
if isInArray(transformTo, item.itemid) then
            local pilar = transformTo[item.itemid]
            if pilar then
            item:decay()
                item:transform(pilar)
                item:getPosition():sendMagicEffect(CONST_ME_POFF)
            end 
     end
    return true
end

in items.xml
<attribute key="duration" value="900" />
 
the problem is that the player needs to click until he turns the mirror over to the boss so it looks like the pillar gains more speed. I'm trying to create the boss mechanics scarlett etzel
 
If the decay time is low, increase it to a higher value.
1000 = 1 second
XML:
<attribute key="duration" value="900" />
change to 2 seconds
XML:
<attribute key="duration" value="2000" />
Why are you using decay and transform? If the item need to be transformed only when used, just use transform. The decay is to reset the pillar state?
 
If the decay time is low, increase it to a higher value.
1000 = 1 second
XML:
<attribute key="duration" value="900" />
change to 2 seconds
XML:
<attribute key="duration" value="2000" />
Why are you using decay and transform? If the item need to be transformed only when used, just use transform. The decay is to reset the pillar state?
I thought it would be easier the player needs to turn the pillar to the boss but the pillar has a time until he 'spins' again alone

I was thinking of something if the storage is x the pillar changes more would have to check the room I don't know how to do that
 
Last edited:
Too hard understand what you are asking for...
"Pillar changes more"?
"check the room" for what?
You asked for: "decay time is low", i told you how to change, what are you meaning now?
 
Too hard understand what you are asking for...
"Pillar changes more"?
"check the room" for what?
You asked for: "decay time is low", i told you how to change, what are you meaning now?
I told you why you asked why you're using decay.
-
even putting 2000
pillar gains speed after 2 ~~ 3 players use
 
The pillar will decay to what itemId? Post the item config from your items.xml of the four pillars
<item id="36309" article="a" name="pillar">
<attribute key="decayTo" value="36310" />
<attribute key="duration" value="2000" />
</item>
<item id="36310" article="a" name="pillar">
<attribute key="decayTo" value="36311" />
<attribute key="duration" value="2000" />
</item>
<item id="36311" article="a" name="pillar">
<attribute key="decayTo" value="36312" />
<attribute key="duration" value="2000" />
</item>
<item id="36312" article="a" name="pillar">
<attribute key="decayTo" value="36309" />
<attribute key="duration" value="2000" />
</item>
 
Remove the decay propertys from items.xml, and use this script:
Lua:
local transformTo = {
    [36309] = 36310,
    [36310] = 36311,
    [36311] = 36312,
    [36312] = 36309
}
local timeToSpin = 2000

function onUse(player, item, fromPosition, target, toPosition, isHotkey) 
    local nextTransform = transformTo[item.itemid]
    if nextTransform then
        item:transform(nextTransform)
        item:getPosition():sendMagicEffect(CONST_ME_POFF)
        addEvent(autoSpin, timeToSpin, item:getPosition(), item.itemid, nextTransform)
    end
    return true
end

function autoSpin(pillarPos, actualPillarId, nextPillarId)
    local pillar = Tile(pillarPos):getItemById(actualPillarId)
    if pillar then
        pillar:transform(nextPillarId)
    end
    return true
end
Written on my phone, sorry for typos and don't tested.
 
Remove the decay propertys from items.xml, and use this script:
Lua:
local transformTo = {
    [36309] = 36310,
    [36310] = 36311,
    [36311] = 36312,
    [36312] = 36309
}
local timeToSpin = 2000

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local nextTransform = transformTo[item.itemid]
    if nextTransform then
        item:transform(nextTransform)
        item:getPosition():sendMagicEffect(CONST_ME_POFF)
        addEvent(autoSpin, timeToSpin, item:getPosition(), item.itemid, nextTransform)
    end
    return true
end

function autoSpin(pillarPos, actualPillarId, nextPillarId)
    local pillar = Tile(pillarPos):getItemById(actualPillarId)
    if pillar then
        pillar:transform(nextPillarId)
    end
    return true
end
Written on my phone, sorry for typos and don't tested.
tested here nothing happened anymore it normally changed the pilla plus the autoSpin didn't work


ut print () in the print function (addEvent (autoSpin, timeToSpin, item: getPosition (), item.itemid, nextTransform))
in console > 2020-04-12 16:52:50 - 55
 
Last edited:
tested here nothing happened anymore it normally changed the pilla plus the autoSpin didn't work


ut print () in the print function (addEvent (autoSpin, timeToSpin, item: getPosition (), item.itemid, nextTransform))
in console > 2020-04-12 16:52:50 - 55
Sorry, try now:

Lua:
local transformTo = {
    [36309] = 36310,
    [36310] = 36311,
    [36311] = 36312,
    [36312] = 36309
}
local timeToSpin = 2000

function onUse(player, item, fromPosition, target, toPosition, isHotkey) 
    local nextTransform = transformTo[item.itemid]
    if nextTransform then
        item:transform(nextTransform)
        item:getPosition():sendMagicEffect(CONST_ME_POFF)
        addEvent(autoSpin, timeToSpin, item:getPosition(), item.itemid)
    end
    return true
end

function autoSpin(pillarPos, actualPillarId)
    local pillar = Tile(pillarPos):getItemById(actualPillarId)
    if pillar then
        local nextTransform = transformTo[actualPillarId]
        if nextTransform then
            pillar:transform(nextTransform)
            addEvent(autoSpin, timeToSpin, pillarPos, nextTransform)
        end
    end
    return true
end
 
Sorry, try now:

Lua:
local transformTo = {
    [36309] = 36310,
    [36310] = 36311,
    [36311] = 36312,
    [36312] = 36309
}
local timeToSpin = 2000

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local nextTransform = transformTo[item.itemid]
    if nextTransform then
        item:transform(nextTransform)
        item:getPosition():sendMagicEffect(CONST_ME_POFF)
        addEvent(autoSpin, timeToSpin, item:getPosition(), item.itemid)
    end
    return true
end

function autoSpin(pillarPos, actualPillarId)
    local pillar = Tile(pillarPos):getItemById(actualPillarId)
    if pillar then
        local nextTransform = transformTo[actualPillarId]
        if nextTransform then
            pillar:transform(nextTransform)
            addEvent(autoSpin, timeToSpin, pillarPos, nextTransform)
        end
    end
    return true
end
Sorry for the delay, As the player needs to keep using the pillar until the mirrors are facing the boss, the 'addEvent' is accumulating.

put a exaust more did not help

image.png


I think a solution would be every time you click the addevent that is active to be turned off and started again would it be possible?
stopevent ()
 
Last edited:
Sorry for the delay, As the player needs to keep using the pillar until the mirrors are facing the boss, the 'addEvent' is accumulating.

put a exaust more did not help

image.png


I think a solution would be every time you click the addevent that is active to be turned off and started again would it be possible?
stopevent ()

bump
 
Back
Top