• 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 Attributes MOD

jRiddick

Rustacian
Joined
Oct 11, 2011
Messages
14
Reaction score
7
Attributes MOD
jRiddick

INTRODUCTION
When working on my server I saw that you could have attributes to your items which could increase player skill or stats and add other tasty treats like absorb, increased maximum life and mana. And I thought, "Perfect! This will fit my *censored* system perfectly!", but this thought was abruptly interrupted when the harsh mistress called reality came and slapped me very hard. She reminded me that I can ONLY add these attributes to items in items.xml but not dynamically using the ol' wonderful thing called LUA. For a while my master schemes came crashing down and I went to my corner and started crying, when it suddenly hit me like a freight train, the Attributes MOD. Basically what this does is allow you to use those attributes you would use in items.xml except in LUA. The brilliance of it all is that you just add attributes like you normally would in LUA except now attributes like skilldist is available, perfect eh?

Now you might be screaming at the top of your lungs, HOW DOES IT ALL WORK? To which I answer that it is quite simple really. It works just like the other attribute system does, the effects are just there when you have the specific item equipped and it gets removed when you "dequip" it. The effects are also visible when looking on the item just like the regular system would be, in fact it integrates into the old system so for example, the amazon armor that has a base of +3 dist when given +10 dist using my system will appear as +13 dist when looking on it, neat huh?.

s30wj.jpg

NOTE
There are two current catches with this system as of now. The first one is that I am working on a later rev in the premium board for client version 9.31 but if the rev you are using differs much from mine I can and will help you upon request, just tell me which version or rev you are using. The second one is that I have not been able to thoroughly bug test this other than putting armors and weapons on and off multiple times and closing the server without save etc to see if the points can be bugged to be permanent, or if you can stack points in a way that should not be possible. If you have an active server that you want this system on I will gladly be of service and give more personal and quicker help, just hit me up. I will give credits here for all the bug reports and help I have gotten.

CURRENTLY AVAILABLE ATTRIBUTES
  • skillsword
  • skillaxe
  • skillclub
  • skilldist
  • skillfish
  • skillshield
  • skillfist
  • maxhealthpoints
  • maxmanapoints
  • soulpoints
  • magiclevel
IMPLEMENTATION
The implementation of this is small and very easy, the code is also documented so that you can understand what all the parts are doing. There are two files we modify and two files we create and the files we modify are 'movement.cpp' and 'item.cpp'. The files we create are 'attributesmod.cpp' and 'attributesmod.h'.

NOTE: All these changes takes place in the same folder you have the rest of the source files!

  1. Create attributesmod.h and add the following code:
    PHP:
    ////////////////////////////////////////////////////////////////////////
    // OpenTibia - an opensource roleplaying game
    ////////////////////////////////////////////////////////////////////////
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    ////////////////////////////////////////////////////////////////////////
    
    #ifndef __ATTRIBUTES_MOD__
    #define __ATTRIBUTES_MOD__
    
    // Holds our conversion arrays that we use to convert the SKILL and STAT enums to 
    // the matching attributes.
    // 
    // Example: CONVERSION::SKILL[SKILL_DIST] returns "skilldist"
    struct CONVERSION {
    	static const char* SKILL[7];
    	static const char* STATS[5];
    };
    
    #endif
  2. Create attributesmod.cpp and add the following code:
    PHP:
    ////////////////////////////////////////////////////////////////////////
    // OpenTibia - an opensource roleplaying game
    ////////////////////////////////////////////////////////////////////////
    // This program is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    ////////////////////////////////////////////////////////////////////////
    #include "otpch.h"
    #include "attributesmod.h"
    
    // Creates the lookup array for the skills_t enum. These can be changed
    // but you need to make sure you do not switch positions or remove any of them
    // since these rely on the fact that CONVERSION::SKILL[0] is fist fighting and
    // CONVERSION::SKILL[6] is fish skill. 
    //
    // These are the names that you use when adding attributes in LUA, so to add an
    // fist skill attribute to an armor you use the text described here. 
    const char* CONVERSION::SKILL[7] =
    {
        "skillfist",
        "skillclub",
        "skillsword",
        "skillaxe",
        "skilldist",
        "skillshield",
        "skillfish"
    };
    
    // Creates the lookup array for the stats_t enum. These can be changed
    // but you need to make sure you do not switch positions or remove any of them
    // since these rely on the fact that CONVERSION::STATS[0] is max health potion and
    // CONVERSION::STATS[4] is magic level. 
    //
    // NOTE: 
    //
    // These are the names that you use when adding attributes in LUA, so to add an
    // magic level attribute you use the text in the last one
    const char* CONVERSION::STATS[5] =
    {
        "maxhealthpoints",          // Increase max health
        "maxmanapoints",            // Increase max mana
        "soulpoints",               // Soul points bonus
        "level_not_implemented",    // Level increase not implemented, but can easily be
                                    // Just set an appropriate attribute name here and follow the comments in movement.cpp and item.cpp
        "magiclevel"                // Magic level bonus
    };
  3. Find the following code in movement.cpp:
    PHP:
    #include "combat.h"
    #include "game.h"
  4. Add this underneath:
    PHP:
    // BEGIN ATTRIBUTES MOD
    #include "attributesmod.h"
    // END ATTRIBUTES MOD
  5. Find the following code in movement.cpp:
    PHP:
    	bool needUpdateSkills = false;
    	for(uint32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    	{
    		if(it.abilities.skills[i])
    		{
    			player->setVarSkill((skills_t)i, it.abilities.skills[i]);
    			if(!needUpdateSkills)
    				needUpdateSkills = true;
    		}
    
    		if(it.abilities.skillsPercent[i])
    		{
    			player->setVarSkill((skills_t)i, (int32_t)(player->getSkill((skills_t)i, SKILL_LEVEL) * ((it.abilities.skillsPercent[i] - 100) / 100.f)));
    			if(!needUpdateSkills)
    				needUpdateSkills = true;
    		}
  6. Add this underneath:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		boost::any skillValue = item->getAttribute(CONVERSION::SKILL[i]);
    
    		if (!skillValue.empty()) 
    		{
    			if ((skillValue.type() == typeid(float)) || (skillValue.type() == typeid(int32_t))) 
    			{
    				player->setVarSkill((skills_t)i, boost::any_cast<int32_t>(skillValue));
    				if(!needUpdateSkills)
    					needUpdateSkills = true;
    			}
    		}
    		// END ATTRIBUTES MOD
  7. Find the following code in movement.cpp:
    PHP:
    	bool needUpdateStats = false;
    	for(uint32_t s = STAT_FIRST; s <= STAT_LAST; ++s)
    	{
    		if(it.abilities.stats[s])
    		{
    			player->setVarStats((stats_t)s, it.abilities.stats[s]);
    			if(!needUpdateStats)
    				needUpdateStats = true;
    		}
    
    		if(it.abilities.statsPercent[s])
    		{
    			player->setVarStats((stats_t)s, (int32_t)(player->getDefaultStats((stats_t)s) * ((it.abilities.statsPercent[s] - 100) / 100.f)));
    			if(!needUpdateStats)
    				needUpdateStats = true;
    		}
  8. Add this underneath:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		if((stats_t)s != STAT_LEVEL) 
    		{
    			boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    			if (!statValue.empty())
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))
    				{
    					player->setVarStats((stats_t)s, boost::any_cast<int32_t>(statValue));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    		}
    		// END ATTRIBUTES MOD
  9. Find the following code in movement.cpp:
    PHP:
    	bool needUpdateSkills = false;
    	for(uint32_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    	{
    		if(it.abilities.skills[i])
    		{
    			needUpdateSkills = true;
    			player->setVarSkill((skills_t)i, -it.abilities.skills[i]);
    		}
    
    		if(it.abilities.skillsPercent[i])
    		{
    			needUpdateSkills = true;
    			player->setVarSkill((skills_t)i, -(int32_t)(player->getSkill((skills_t)i, SKILL_LEVEL) * ((it.abilities.skillsPercent[i] - 100) / 100.f)));
    		}
  10. Add this underneath:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		boost::any skillValue = item->getAttribute(CONVERSION::SKILL[i]);
    
    		if (!skillValue.empty()) 
    		{
    			if ((skillValue.type() == typeid(float)) || (skillValue.type() == typeid(int32_t))) 
    			{
    				player->setVarSkill((skills_t)i, -boost::any_cast<int32_t>(skillValue));
    				if(!needUpdateSkills)
    					needUpdateSkills = true;
    			}
    		}
    		// END ATTRIBUTES MOD
  11. Find the following code in movement.cpp:
    PHP:
    	bool needUpdateStats = false;
    	for(uint32_t s = STAT_FIRST; s <= STAT_LAST; ++s)
    	{
    		if(it.abilities.stats[s])
    		{
    			needUpdateStats = true;
    			player->setVarStats((stats_t)s, -it.abilities.stats[s]);
    		}
    
    		if(it.abilities.statsPercent[s])
    		{
    			needUpdateStats = true;
    			player->setVarStats((stats_t)s, -(int32_t)(player->getDefaultStats((stats_t)s) * ((it.abilities.statsPercent[s] - 100) / 100.f)));
    		}
  12. Add this underneath:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		if ((stats_t)s != STAT_LEVEL)
    		{
    			boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    			if (!statValue.empty()) 
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t))) 
    				{
    					player->setVarStats((stats_t)s, -boost::any_cast<int32_t>(statValue));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    		}
    		// END ATTRIBUTES MOD
  13. Find the following code in item.cpp:
    PHP:
    #include "movement.h"
  14. Add this underneath:
    PHP:
    // BEGIN ATTRIBUTES MOD
    #include "attributesmod.h"
    // END ATTRIBUTES MOd
  15. Find the following code in item.cpp
    PHP:
    else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND)
    		{
    			if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack())))
    			{
    				begin = false;
    				s << " (Atk:";
    				if(it.abilities.elementType != COMBAT_NONE)
    				{
    					s << std::max((int32_t)0, int32_t((item ? item->getAttack() : it.attack) - it.abilities.elementDamage));
    					if(it.extraAttack || (item && item->getExtraAttack()))
    						s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
    
    					s << " physical + " << it.abilities.elementDamage << " " << getCombatName(it.abilities.elementType);
    				}
    				else
    				{
    					s << int32_t(item ? item->getAttack() : it.attack);
    					if(it.extraAttack || (item && item->getExtraAttack()))
    						s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
    				}
    			}
    
    			if(it.defense || it.extraDefense || (item && (item->getDefense() || item->getExtraDefense())))
    			{
    				if(begin)
    				{
    					begin = false;
    					s << " (";
    				}
    				else
    					s << ", ";
    
    				s << "Def:" << int32_t(item ? item->getDefense() : it.defense);
    				if(it.extraDefense || (item && item->getExtraDefense()))
    					s << " " << std::showpos << int32_t(item ? item->getExtraDefense() : it.extraDefense) << std::noshowpos;
    			}
    		}
    
    		for(uint16_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    		{
    			if(!it.abilities.skills[i])
    				continue;
    
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			s << getSkillName(i) << " " << std::showpos << (int32_t)it.abilities.skills[i] << std::noshowpos;
    		}
    
    		if(it.abilities.stats[STAT_MAGICLEVEL])
    		{
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			s << "magic level " << std::showpos << (int32_t)it.abilities.stats[STAT_MAGICLEVEL] << std::noshowpos;
    		}
  16. Replace with:
    PHP:
    else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND)
    		{
    			if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack())))
    			{
    				begin = false;
    				s << " (Atk:";
    				if(it.abilities.elementType != COMBAT_NONE)
    				{
    					s << std::max((int32_t)0, int32_t((item ? item->getAttack() : it.attack) - it.abilities.elementDamage));
    					if(it.extraAttack || (item && item->getExtraAttack()))
    						s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
    
    					s << " physical + " << it.abilities.elementDamage << " " << getCombatName(it.abilities.elementType);
    				}
    				else
    				{
    					s << int32_t(item ? item->getAttack() : it.attack);
    					if(it.extraAttack || (item && item->getExtraAttack()))
    						s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos;
    				}
    			}
    
    			if(it.defense || it.extraDefense || (item && (item->getDefense() || item->getExtraDefense())))
    			{
    				if(begin)
    				{
    					begin = false;
    					s << " (";
    				}
    				else
    					s << ", ";
    
    				s << "Def:" << int32_t(item ? item->getDefense() : it.defense);
    				if(it.extraDefense || (item && item->getExtraDefense()))
    					s << " " << std::showpos << int32_t(item ? item->getExtraDefense() : it.extraDefense) << std::noshowpos;
    			}
    		}
    
    		for(uint16_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    		{
    			// BEGIN ATTRIBUTES MOD
    			// Get the value if any from items attribute list
    			boost::any attr = item->getAttribute(CONVERSION::SKILL[i]);
    
    			// Make sure we either have abilities or an attribute
    			if(!it.abilities.skills[i] && attr.empty())
    				continue;
    
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			// Holds the total increased value
    			int32_t val = 0;
    
    			// If we have an ability then include that into the answer
    			if (it.abilities.skills[i])
    				val = (int32_t)it.abilities.skills[i];
    			
    			// Make sure the value exist and that it is either float or integer.
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t)))) 
    			{
    				// Add attribute value to val
    				val += boost::any_cast<int32_t>(attr);
    			}
    
    			s << getSkillName(i) << " " << std::showpos << val << std::noshowpos;
    			// END ATTRIBUTES MOD
    		}
    
    		// BEGIN ATTRIBUTES MOD
    		boost::any attr = item->getAttribute(CONVERSION::STATS[STAT_MAGICLEVEL]);
    
    		if(it.abilities.stats[STAT_MAGICLEVEL] || !attr.empty())
    		{
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			// Holds the total increased value
    			int32_t val = 0;
    
    			// If we have an ability then include that into the value
    			if (it.abilities.stats[STAT_MAGICLEVEL])
    				val = (int32_t)it.abilities.stats[STAT_MAGICLEVEL];
    
    			// Make sure the value exist and that it is either float or integer.
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    			{
    				// Add attribute value to val
    				val += boost::any_cast<int32_t>(attr);
    			}
    
    			s << "magic level " << std::showpos << val << std::noshowpos;
    		}
    		// END ATTRIBUTES MOD
  17. Find the following code in item.cpp
    PHP:
    else if(it.armor || (item && item->getArmor()) || it.showAttributes)
    	{
    		int32_t tmp = it.armor;
    		if(item)
    			tmp = item->getArmor();
    
    		bool begin = true;
    		if(tmp)
    		{
    			s << " (Arm:" << tmp;
    			begin = false;
    		}
    
    		for(uint16_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    		{
    			if(!it.abilities.skills[i])
    				continue;
    
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			s << getSkillName(i) << " " << std::showpos << (int32_t)it.abilities.skills[i] << std::noshowpos;
    		}
    
    		if(it.abilities.stats[STAT_MAGICLEVEL])
    		{
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			s << "magic level " << std::showpos << (int32_t)it.abilities.stats[STAT_MAGICLEVEL] << std::noshowpos;
    		}
  18. Replace with:
    PHP:
    else if(it.armor || (item && item->getArmor()) || it.showAttributes)
    	{
    		int32_t tmp = it.armor;
    		if(item)
    			tmp = item->getArmor();
    
    		bool begin = true;
    		if(tmp)
    		{
    			s << " (Arm:" << tmp;
    			begin = false;
    		}
    
    		for(uint16_t i = SKILL_FIRST; i <= SKILL_LAST; ++i)
    		{
    			// BEGIN ATTRIBUTES MOD
    			// Get the value if any from items attribute list
    			boost::any attr = item->getAttribute(CONVERSION::SKILL[i]);
    
    			// Make sure we either have abilities or an attribute
    			if(!it.abilities.skills[i] && attr.empty())
    				continue;
    
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			// Holds the total increased value
    			int32_t val = 0;
    
    			// If we have an ability then include that into the value
    			if (it.abilities.skills[i])
    				val = (int32_t)it.abilities.skills[i];
    
    			// Make sure the value exist and that it is either float or integer.
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    			{
    				// Add attribute value to val
    				val += boost::any_cast<int32_t>(attr);
    			}
    
    			s << getSkillName(i) << " " << std::showpos << val << std::noshowpos;
    			// END ATTRIBUTES MOD
    		}
    
    		// BEGIN ATTRIBUTES MOD
    		boost::any attr = item->getAttribute(CONVERSION::STATS[STAT_MAGICLEVEL]);
    
    		if(it.abilities.stats[STAT_MAGICLEVEL] || !attr.empty())
    		{
    			if(begin)
    			{
    				begin = false;
    				s << " (";
    			}
    			else
    				s << ", ";
    
    			// Holds the total increased value
    			int32_t val = 0;
    
    			// If we have an ability then include that into the value
    			if (it.abilities.stats[STAT_MAGICLEVEL])
    				val = (int32_t)it.abilities.stats[STAT_MAGICLEVEL];
    
    			// Make sure the value exist and that it is either float or integer.
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    			{
    				// Add attribute value to val
    				val += boost::any_cast<int32_t>(attr);
    			}
    
    			s << "magic level " << std::showpos << val << std::noshowpos;
    		}
    		// END ATTRIBUTES MOD
How to enable the level attribute:
  1. Open attributesmod.cpp and find this code:
    PHP:
    "level_not_implemented",    // Level increase not implemented, but can easily be
  2. Replace it with:
    PHP:
    "playerlevel",    // Level increase not implemented, but can easily be
  3. Find the following code in movement.cpp:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		if ((stats_t)s != STAT_LEVEL)
    		{
    			boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    			if (!statValue.empty()) 
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t))) 
    				{
    					player->setVarStats((stats_t)s, -boost::any_cast<int32_t>(statValue));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    		}
    		// END ATTRIBUTES MOD
  4. Replace it with:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    		if (!statValue.empty()) 
    		{
    			if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t))) 
    			{
    				player->setVarStats((stats_t)s, -boost::any_cast<int32_t>(statValue));
    				if(!needUpdateStats)
    					needUpdateStats = true;
    			}
    		}
    		// END ATTRIBUTES MOD
  5. Find the following code in movement.cpp:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		if((stats_t)s != STAT_LEVEL) 
    		{
    			boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    			if (!statValue.empty())
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))
    				{
    					player->setVarStats((stats_t)s, boost::any_cast<int32_t>(statValue));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    		}
    		// END ATTRIBUTES MOD
  6. Replace with:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    		if (!statValue.empty())
    		{
    			if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))
    			{
    				player->setVarStats((stats_t)s, boost::any_cast<int32_t>(statValue));
    				if(!needUpdateStats)
    					needUpdateStats = true;
    			}
    		}
    		// END ATTRIBUTES MOD
NOTE WHEN COMPILING THIS "SMALL" MOD
If you are on an Linux distribution you need to make sure that you add attributesmod.cpp into your Makefile or if you use autoconf then you need to change Makefile.am and rerun ./configure with the needed parameters. I have Makefile.am so I added attributesmod.cpp to the end of "theforgottenserver_SOURCES" list so it looks like:
PHP:
vocation.h attributesmod.cpp

SMALL TUTORIAL ON HOW TO USE IT
Code:
-- When you have the unique id of an item you can just add
-- attributes like normal except now you have the ones from the mod as well. 
-- This one adds 10 levels of fist fighting skill as an attributes. 
doItemSetAttribute(item.uid, "skillfist", 10)

There are a couple of things you should now, these effects are NOT added if you do not add the item that should give the bonus to movement.xml so that it executes onEquip and onDeEquip. It is also worth noting that these affects can be added to all items but unless it's an equipable item that executes said functions it will not have any effect at all, apart from showing up when looking on the item.

WHAT SHOULD I DO AFTER I HAVE USED THIS AWESOME MOD IN MY SERVER?
This is totally up to you but I welcome rep and credit. But above all else I would like to know what you use it for, what exciting and cool new features and mods have you been able to create using this mod? You do not need to tell the whole world just tell me and give me ideas on how I can improve it!

You can also request other mods by PM, if I find them cool enough and I have the time I will create the mod and give you credit. By mods I mean something bigger not a small change that accomplishes nothing useful.
 
Last edited:
the real fun starts when you start playing with damage reductions and additional elements for weapons:D
anyway, great job
(About movements: I once cerated php script creating mod containing all equipable items onEquip and onDeEquip lines, kinda wrong way but probably better than checking attributes onThink to make it work without movements)
 
as i understood that mod allows of using attr function on scripts , is it true ?
like this one
doItemSetAttribute(item.uid, "skillfist", 10)

what if u add more attr ? like these

Code:
maxhealthpercent
maxmanapercent
healthgain
healthticks 
managain
manaticks
absorbpercent

or u can teach me how to modify the codes to add new attr :D
 
error while compiling :S

Code:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Lonly\Desktop\trunk.r3884\dev-cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Documents and Settings\Lonly\Desktop\trunk.r3884\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../admin.cpp -o obj//admin.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../allocator.cpp -o obj//allocator.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../baseevents.cpp -o obj//baseevents.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../beds.cpp -o obj//beds.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../chat.cpp -o obj//chat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../combat.cpp -o obj//combat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../condition.cpp -o obj//condition.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../configmanager.cpp -o obj//configmanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../connection.cpp -o obj//connection.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../container.cpp -o obj//container.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creature.cpp -o obj//creature.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creatureevent.cpp -o obj//creatureevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../cylinder.cpp -o obj//cylinder.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../database.cpp -o obj//database.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemanager.cpp -o obj//databasemanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemysql.cpp -o obj//databasemysql.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasesqlite.cpp -o obj//databasesqlite.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../depot.cpp -o obj//depot.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../dispatcher.cpp -o obj//dispatcher.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../exception.cpp -o obj//exception.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../fileloader.cpp -o obj//fileloader.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../game.cpp -o obj//game.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../gameservers.cpp -o obj//gameservers.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../globalevent.cpp -o obj//globalevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../group.cpp -o obj//group.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../house.cpp -o obj//house.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../housetile.cpp -o obj//housetile.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioban.cpp -o obj//ioban.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioguild.cpp -o obj//ioguild.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iologindata.cpp -o obj//iologindata.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomap.cpp -o obj//iomap.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomapserialize.cpp -o obj//iomapserialize.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../item.cpp -o obj//item.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

../item.cpp: In static member function `static std::string Item::getDescription(const ItemType&, int32_t, const Item*, int32_t, bool)':
../item.cpp:871: error: `CONVERSION' has not been declared
../item.cpp:871: error: `SKILL' was not declared in this scope

../item.cpp:904: error: `CONVERSION' has not been declared
../item.cpp:904: error: `STATS' was not declared in this scope

../item.cpp:1178: error: `CONVERSION' has not been declared
../item.cpp:1178: error: `SKILL' was not declared in this scope

../item.cpp:1211: error: `CONVERSION' has not been declared
../item.cpp:1211: error: `STATS' was not declared in this scope

make.exe: *** [obj//item.o] Error 1

Execution terminated
 
as i understood that mod allows of using attr function on scripts , is it true ?
like this one

what if u add more attr ? like these

Code:
maxhealthpercent
maxmanapercent
healthgain
healthticks 
managain
manaticks
absorbpercent

or u can teach me how to modify the codes to add new attr :D

Yes that is correct, this basically just exposes some of those attributes that is only available when set in 'items.xml'. And regarding your question to adding more attributes, yes I can help you with those just give me a minute to fix it and I will post a guide :)
 
error while compiling :S

Code:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Lonly\Desktop\trunk.r3884\dev-cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Documents and Settings\Lonly\Desktop\trunk.r3884\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../admin.cpp -o obj//admin.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../allocator.cpp -o obj//allocator.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../baseevents.cpp -o obj//baseevents.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../beds.cpp -o obj//beds.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../chat.cpp -o obj//chat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../combat.cpp -o obj//combat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../condition.cpp -o obj//condition.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../configmanager.cpp -o obj//configmanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../connection.cpp -o obj//connection.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../container.cpp -o obj//container.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creature.cpp -o obj//creature.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creatureevent.cpp -o obj//creatureevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../cylinder.cpp -o obj//cylinder.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../database.cpp -o obj//database.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemanager.cpp -o obj//databasemanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemysql.cpp -o obj//databasemysql.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasesqlite.cpp -o obj//databasesqlite.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../depot.cpp -o obj//depot.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../dispatcher.cpp -o obj//dispatcher.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../exception.cpp -o obj//exception.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../fileloader.cpp -o obj//fileloader.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../game.cpp -o obj//game.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../gameservers.cpp -o obj//gameservers.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../globalevent.cpp -o obj//globalevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../group.cpp -o obj//group.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../house.cpp -o obj//house.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../housetile.cpp -o obj//housetile.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioban.cpp -o obj//ioban.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioguild.cpp -o obj//ioguild.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iologindata.cpp -o obj//iologindata.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomap.cpp -o obj//iomap.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomapserialize.cpp -o obj//iomapserialize.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../item.cpp -o obj//item.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

../item.cpp: In static member function `static std::string Item::getDescription(const ItemType&, int32_t, const Item*, int32_t, bool)':
../item.cpp:871: error: `CONVERSION' has not been declared
../item.cpp:871: error: `SKILL' was not declared in this scope

../item.cpp:904: error: `CONVERSION' has not been declared
../item.cpp:904: error: `STATS' was not declared in this scope

../item.cpp:1178: error: `CONVERSION' has not been declared
../item.cpp:1178: error: `SKILL' was not declared in this scope

../item.cpp:1211: error: `CONVERSION' has not been declared
../item.cpp:1211: error: `STATS' was not declared in this scope

make.exe: *** [obj//item.o] Error 1

Execution terminated

Yes, you need to add "attributesmod.cpp" to the Makefile.win so that it get's compiled with the rest of the items. Open 'Makefile.win' in you favorite text editor and in the list where you find "weapons.cpp waitlist.cpp vocation.cpp trashholder.cpp" and the rest of the ".cpp" files just add "attributesmod.cpp" and the try to compile again.
 
i add it on makefile.am should i keep or delete it ?

i will add these lines to makefile.win ?

obj//attributesmod.o: ../attributesmod.cpp
$(CPP) -c ../attributesmod.cpp -o obj//attributesmod.o $(CXXFLAGS)
 
yes i use it

and i got the same error when i added attributesmod

or tell me how to add it on makefile.win or makefile.am
 
If you are using Dev-Cpp then do NOT edit the Makefiles.

Right click on "TheForgottenServer" and click on "Add to Project":
tutorial.jpg

In the dialog window that comes up you choose both "attributesmod.cpp" and "attributesmod.h" and then click "Open":
tutorial2.jpg

Then you compile like you normally would in Dev-Cpp! :)
 
Last edited:
Attributes MOD additional attributes

ADDITIONAL ATTRIBUTES
  • managain
  • manaticks
  • healthgain
  • healthticks
  • maxhealthpercent
  • maxmanapercent
  • soulpercent
  • magiclevelpercent

IMPLEMENTATION

  1. Find the following code in attributesmod.h:
    PHP:
    struct CONVERSION { 
        static const char* SKILL[7]; 
        static const char* STATS[5]; 
    };
  2. Replace with:
    PHP:
    struct CONVERSION {
    	static const char* SKILL[7];
    	static const char* STATS[5];
    	static const char* STAT_PERCENT[5];
    
    	static const char* MANA_REGEN_GAIN;
    	static const char* MANA_REGEN_TICK;
    	static const char* HEALTH_REGEN_GAIN;
    	static const char* HEALTH_REGEN_TICK;
    };
  3. Find the following code in attributesmod.cpp:
    PHP:
    const char* CONVERSION::STATS[5] =
    {
        "maxhealthpoints",          // Increase max health
        "maxmanapoints",            // Increase max mana
        "soulpoints",               // Soul points bonus
        "level_not_implemented",    // Level increase not implemented, but can easily be
                                    // Just set an appropriate attribute name here and follow the comments in movement.cpp and item.cpp
        "magiclevel",               // Magic level bonus
    };
  4. Add this underneath:
    PHP:
    const char* CONVERSION::STAT_PERCENT[5] =
    {
        "maxhealthpercent",           // Increase max health
        "maxmanapercent",             // Increase max mana
        "soulpercent",				  // Soul points bonus
        "level_not_implemented",	  // Level increase not implemented, but can easily be
    								  // Just set an appropriate attribute name here and follow the comments in movement.cpp and item.cpp
        "magiclevelpercent",          // Magic level bonus
    };
    
    const char* CONVERSION::HEALTH_REGEN_GAIN = "healthgain";
    const char* CONVERSION::HEALTH_REGEN_TICK = "healthticks";
    const char* CONVERSION::MANA_REGEN_GAIN = "managain";
    const char* CONVERSION::MANA_REGEN_TICK = "manaticks";
  5. Find the following code in movement.cpp:
    PHP:
    	if(it.abilities.regeneration)
    	{
    		Condition* condition = Condition::createCondition((ConditionId_t)slot, CONDITION_REGENERATION, -1, 0);
    		if(it.abilities.healthGain)
    			condition->setParam(CONDITIONPARAM_HEALTHGAIN, it.abilities.healthGain);
    
    		if(it.abilities.healthTicks)
    			condition->setParam(CONDITIONPARAM_HEALTHTICKS, it.abilities.healthTicks);
    
    		if(it.abilities.manaGain)
    			condition->setParam(CONDITIONPARAM_MANAGAIN, it.abilities.manaGain);
    
    		if(it.abilities.manaTicks)
    			condition->setParam(CONDITIONPARAM_MANATICKS, it.abilities.manaTicks);
    
    		player->addCondition(condition);
    	}
  6. Replace with:
    PHP:
    // BEGIN ATTRIBUTES MOD
    	if(it.abilities.regeneration || 
    			!item->getAttribute(CONVERSION::HEALTH_REGEN_GAIN).empty() ||
    			!item->getAttribute(CONVERSION::HEALTH_REGEN_TICK).empty() ||
    			!item->getAttribute(CONVERSION::MANA_REGEN_GAIN).empty() ||
    			!item->getAttribute(CONVERSION::MANA_REGEN_TICK).empty() )
    	{
    		Condition* condition = Condition::createCondition((ConditionId_t)slot, CONDITION_REGENERATION, -1, 0);
    		boost::any attr;
    
    		attr = item->getAttribute(CONVERSION::HEALTH_REGEN_GAIN);
    		if(it.abilities.healthGain || !attr.empty())
    		{
    			int32_t val = 0;
    
    			if (it.abilities.healthGain)
    				val += it.abilities.healthGain;
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    				val += boost::any_cast<int32_t>(attr);
    
    			condition->setParam(CONDITIONPARAM_HEALTHGAIN, val);
    		}
    
    		attr = item->getAttribute(CONVERSION::HEALTH_REGEN_TICK);
    		if(it.abilities.healthTicks || !attr.empty())
    		{
    			int32_t val = 0;
    
    			if (it.abilities.healthTicks)
    				val += it.abilities.healthTicks;
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    				val += boost::any_cast<int32_t>(attr);
    
    			condition->setParam(CONDITIONPARAM_HEALTHTICKS, val);
    		}
    
    		attr = item->getAttribute(CONVERSION::MANA_REGEN_GAIN);
    		if(it.abilities.manaGain || !attr.empty())
    		{
    			int32_t val = 0;
    
    			if (it.abilities.manaGain)
    				val += it.abilities.manaGain;
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    				val += boost::any_cast<int32_t>(attr);
    
    			condition->setParam(CONDITIONPARAM_MANAGAIN, val);
    		}
    
    		attr = item->getAttribute(CONVERSION::MANA_REGEN_TICK);
    		if(it.abilities.manaTicks || !attr.empty())
    		{
    			int32_t val = 0;
    
    			if (it.abilities.manaTicks)
    				val += it.abilities.manaTicks;
    			if (!attr.empty() && ((attr.type() == typeid(float)) || (attr.type() == typeid(int32_t))))
    				val += boost::any_cast<int32_t>(attr);
    
    			condition->setParam(CONDITIONPARAM_MANATICKS, val);
    		}
    
    		player->addCondition(condition);
    	}
    	// END ATTRIBUTES MOD
  7. Find the following code in movement.cpp:
    PHP:
    // BEGIN ATTRIBUTES MOD 
            if ((stats_t)s != STAT_LEVEL) 
            { 
                boost::any statValue = item->getAttribute(CONVERSION::STATS[s]); 
    
                if (!statValue.empty())  
                { 
                    if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))  
                    { 
                        player->setVarStats((stats_t)s, boost::any_cast<int32_t>(statValue)); 
                        if(!needUpdateStats) 
                            needUpdateStats = true; 
                    } 
                } 
            } 
            // END ATTRIBUTES MOD
  8. Replace with:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		if((stats_t)s != STAT_LEVEL) 
    		{
    			boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    			if (!statValue.empty())
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))
    				{
    					player->setVarStats((stats_t)s, boost::any_cast<int32_t>(statValue));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    
    			statValue = item->getAttribute(CONVERSION::STAT_PERCENT[s]);
    
    			if(!statValue.empty())
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))
    				{
    					player->setVarStats((stats_t)s, (int32_t)(player->getDefaultStats((stats_t)s) * ((boost::any_cast<int32_t>(statValue) - 100) / 100.f)));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    		}
    		// END ATTRIBUTES MOD
  9. Find the following code in movement.cpp:
    PHP:
    // BEGIN ATTRIBUTES MOD 
            if ((stats_t)s != STAT_LEVEL) 
            { 
                boost::any statValue = item->getAttribute(CONVERSION::STATS[s]); 
    
                if (!statValue.empty())  
                { 
                    if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))  
                    { 
                        player->setVarStats((stats_t)s, -boost::any_cast<int32_t>(statValue)); 
                        if(!needUpdateStats) 
                            needUpdateStats = true; 
                    } 
                } 
            } 
            // END ATTRIBUTES MOD
  10. Replace with:
    PHP:
    		// BEGIN ATTRIBUTES MOD
    		if ((stats_t)s != STAT_LEVEL)
    		{
    			boost::any statValue = item->getAttribute(CONVERSION::STATS[s]);
    
    			if (!statValue.empty()) 
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t))) 
    				{
    					player->setVarStats((stats_t)s, -boost::any_cast<int32_t>(statValue));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    
    			statValue = item->getAttribute(CONVERSION::STAT_PERCENT[s]);
    
    			if(!statValue.empty())
    			{
    				if ((statValue.type() == typeid(float)) || (statValue.type() == typeid(int32_t)))
    				{
    					player->setVarStats((stats_t)s, -(int32_t)(player->getDefaultStats((stats_t)s) * ((boost::any_cast<int32_t>(statValue) - 100) / 100.f)));
    					if(!needUpdateStats)
    						needUpdateStats = true;
    				}
    			}
    		}
    		// END ATTRIBUTES MOD
  11. Find the following code in item.cpp:
    PHP:
    if(it.abilities.regeneration)
    	{
  12. Replace all occurrences with:
    PHP:
    // BEGIN ATTRIBUTES MOD
    		if(it.abilities.regeneration || 
    			!item->getAttribute(CONVERSION::HEALTH_REGEN_GAIN).empty() ||
    			!item->getAttribute(CONVERSION::HEALTH_REGEN_TICK).empty() ||
    			!item->getAttribute(CONVERSION::MANA_REGEN_GAIN).empty() ||
    			!item->getAttribute(CONVERSION::MANA_REGEN_TICK).empty() )
    			// END ATTRIBUTES MOD
    		{

Just recompile and you are done!
 
the same error :S anybody tested it ?

Code:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Lonly\Desktop\trunk.r3884\dev-cpp\Makefile.win"
Executing  make clean
rm -f obj//actions.o obj//admin.o obj//allocator.o obj//baseevents.o obj//beds.o obj//chat.o obj//combat.o obj//condition.o obj//configmanager.o obj//connection.o obj//container.o obj//creature.o obj//creatureevent.o obj//cylinder.o obj//database.o obj//databasemanager.o obj//databasemysql.o obj//databasesqlite.o obj//depot.o obj//dispatcher.o obj//exception.o obj//fileloader.o obj//game.o obj//gameservers.o obj//globalevent.o obj//group.o obj//house.o obj//housetile.o obj//ioban.o obj//ioguild.o obj//iologindata.o obj//iomap.o obj//iomapserialize.o obj//item.o obj//itemattributes.o obj//items.o obj//luascript.o obj//mailbox.o obj//manager.o obj//map.o obj//monster.o obj//monsters.o obj//movement.o obj//networkmessage.o obj//npc.o obj//otserv.o obj//outfit.o obj//outputmessage.o obj//party.o obj//player.o obj//position.o obj//protocol.o obj//protocolgame.o obj//protocolhttp.o obj//protocollogin.o obj//protocolold.o obj//quests.o obj//raids.o obj//scheduler.o obj//scriptmanager.o obj//server.o obj//spawn.o obj//spells.o obj//status.o obj//talkaction.o obj//teleport.o obj//textlogger.o obj//thing.o obj//tile.o obj//tools.o obj//trashholder.o obj//vocation.o obj//waitlist.o obj//weapons.o obj//attributesmod.o obj//TheForgottenServer_private.res TheForgottenServer.exe

g++.exe -c ../actions.cpp -o obj//actions.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../admin.cpp -o obj//admin.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../allocator.cpp -o obj//allocator.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../baseevents.cpp -o obj//baseevents.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../beds.cpp -o obj//beds.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../chat.cpp -o obj//chat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../combat.cpp -o obj//combat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../condition.cpp -o obj//condition.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../configmanager.cpp -o obj//configmanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../connection.cpp -o obj//connection.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../container.cpp -o obj//container.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creature.cpp -o obj//creature.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creatureevent.cpp -o obj//creatureevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../cylinder.cpp -o obj//cylinder.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../database.cpp -o obj//database.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemanager.cpp -o obj//databasemanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemysql.cpp -o obj//databasemysql.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasesqlite.cpp -o obj//databasesqlite.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../depot.cpp -o obj//depot.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../dispatcher.cpp -o obj//dispatcher.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../exception.cpp -o obj//exception.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../fileloader.cpp -o obj//fileloader.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../game.cpp -o obj//game.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../gameservers.cpp -o obj//gameservers.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../globalevent.cpp -o obj//globalevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../group.cpp -o obj//group.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../house.cpp -o obj//house.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../housetile.cpp -o obj//housetile.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioban.cpp -o obj//ioban.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioguild.cpp -o obj//ioguild.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iologindata.cpp -o obj//iologindata.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomap.cpp -o obj//iomap.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomapserialize.cpp -o obj//iomapserialize.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../item.cpp -o obj//item.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

../item.cpp: In static member function `static std::string Item::getDescription(const ItemType&, int32_t, const Item*, int32_t, bool)':
../item.cpp:871: error: `CONVERSION' has not been declared
../item.cpp:871: error: `SKILL' was not declared in this scope

../item.cpp:904: error: `CONVERSION' has not been declared
../item.cpp:904: error: `STATS' was not declared in this scope

../item.cpp:1178: error: `CONVERSION' has not been declared
../item.cpp:1178: error: `SKILL' was not declared in this scope

../item.cpp:1211: error: `CONVERSION' has not been declared
../item.cpp:1211: error: `STATS' was not declared in this scope

make.exe: *** [obj//item.o] Error 1

Execution terminated
 
the same error :S anybody tested it ?

Code:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Lonly\Desktop\trunk.r3884\dev-cpp\Makefile.win"
Executing  make clean
rm -f obj//actions.o obj//admin.o obj//allocator.o obj//baseevents.o obj//beds.o obj//chat.o obj//combat.o obj//condition.o obj//configmanager.o obj//connection.o obj//container.o obj//creature.o obj//creatureevent.o obj//cylinder.o obj//database.o obj//databasemanager.o obj//databasemysql.o obj//databasesqlite.o obj//depot.o obj//dispatcher.o obj//exception.o obj//fileloader.o obj//game.o obj//gameservers.o obj//globalevent.o obj//group.o obj//house.o obj//housetile.o obj//ioban.o obj//ioguild.o obj//iologindata.o obj//iomap.o obj//iomapserialize.o obj//item.o obj//itemattributes.o obj//items.o obj//luascript.o obj//mailbox.o obj//manager.o obj//map.o obj//monster.o obj//monsters.o obj//movement.o obj//networkmessage.o obj//npc.o obj//otserv.o obj//outfit.o obj//outputmessage.o obj//party.o obj//player.o obj//position.o obj//protocol.o obj//protocolgame.o obj//protocolhttp.o obj//protocollogin.o obj//protocolold.o obj//quests.o obj//raids.o obj//scheduler.o obj//scriptmanager.o obj//server.o obj//spawn.o obj//spells.o obj//status.o obj//talkaction.o obj//teleport.o obj//textlogger.o obj//thing.o obj//tile.o obj//tools.o obj//trashholder.o obj//vocation.o obj//waitlist.o obj//weapons.o obj//attributesmod.o obj//TheForgottenServer_private.res TheForgottenServer.exe

g++.exe -c ../actions.cpp -o obj//actions.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../admin.cpp -o obj//admin.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../allocator.cpp -o obj//allocator.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../baseevents.cpp -o obj//baseevents.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../beds.cpp -o obj//beds.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../chat.cpp -o obj//chat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../combat.cpp -o obj//combat.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../condition.cpp -o obj//condition.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../configmanager.cpp -o obj//configmanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../connection.cpp -o obj//connection.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../container.cpp -o obj//container.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creature.cpp -o obj//creature.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../creatureevent.cpp -o obj//creatureevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../cylinder.cpp -o obj//cylinder.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../database.cpp -o obj//database.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemanager.cpp -o obj//databasemanager.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasemysql.cpp -o obj//databasemysql.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../databasesqlite.cpp -o obj//databasesqlite.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../depot.cpp -o obj//depot.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../dispatcher.cpp -o obj//dispatcher.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../exception.cpp -o obj//exception.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../fileloader.cpp -o obj//fileloader.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../game.cpp -o obj//game.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../gameservers.cpp -o obj//gameservers.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../globalevent.cpp -o obj//globalevent.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../group.cpp -o obj//group.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../house.cpp -o obj//house.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../housetile.cpp -o obj//housetile.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioban.cpp -o obj//ioban.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../ioguild.cpp -o obj//ioguild.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iologindata.cpp -o obj//iologindata.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomap.cpp -o obj//iomap.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../iomapserialize.cpp -o obj//iomapserialize.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

g++.exe -c ../item.cpp -o obj//item.o -I"F:/New Folder (2)/Stian's Repack Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__WAR_SYSTEM__   -fexpensive-optimizations -O1

../item.cpp: In static member function `static std::string Item::getDescription(const ItemType&, int32_t, const Item*, int32_t, bool)':
../item.cpp:871: error: `CONVERSION' has not been declared
../item.cpp:871: error: `SKILL' was not declared in this scope

../item.cpp:904: error: `CONVERSION' has not been declared
../item.cpp:904: error: `STATS' was not declared in this scope

../item.cpp:1178: error: `CONVERSION' has not been declared
../item.cpp:1178: error: `SKILL' was not declared in this scope

../item.cpp:1211: error: `CONVERSION' has not been declared
../item.cpp:1211: error: `STATS' was not declared in this scope

make.exe: *** [obj//item.o] Error 1

Execution terminated

The output tells me that the file attributesmod.h cannot be found (check spelling and position of it, needs to be in the same folder as the rest of .cpp and .h files). This is because it reports that the CONVERSION struct has not been declared (or in lame mans terms, nothing has told the compiler that this struct should exist at all).
 
Good work and topic...I always thought that too, but had no idea how to do...Congrats!

but I think it has some problems, such as:
in item.cpp you have do add
#include "attributesmod.h"

i think that is the problem of Hrsha

but have other..
914 item.cpp request for member `skills' in `it->ItemType::abilities', which is of non-class type `Abilities* const'

so, change this:
(it.abilities.skills)
for
(it.abilities->skills)


-------------------------------------------------------------
I have been wrong, but not added stats to the player :/
 
Last edited:
Good work and topic...I always thought that too, but had no idea how to do...Congrats!

but I think it has some problems, such as:
in item.cpp you have do add
#include "attributesmod.h"

i think that is the problem of Hrsha

but have other..
914 item.cpp request for member `skills' in `it->ItemType::abilities', which is of non-class type `Abilities* const'

so, change this:
(it.abilities.skills)
for
(it.abilities->skills)


-------------------------------------------------------------
I have been wrong, but not added stats to the player :/


Thank you and thank you for pointing out the part I forgot. I have now edited the guide accordingly and included the '#include "attributesmod.h"' part in the guide. Can you show me the part of the code that fails? And one reason to why the stats does not get added can be that the item (that has the attributes) needs to be in "movement.xml" with "onEquip" and "onDeEquip" registered, have not yet figured out a way to programmatically add "onEquip" and "onDeEquip", but I am working on it.
 
i have added #include "attributesmod.h" into item.cpp and compiling succeed Thanks sfmlarl
but when i test it with that script

local ho = 1
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray({2433,8910,8922}, itemEx.itemid) then
doItemSetAttribute(itemEx.uid, "description", " +50 Skills. It Belongs To ".. getCreatureName(cid) .. ".")
doItemSetAttribute(item.uid, "skillsword", 50)
doSendMagicEffect(toPosition,30)
doRemoveItem(item.uid)
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return true
end

nothing happens my sword still the same
 
Oh yeah, I forgot to add in "movement.xml" with "onEquip" and "onDeEquip" ... thanks!

Hrsha, add in "movement.xml" with "onEquip" and "onDeEquip." like:
<!-- Sword -->
<movevent type="Equip" itemid="2376" slot="hand" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="2376" slot="hand" event="function" value="onDeEquipItem"/>


I'll also try to make it becomes automatic ...but this is really hard for me
 
Yes, there are only two things to make it automatic as far as I know, the first is the hardest and that is try to find a way to programmatically add "onEquip" and "onDeEquip" which is what I am trying right now, but it is not going too well. And the other one is to change it to "onThink" which will make it work without any editing to movement.xml but it will however open up the possibility of serious performance issues, especially with lots of players and it will require complete remake of the MOD.

But I will for now try to fix the "problem" by automatically add "onEquip" and "onDeEquip" but I will also looking to the whole "onThink" thing.

I have figured out the place in the code to put the "addEvent" thing BUT the problem is that large parts of the code in MoveEvent and BaseEvent is protected and can therefor not be reached at that place which either requires a new function on say the MoveEvent(s) class that is public or rewrite of the entire class (or parts of it). This will at least fix it so that "onEquip" and "onDeEquip" gets added when player is logging in if the item has an given attribute (possible answer is to add a new attribute called "movementevent") but to add it while players is online is yet another problem I have yet to solve.
 
Last edited:
although compiling has succeed , it still not working in game at all :S

i added item on movments but no difference

when i compile it i notice this message from Dev-c

Code:
41 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\item.cpp In file included from ../item.cpp 
30:9 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.h [Warning] no newline at end of file 

34 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\movement.cpp In file included from ../movement.cpp 
30:9 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.h [Warning] no newline at end of file 

18 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.cpp In file included from ../attributesmod.cpp 
30:9 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.h [Warning] no newline at end of file 
55:5 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.cpp [Warning] no newline at end of file
its all message i got from compiler , is there anything wrong ?
 
although compiling has succeed , it still not working in game at all :S

i added item on movments but no difference

when i compile it i notice this message from Dev-c

Code:
41 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\item.cpp In file included from ../item.cpp 
30:9 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.h [Warning] no newline at end of file 

34 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\movement.cpp In file included from ../movement.cpp 
30:9 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.h [Warning] no newline at end of file 

18 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.cpp In file included from ../attributesmod.cpp 
30:9 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.h [Warning] no newline at end of file 
55:5 C:\Documents and Settings\Lonly\Desktop\trunk.r3884\attributesmod.cpp [Warning] no newline at end of file
its all message i got from compiler , is there anything wrong ?

To fix that error you need to go the last character on the last line in both "attributesmod.h" and "attributesmod.cpp" and create a new line (hit enter). Can I see the lines you added into movement.xml?
 
Back
Top