• 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 Unmoveable object with action ID.

Theralion

New Member
Joined
Feb 12, 2016
Messages
8
Reaction score
0
Hey i wan't to make a lot of items unmoveable in certain areas, but i want them moveable otherwise. So i don't want to use Unique ID but a single action ID that makes item unmoveable and send player message you cannot move that. Just like if i was moving a wall.
I know i can use onRemove, but then how do i send message without having player, who is trying to move the object?

TFS 1.2
 
In 0.3.7 we have function onThrow.
Maybe 1.2 has something similar?
You could do something like this..
Code:
local c = {
   aid = 45001, -- ActionID to put on Objects.
   msg = "You cannot move this object." -- Message that appears when trying to move it.
}

function onThrow(cid, item, fromPosition, toPosition)
   if getItemAttribute(item.uid, "aid") == c.aid then
     return doPlayerSendCancel(cid, c.msg) and false
   end
   return true
end

-- login.lua
-- registerCreatureEvent(cid, "moveBlocked")

-- creaturescripts.xml
-- <event type="throw" name="moveBlocked" event="script" value="moveBlocked.lua"/>
 
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
    if item:getActionId() == 1234 then
        self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTMOVEABLE))
        return false
    end
    return true
end

On events\scripts\player.lua. And change the tag in events.xml to enabled="1"
 
@MatheusMkalo Oh my god there was this many functions in events.xml and player.lua . Thanks i didn't know about it. Just started adventure with ot servers. It for sure requries a lot of knowledge about everyt function and it's limits. Everything works fine so thank you very much.

@Xikini
Thanks for trying. But we don't have such function and i can't send player message through onRemove(item,tile,position)
 

Similar threads

V
Replies
2
Views
125
Back
Top