silveralol
Advanced OT User
- Joined
- Mar 16, 2010
- Messages
- 1,480
- Solutions
- 9
- Reaction score
- 211
hi, i'm making the scripts of broken ring of ending
I need to check in all events if the player is "online" and the ring is in the correct slot to do the functions, also, if I logout and back, sometimes got crash, and the "effects" stay sending ? wtf ... I'll explain better, I use the ring, then logout, and then back again, the effects stay send in the last position before I logout
any question, please feel free to ask
thank you
Code:
function text1(player)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return true
end
if not player then
return true
end
if player then
if ringItem then
player:getPosition():sendMagicEffect(12)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msg1.')
addEvent(text2, 10 * 1000, player)
end
end
end
function text2(player)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return true
end
if not player then
return true
end
if player then
if ringItem then
player:getPosition():sendMagicEffect(38)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msg2')
addEvent(text3, 10 * 1000, player)
end
end
end
function text3(player)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return true
end
if not player then
return true
end
if player then
if ringItem then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msg3')
addEvent(text4, 10 * 1000, player)
end
end
end
function text4(player)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return true
end
if not player then
return true
end
if player then
if ringItem then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msg4.')
addEvent(text5, 10 * 1000, player)
end
end
end
function text5(player)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return true
end
if not player then
return true
end
if player then
if ringItem then
local chance = math.random(2)
if chance == 1 then
player:getPosition():sendMagicEffect(18)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msg5')
addEvent(text6, 10 * 1000, player)
else
doTargetCombatHealth(0, player, COMBAT_DEATHDAMAGE, -300000, -300000, CONST_ME_MORTAREA)
end
end
end
end
function text6(player)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return true
end
if not player then
return true
end
if player then
if ringItem then
ringItem:transform(22516)
player:getPosition():sendMagicEffect(38)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msg6')
end
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local ringItem = player:getSlotItem(CONST_SLOT_RING)
if not ringItem then
return false
end
if player then
addEvent(text1, 10 * 1000, player)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'msgOnUse')
player:getPosition():sendMagicEffect(1)
end
return true
end
any question, please feel free to ask
thank you