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

Map Editor - Moveable ID

Peroxides Cat

Sleepy Member
Joined
Nov 15, 2009
Messages
2,230
Reaction score
136
Does anyone know an ID I can give a certain item so it cannot be moved in-game?
I have a potplant that I want to stay in place at all times.
 
another way I see used often is placing "something sparkling" (8046/8047) on top of the item, but it's not always appropriate to do
use whichever you think is cleaner or easier to keep track of :p
 
well problem with unique id's is that you cannot use the same twice (I mean the console errors)

I've made this little fixes for my server in order to make all items with a certain actionid.
so they cannot be moved / rotated / picked up / traded or equiped.

You just have to do some minor changes in your sources.

Game.cpp
search for:
Code:
void Game::cleanMap()
{
	uint32_t dummy;
	cleanMapEx(dummy);
}

put this afterwards:
Code:
//Evil Hero fixed items
bool Game::isFixedItem(Item* item)
{
    if(item->getActionId() == 9999)
        return true;
    else
        return false;     
}
You can replace the 9999 with something which suits better for you, however you want it.

then search for the function:
Code:
bool Game::playerMoveItem(uint32_t playerId, const Position& fromPos,
	uint16_t spriteId, int16_t fromStackpos, const Position& toPos, uint8_t count)

search for this in the function:
Code:
uint8_t toIndex = 0;
	if(toPos.x == 0xFFFF)
	{
		if(toPos.y & 0x40)
			toIndex = static_cast<uint8_t>(toPos.z);
		else
			toIndex = static_cast<uint8_t>(toPos.y);
	}

put this afterwards:
Code:
if(isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}

search for the function:
Code:
bool Game::playerRotateItem(uint32_t playerId, const Position& pos, int16_t stackpos, const uint16_t spriteId)

search for this in the function:
Code:
if(!item || item->getClientID() != spriteId || !item->isRoteable() || (item->isLoadedFromMap() &&
		(item->getUniqueId() != 0 || (item->getActionId() != 0 && item->getContainer()))))
	{
		player->sendCancelMessage(RET_NOTPOSSIBLE);
		return false;
	}

put this afterwards:
Code:
if(isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}

search for the function:
Code:
bool Game::playerRequestTrade(uint32_t playerId, const Position& pos, int16_t stackpos,
	uint32_t tradePlayerId, uint16_t spriteId)

search for this in the function:
Code:
if(!tradeItem || tradeItem->getClientID() != spriteId || !tradeItem->isPickupable() || (tradeItem->isLoadedFromMap() &&
		(tradeItem->getUniqueId() != 0 || (tradeItem->getActionId() != 0 && tradeItem->getContainer()))))
	{
		player->sendCancelMessage(RET_NOTPOSSIBLE);
		return false;
	}

put this afterwards:
Code:
if(isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}


Movements.cpp
search for the function:
Code:
bool MoveEvent::executeEquip(Player* player, Item* item, slots_t slot, bool boolean)

search for this in the function:
Code:
//onDeEquip(cid, item, slot, boolean)

put this afterwards:
Code:
if(g_game.isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}


Game.h
search for:
Code:
bool playerSharePartyExperience(uint32_t playerId, bool activate, uint8_t unknown);

put this afterwards:
Code:
bool isFixedItem(Item* item);


Now you just give the item this certain actionid and not even a god will be able to either move / rotate / trade / pickup or equip it.



Kind regards, Evil Hero.
 
well problem with unique id's is that you cannot use the same twice (I mean the console errors)

I've made this little fixes for my server in order to make all items with a certain actionid.
so they cannot be moved / rotated / picked up / traded or equiped.

You just have to do some minor changes in your sources.

Game.cpp
search for:
Code:
void Game::cleanMap()
{
	uint32_t dummy;
	cleanMapEx(dummy);
}

put this afterwards:
Code:
//Evil Hero fixed items
bool Game::isFixedItem(Item* item)
{
    if(item->getActionId() == 9999)
        return true;
    else
        return false;     
}
You can replace the 9999 with something which suits better for you, however you want it.

then search for the function:
Code:
bool Game::playerMoveItem(uint32_t playerId, const Position& fromPos,
	uint16_t spriteId, int16_t fromStackpos, const Position& toPos, uint8_t count)

search for this in the function:
Code:
uint8_t toIndex = 0;
	if(toPos.x == 0xFFFF)
	{
		if(toPos.y & 0x40)
			toIndex = static_cast<uint8_t>(toPos.z);
		else
			toIndex = static_cast<uint8_t>(toPos.y);
	}

put this afterwards:
Code:
if(isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}

search for the function:
Code:
bool Game::playerRotateItem(uint32_t playerId, const Position& pos, int16_t stackpos, const uint16_t spriteId)

search for this in the function:
Code:
if(!item || item->getClientID() != spriteId || !item->isRoteable() || (item->isLoadedFromMap() &&
		(item->getUniqueId() != 0 || (item->getActionId() != 0 && item->getContainer()))))
	{
		player->sendCancelMessage(RET_NOTPOSSIBLE);
		return false;
	}

put this afterwards:
Code:
if(isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}

search for the function:
Code:
bool Game::playerRequestTrade(uint32_t playerId, const Position& pos, int16_t stackpos,
	uint32_t tradePlayerId, uint16_t spriteId)

search for this in the function:
Code:
if(!tradeItem || tradeItem->getClientID() != spriteId || !tradeItem->isPickupable() || (tradeItem->isLoadedFromMap() &&
		(tradeItem->getUniqueId() != 0 || (tradeItem->getActionId() != 0 && tradeItem->getContainer()))))
	{
		player->sendCancelMessage(RET_NOTPOSSIBLE);
		return false;
	}

put this afterwards:
Code:
if(isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}


Movements.cpp
search for the function:
Code:
bool MoveEvent::executeEquip(Player* player, Item* item, slots_t slot, bool boolean)

search for this in the function:
Code:
//onDeEquip(cid, item, slot, boolean)

put this afterwards:
Code:
if(g_game.isFixedItem(item))
{
    player->sendCancelMessage(RET_NOTPOSSIBLE);
    return false;
}


Game.h
search for:
Code:
bool playerSharePartyExperience(uint32_t playerId, bool activate, uint8_t unknown);

put this afterwards:
Code:
bool isFixedItem(Item* item);


Now you just give the item this certain actionid and not even a god will be able to either move / rotate / trade / pickup or equip it.



Kind regards, Evil Hero.

OH wow, thank you so much.
Will do this right now.
 
Back
Top