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

Solved addEvent issue

Status
Not open for further replies.

Red

Cyntara.org & Evolunia.net
Staff member
Global Moderator
Premium User
Joined
Aug 9, 2008
Messages
4,495
Solutions
2
Reaction score
952
Location
Ohio, USA
I'm trying to allow an item to appear on the map for 30 minutes after a creature steps on a tile, and then disappear after 30 minutes.

LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if isMonster(cid) then
		addEvent(doCreateItem(11796, Position(695, 653, 9)), 1000)
		addEvent(doRemoveItem(getTileItemById(Position(695, 653, 9), 11796).uid), 3000) -- 1800000 = 30 minutes. 3 seconds is for testing purposes.
	end
	return true
end

Error:

Code:
[16:14:54.596] [Error - MoveEvents Interface]
[16:14:54.596] data/movements/scripts/gate.lua:onStepIn
[16:14:54.596] Description:
[16:14:54.596] (luaAddEvent) Callback parameter should be a function

[16:14:54.596] [Error - MoveEvents Interface]
[16:14:54.596] data/movements/scripts/gate.lua:onStepIn
[16:14:54.596] Description:
[16:14:54.596] (luaAddEvent) Callback parameter should be a function

Both functions work outside addEvent.
I've tried a lot of variations, even making functions inside the file and they've all been fussy.
Red
 
Last edited:
try this
Code:
addEvent(doCreateItem, 1000, 11796, Position(695, 653, 9))
and the other the same way, if it works
 
  • Like
Reactions: Red
LUA:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(isMonster(cid))then
        addEvent(doCreateItem, 1000, 11796, Position(695, 653, 9))
        addEvent(function()
            local item = getTileItemById(Position(695, 653, 9), 11796)
            if(item.uid ~= 0)then
                doRemoveItem(item.uid)
            end
        end, 3000)
    end
    
    return true
end
Didn't test but w/e.
 
  • Like
Reactions: Red
Pro. Thank you guise.

<3 Red
 
Status
Not open for further replies.
Back
Top