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

How to make your server client 8.61 Tutorial

how to fix runes in hotkey:

game.cpp

search:

Lua:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	int32_t subType = -1;
	if(item->hasSubType() && !item->hasCharges())
		subType = item->getSubType();

	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);

	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());

	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

change to:

Lua:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), -1);

	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());

	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

semttulocz.png
 
Last edited:
protocolgame.cpp

search:

Lua:
void ProtocolGame::sendCancelTarget()
{
	NetworkMessage_ptr msg = getOutputBuffer();
	if(msg)
	{
		TRACK_MESSAGE(msg);
		msg->AddByte(0xA3);
	}
}

chage to:

Lua:
void ProtocolGame::sendCancelTarget()
{
	NetworkMessage_ptr msg = getOutputBuffer();
	if(msg)
	{
		TRACK_MESSAGE(msg);
		msg->AddByte(0xA3);
		msg->AddU32(0);
	}
}

search:

Lua:
void ProtocolGame::parseAttack(NetworkMessage& msg)
{
	uint32_t creatureId = msg.GetU32();
	addGameTask(&Game::playerSetAttackedCreature, player->getID(), creatureId);
}

change to:

Lua:
void ProtocolGame::parseAttack(NetworkMessage& msg)
{
	uint32_t creatureId = msg.GetU32();
	msg.GetU32();
	msg.GetU32();
	addGameTask(&Game::playerSetAttackedCreature, player->getID(), creatureId);
}
 
thanks:)

edit1.
still crashing when i cancel atack
protocolgame cpp is in attachment

edit2

WORKS

I love you thank you thank you you helped me a lot:)!
 

Attachments

  • protocolgame.cpp.txt
    77 KB · Views: 13 · VirusTotal
Last edited:
how to fix runes in hotkey:

game.cpp

search:

Lua:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	int32_t subType = -1;
	if(item->hasSubType() && !item->hasCharges())
		subType = item->getSubType();

	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), subType, false);

	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());

	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

change to:

Lua:
void Game::showHotkeyUseMessage(Player* player, Item* item)
{
	const ItemType& it = Item::items[item->getID()];
	uint32_t count = player->__getItemTypeCount(item->getID(), -1);

	char buffer[40 + it.name.size()];
	if(count == 1)
		sprintf(buffer, "Using the last %s...", it.name.c_str());
	else
		sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str());

	player->sendTextMessage(MSG_INFO_DESCR, buffer);
}

semttulocz.png

This work with 0.4?
 
the items.otb isnt the same as rme 8.6? which one is the real? cuz i make my map and then open it whit venn's server but all items were wrong then i change items.otb and items.xml whit rme one and all was ok, till i create a potion ;/ i get crashed then relog and the potion insede my backpack change looktype of some runes and sad it got like x123 charges ;/ how do i fix it?
 
Amulets and rings

in items.xml

Code:
	<item id="10220" article="a" name="leviathan's amulet">
		<attribute key="weight" value="700" />
		<attribute key="slotType" value="necklace" />
		<attribute key="charges" value="[B][U]5[/U][/B]" />
		<attribute key="showcharges" value="1" />
		<attribute key="absorbPercentPhysical" value="60" />
		<attribute key="absorbPercentIce" value="40" />
	</item>

in game

Code:
19:29 You see a leviathan's amulet that has [B][U]100 charges[/U][/B] left.
It can only be wielded properly by players of level 80 or higher.
It weighs 7.00 oz.

more bugs...
 
Amulets and rings

in items.xml

Code:
	<item id="10220" article="a" name="leviathan's amulet">
		<attribute key="weight" value="700" />
		<attribute key="slotType" value="necklace" />
		<attribute key="charges" value="[B][U]5[/U][/B]" />
		<attribute key="showcharges" value="1" />
		<attribute key="absorbPercentPhysical" value="60" />
		<attribute key="absorbPercentIce" value="40" />
	</item>

in game

Code:
19:29 You see a leviathan's amulet that has [B][U]100 charges[/U][/B] left.
It can only be wielded properly by players of level 80 or higher.
It weighs 7.00 oz.

more bugs...

monster drop ? no



you you create item in gm ^^


/i leviathan's amulet << 100 charges


/i leviathan's amulet,5 <<< 5 charges
 
u read? i did it but got bug whit tha potions
dunno if that's for the items.otb but i'm compiling myselft whitout stackable potions i just wanna it be 8.6 whit items i don't care if it don't got potions stackable i'll use it in a war server ._.
 
sorry, i'm not speak very english =P

you make this part?

Then goto itemloader.h and search for this
CLIENT_VERSION_854 = 16,

When you have found that line replace it with

Code:
	CLIENT_VERSION_854 = 16,
	CLIENT_VERSION_855 = 17,
	CLIENT_VERSION_856 = 18,
	CLIENT_VERSION_857 = 19,
	CLIENT_VERSION_860 = 20

items.cpp

Code:
	else if(Items::dwMinorVersion != [B][U]19[/U][/B])
	{
		std::cout << "[Error - Items::loadFromOtb] Another (client) version of items.otb is required." << std::endl;
		return ERROR_INVALID_FORMAT;

actions/scripts/liquids/potions.lua

Code:
local config = {
	removeOnUse = "no",
	usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
	splashable = "no",
	range = -1,
	realAnimation = "no", -- make text effect visible only for players in range 1x1
	healthMultiplier = 1.0,
	manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
	[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
	[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
	[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

	[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
	[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

	[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end

		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doRemoveItem(item.uid, 1)

		doPlayerAddItem(cid, potion.empty, 1)
		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
	then
		doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
		return true
	end

	if(config.range > 0 and cid ~= itemEx.uid and getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(itemEx.uid)) > config.range) then
		return false
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not config.realAnimation) then
		doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	doRemoveItem(item.uid, 1)
	if(not potion.empty or config.removeOnUse) then
		return true
	end

	doPlayerAddItem(cid, potion.empty, 1)
	return true
end

OBS.: you have to re-compilling(CTR+F11)
 
i said tho i was usin venns server ;3 now i did it by myself but when i run it say's i need libgmp-3.dll anyone know how i fix it?
 
Another bug, when i compile whit this shit.
Compiler: Default compiler
Building Makefile: "C:\Users\{RoDr!Go}\Documents\Desktop\forgottenserver-0.3.6pl1\0.3.6pl1\dev-cpp\Makefile.win"
Executing make...
mingw32-make -f "C:\Users\{RoDr!Go}\Documents\Desktop\forgottenserver-0.3.6pl1\0.3.6pl1\dev-cpp\Makefile.win" all
g++.exe -c ../luascript.cpp -o obj//luascript.o -I"C:/Users/{RoDr!Go}/Documents/Desktop/Stian's Repack Dev-Cpp 0.2, 64bit/Stian's Repack Dev-Cpp 0.2, 64bit/include" -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -fexpensive-optimizations -O1

../luascript.cpp: In member function 'virtual void LuaScriptInterface::registerFunctions()':
../luascript.cpp:2360: error: 'luaGetItemParent' is not a member of 'LuaScriptInterface'

../luascript.cpp: In static member function 'static int32_t LuaScriptInterface::luaL_loadmodlib(lua_State*)':
../luascript.cpp:9786: error: a function-definition is not allowed here before '{' token

../luascript.cpp:10093: error: expected '}' at end of input

mingw32-make: *** [obj//luascript.o] Error 1

Execution terminated
is because of that: i don't know how to install it where do i put it ;<
//getItemParent(uid)
lua_register(m_luaState, "getItemParent", LuaScriptInterface::luaGetItemParent);
}

luascript.cpp:
Code:
int32_t LuaScriptInterface::luaGetItemParent(lua_State* L)
{
	//getItemParent(uid)
	ScriptEnviroment* env = getEnv();

	Item* item = env->getItemByUID(popNumber(L));
	if(!item)
	{
		errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
		lua_pushnil(L);
		return 1;
	}

	Item* container = item->getParent()->getItem();
	pushThing(L, container, env->addThing(container));
	return 1;
}

	//getItemParent(uid)
	lua_register(m_luaState, "getItemParent", LuaScriptInterface::luaGetItemParent);
luascript.h:
Code:
		static int32_t luaGetItemParent(lua_State* L);

?! just say that don't where i have to put it ;<
 
Back
Top