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

Feature ActionID for Immovable Object [TFS 1.x]

fish04k

Member
Joined
Mar 23, 2008
Messages
102
Reaction score
19
I know you can set Unique ID to make something immovable but this might be a little better since you cant use the same Unique ID.

All this does is allow you to set 1 ActionID that is used to make object unable to be moved.

In game.cpp find
Code:
   if (!item->isPushable() || item->hasAttribute(ITEM_ATTRIBUTE_UNIQUEID)) {
        player->sendCancelMessage(RETURNVALUE_NOTMOVEABLE);
        return;
    }

Add below
Code:
    if (item->getActionId() == 65535) 
    {
        player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
        return;
    }

Change 65535 to the ID you want it to be set to.
*NOTE: 65535 = Max Action ID possible.
 
I know you can set Unique ID to make something immovable but this might be a little better since you cant use the same Unique ID.

All this does is allow you to set 1 ActionID that is used to make object unable to be moved.

In game.cpp find
Code:
   if (!item->isPushable() || item->hasAttribute(ITEM_ATTRIBUTE_UNIQUEID)) {
        player->sendCancelMessage(RETURNVALUE_NOTMOVEABLE);
        return;
    }

Add below
Code:
    if (item->getActionId() == 65535)
    {
        player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
        return;
    }

Change 65535 to the ID you want it to be set to.
*NOTE: 65535 = Max Action ID possible.
u can also add more than 1 value bro
 
Yes you could but since its an AID I can use the same one on every item I wish to not be movable. No need to have multiple AID's when one serves the purpose for all.

It just makes it easier then having to use multiple UID's for all items I want to not be movable. As far as I know you cant re-use UID's. Previous servers would give you duplicate error and TFS 1.x just removes the UID from the other items and only puts it on one. ( I could be wrong but from my short time testing this is what I concluded.)

Maybe I misunderstood you. Not sure. Let me know if you mean something else.
 
Why don't you use onMoveItem instead of changing sources? o_O
 
Idk.. Lol I tried finding something that would do this for an hour or so and I couldn't locate anything that was posted. Only thing I found was people saying about source edits. So i checked the sources and figured this out in 5 min.

If there are better ways to do this then this thread can be disregarded. I'm still learning this stuff.
 
Player method onMoveItem really avoids this hassle on lua, with a similar ActionID that can be used by more than one item.
 
Back
Top