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

Add % Damage

Roa Supporter

New Member
Joined
Apr 21, 2009
Messages
26
Reaction score
0
Hey I know its possible to make a script that adds % dmg could anyone make 1?

For example: a shield that when u put it on adds 100% magic dmg


REP ++++
 
@ Up
Spammer ? -.-"

@ Topic

PHP:
<attribute key="increaseMagicPercent" value="10"/>

<attribute key="increaseMagicPercent" value="%"/>

example:
<item id="2656" article="a" name="blue robe">
<attribute key="description" value="It is a magic robe."/>
<attribute key="weight" value="2200"/>
<attribute key="armor" value="11"/>
<attribute key="slotType" value="body"/>
<attribute key="increaseMagicPercent" value="10"/>

If you put on Blue Robe, you have 10% more magicpercent dmg!
It works in tibia: 8.10 and above!
 
Warning!
If up post dont work (if you dont have this function in your OT) just add it in C++ :

1) In the function Combat::doCombat(Creature* caster, const Position& pos) after:
PHP:
getMinMaxValues(caster, minChange, maxChange);

add:
PHP:
		if(Player* player = caster->getPlayer()){
			int32_t newMinChange = minChange;
			int32_t newMaxChange = maxChange;
 
			for(int i = SLOT_FIRST; i < SLOT_LAST; i++){
				Item* item = NULL;
				if(player->inventory[i]){
					item = player->inventory[i];
					int increaseMagicPercent = Item::items[item->getID()].increaseMagicPercent;
 
					if(item && item->getSlotPosition() << i && increaseMagicPercent != 0){
						minChange += (newMinChange * increaseMagicPercent)/100;
						maxChange += (newMaxChange * increaseMagicPercent)/100;
					}
				}
			}
		}

2) In the function ItemType::ItemType() after:
PHP:
breakChance   = 0;

add:
PHP:
	increaseMagicPercent = 0;

3) Now declare the variable in items.h after:
PHP:
uint32_t breakChance;

add:
PHP:
	int increaseMagicPercent;

4) And in the last function
Items::loadFromXml(const std::string& datadir) after:
PHP:
							else if(strcasecmp(strValue.c_str(), "decayTo") == 0){
								if(readXMLInteger(itemAttributesNode, "value", intValue)){
									it.decayTo = intValue;
								}
							}

add:
PHP:
							else if(strcasecmp(strValue.c_str(), "increaseMagicPercent") == 0){
								if(readXMLInteger(itemAttributesNode, "value", intValue)){
									it.increaseMagicPercent = intValue;
								}
							}
 
Wow thx it worked for me
REP ++

@Exedion: Add a movement

i can't compile this option xD

in tfs 0.3.6 are these options :)

Code:
1070 	 else if(tmpStrValue == "increasemagicvalue")
1071 	{
1072 	if(readXMLInteger(itemAttributesNode, "value", intValue))
1073 	it.abilities.increment[MAGIC_VALUE] = intValue;
1074 	}
1075 	else if(tmpStrValue == "increasemagicpercent")
1076 	{
1077 	if(readXMLInteger(itemAttributesNode, "value", intValue))
1078 	it.abilities.increment[MAGIC_PERCENT] = intValue;
1079 	}
 
i cant get it to work.
../player.h: In member function 'void Combat::doCombat(Creature*, const Position&) const':
../player.h:877: error: 'Item* Player::inventory [11]' is private
../combat.cpp:816: error: within this context
../player.h:877: error: 'Item* Player::inventory [11]' is private

../combat.cpp:817: error: within this context

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

Execution terminated
t
 
Back
Top