• 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 TFS 1.0 Ring of Ending and transform item after X time.

ATT3

Intermediate OT User
Joined
Sep 22, 2010
Messages
512
Reaction score
100
Well, I haven't even got started with this first one, but I am not sure how it would work therefor I am asking help here :p
http://tibia.wikia.com/wiki/Ring_of_Ending


I am sure that explains enough about that ring.

From wikia:
Can be created by using a String of Mending on an equipped Broken Ring of Ending. There is a chance of dying in the process. This chance is exactly the same as the chance of success, so they're both 50%.

So basically when you wear this ring text starts showing up /video above.
In the end there's 50% chance of dying or creating the ring.
_______
Will update soon with my first try about this script./I already know that there are functions that I can't get working as it is supposed to be like.

Current status; create ring = done
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 22542 and itemEx.itemid == 13877 and (getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 13877) then
                doTransformItem(item.uid, 22543)
                doPlayerRemoveItem(cid, 13877, 1)
            end
    return true
end
Explanation.
22542= broken ring
13877= string of meding
22543= "unstable ring"

22542 + 13877 = 22543

When a player wears this unstable ring he should receive several msgs and magic effects.
after all the msgs have occurred the player should either die and lose his unstable ring OR
the unstable ring should transform into Ring of Ending
Here I need help to get started










Secondly. Fixed
Player uses (glimmering) tree.
The tree gives him item (math random)
the glimmering tree changes to normal tree for X time, then changes back to glimmering tree.

I have figured this out by giving player storageid, os.time, but it shouldn't be like that because there are many trees like this.
And I don't want to add new action/unique id for each tree.

So I have tried different settings, but the tree wont change back to glimmering tree, whats wrong with this 1?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if(item.itemid == 22435) then
                doTransformItem(item.uid, 22026)
                addEvent(doTransformItem, 5 * 60 * 1000, item.uid, 22435)
            end
    return true
end
// Fix = post below or Zbizus post.
 
Last edited:
You can't use uid in addEvent unless the item has an uniqueid you added in the mapeditor.
If you don't want that, you can do it like this.
Code:
local function changeBack(pos)
     doTransformItem(getTileItemById(pos, 22026).uid, 22435)
     return true
end

addEvent(changeBack, 5 * 60 * 1000, toPosition)
 
You can't use uid in addEvent unless the item has an uniqueid you added in the mapeditor.
If you don't want that, you can do it like this.
Code:
local function changeBack(pos)
     doTransformItem(getTileItemById(pos, 22026).uid, 22435)
     return true
end

addEvent(changeBack, 5 * 60 * 1000, toPosition)
he can use cid to read slot item(slot ring)
 
I'm using this for deepling mission, tested and works:
Code:
function transfer_crystal_back(pos)
doTransformItem(getTileItemById(pos, 8633).uid, 8635)
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
return true
end
...
addEvent(transfer_crystal_back, 60000, getThingPos(itemEx.uid))
doTransformItem(itemEx.uid, 8633)
 
You can't use uid in addEvent unless the item has an uniqueid you added in the mapeditor.
If you don't want that, you can do it like this.
Code:
local function changeBack(pos)
     doTransformItem(getTileItemById(pos, 22026).uid, 22435)
     return true
end

addEvent(changeBack, 5 * 60 * 1000, toPosition)

Works perfectly + thanks for the explanation :)

I'm using this for deepling mission, tested and works:
Code:
function transfer_crystal_back(pos)
doTransformItem(getTileItemById(pos, 8633).uid, 8635)
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
return true
end
...
addEvent(transfer_crystal_back, 60000, getThingPos(itemEx.uid))
doTransformItem(itemEx.uid, 8633)

Thanks.
---------------------------

Btw would that ring of death be action or creature event?
+ Check out the main post again
 
Last edited:
Got the first script done.
It looks horrible but it works :p

If somebody else is working on roshamuul and need the script
http://pastebin.com/KunstcB6
I believe that script could be 10x shorter but at least it works :=

Btw

About the Ring of Death, it should be move event?
I am having hard time getting started here, if somebody could just help me a bit with this one I would appreciate that.
 
You can do it like this to make it shorter.
Code:
local c = {[22433] = 22253, [22434] = 22253, [22435] = 22026, [22436] = 22075, [22437] = 22103, [22438] = 22101, [22439] = 22104, [22440] = 22105, [22441] = 22102}

local chances = {
   {itemid = 22363, message = "You found a broken dream."},
   {itemid = 2225, message = "You poke into the thing, but there's only some rubbish inside."},
   {itemid = 2221, message = "A twig dropped out of the cypress. It's rubbish."},
   {itemid = 2244, message = "You shook some leaves off the cypress. They're rubbish."},
   {itemid = 18554, message = "You shake out the glowing contents, but it's only dew and rubbish"}
}

local function changeBack(pos, itemid, transformid)
     return doTransformItem(getTileItemById(pos, transformid).uid, itemid)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
     if c[item.itemid] then
         addEvent(changeBack, 300 * 60 * 1000, toPosition, item.itemid, c[item.itemid])
         doTransformItem(item.uid, c[item.itemid])
         local random = math.random(#chances)
         doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, chances[random].message)
         doPlayerAddItem(cid, chances[random].itemid, 1)
     end
     return true
end

About the ring, how should it be activated?
 
You can do it like this to make it shorter.

Much better code, thanks :)
About the ring, how should it be activated?
When a player wears the ring, he should receive msgs.

Here you go very raw "script"/explanation.
Moveevent right? :p


<movevent event="Equip" itemid="22543" slot="ring" function="onEquipItem" script="roe.lua"/>
<movevent event="DeEquip" itemid="22543" slot="ring" function="onDeEquipItem"/>


Code:
function onEquip(cid, item, slot)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Text 1")
doPlayersend magic effect 1
wait 2 seconds
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Text 2")
doPlayersend magic effect 2
wait 2 seconds
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Text 3")
doPlayersend magic effect 2
wait 2 seconds
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Text 4")
doPlayersend magic effect 3
wait 2 seconds
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Text 5 final text")
doPlayersend magic effect 4
math.random 1,2  if rand == 1 then
DoPlayerAddItem,(ring of ending, 1)
DoPlayerRemoveItem(unstable ring of ending)
else
Kill player (lose all health)
DoPlayerRemoveItem(unstable ring of ending)
return false
end

Currently

Code:
function onEquip(cid, item, slot)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Test")
return false
end

Currently, I can't even use the ring on proper spot. (ring)
It says "put this object in your hand"

So I have been testing it in hand, which doesn't really matter that much atm.
But with this script the item wont stay there, tho it does say "hello". :eek:
Without the script I can wear it on my hand.
 
Change return false to return true. With return false people can't equip the item there.
You can use addEvent for the textmessages.
Code:
local messages = {
   "Text 1",
   "Text 2",
   "Text 3",
   "Text 4",
   "Text 5"
}

local time = 0
for m = 1, #messages do
     addEvent(doPlayerSendTextMessage, time, cid, MESSAGE_EVENT_ADVANCE, messages[m])
     time = time + 5000
end
 
Change return false to return true. With return false people can't equip the item there.
You can use addEvent for the textmessages.
Code:
local messages = {
   "Text 1",
   "Text 2",
   "Text 3",
   "Text 4",
   "Text 5"
}

local time = 0
for m = 1, #messages do
     addEvent(doPlayerSendTextMessage, time, cid, MESSAGE_EVENT_ADVANCE, messages[m])
     time = time + 5000
end

Yeah, something like that, expect.
it sends each msg 3 times +
It will need the "magic effect" always when new text arrives, and
after fifth text it should either kill the player wearing it or transform that item into something else-------- 50/50 chance.

I am trying to solve this script, so I will keep updating this post if you (or anyone else reading this) hasn't responded.
 
Code:
local messages = {
   {m = "Text 1", e = CONST_ME_MAGIC_GREEN},
   {m = "Text 2"},
   {m = "Text 3", e = CONST_ME_FIREWORK_YELLOW},
   {m = "Text 4"},
   {m = "Text 5", e = CONST_ME_MORTAREA}
}

local function endRing(cid)
     local chance = math.random(1, 2)
     if chance == 1 then
         doPlayerAddItem(cid, 2112, 1)
     else
         doCreatureAddHealth(cid, -getCreatureHealth(cid))
     end
     doRemoveItem(getPlayerSlotItem(cid, CONST_SLOT_RING).uid, 1)
     return true
end
     
--

local time = 0
for m = 1, #messages do
     addEvent(doPlayerSendTextMessage, time, cid, MESSAGE_EVENT_ADVANCE, messages[m].m)
     if messages[m].e then
         addEvent(doSendMagicEffect, time, getPlayerPosition(cid), messages[m].e)
     end
     time = time + 5000
end
addEvent(endRing, #messages * 5000, cid)

You can add e = and then the magic effect to the messages that should have a magic effect.
 
You can add e = and then the magic effect to the messages that should have a magic effect.

Thanks a lot! almost done xD
1 more thing tho... or two
Currently I am using
Code:
function onEquip(cid, item, slot)


local messages = {
  {m = "The ring feels quite heavy now. Nothing else happens.", e = CONST_ME_MAGIC_GREEN},
  {m = "The ring feels even heavier. You feel slightly stronger, however.", e = CONST_ME_MAGIC_GREEN},
  {m = "You feel better, more energetic than ever before. The ring seems to wrap itself tighter around your finger."},
  {m = "The ring now cuts your flesh. However, you feel fast as lightning and strong as a dragon, fires seem to burn within you."},
  {m = "You feel as if you could touch the stars and see beyond even the dimmest of them. The ring hurts you now.", e = CONST_ME_MAGIC_GREEN},
  {m = "The ring now seems to be as hot as fire while at the same time cold as ice. Put it off or it will seriously hurt you."},
  {m = "Pain is no word for what you feel anymore. If you do not put the ring off it MAY kill you. Chances are 50/50.", e = CONST_ME_FIREWORK_YELLOW},
  {m = "Your pain transports you in a different world, you are alone there. Filled with anguish. You may live or it MAY KILL YOU."},
  {m = "You became pain itself. You are mere seconds away from death. If you do not PUT OFF THE RING. You MAY actually DIE.", e = CONST_ME_MORTAREA}
}

local function endRing(cid)
    local chance = math.random(1, 2)
    if chance == 1 then
        doPlayerAddItem(cid, 22516, 1)
    else
        doCreatureAddHealth(cid, -getCreatureHealth(cid))
    end
    doRemoveItem(getPlayerSlotItem(cid, CONST_SLOT_RING).uid, 1)
    return true
end
  
--

local time = 0
for m = 1, #messages do
    addEvent(doPlayerSendTextMessage, time, cid, MESSAGE_EVENT_ADVANCE, messages[m].m)
    if messages[m].e then
        addEvent(doSendMagicEffect, time, getPlayerPosition(cid), messages[m].e)
    end
    time = time + 5000
end
addEvent(endRing, #messages * 5000, cid)
    return true
end

With out return true it will send the text normally 1 time only, but the ring won't stay there on its spot.
With return true it stays where it is supposed to stay but it sends each text 3 times ;I[/quote]
 
Back
Top