So I have been trying to make so that every item that is created can have a random armor,attack,... value. What I tried with was to do that when you read the attributes from the xml file it become random:
else if(tmpStrValue == "armor")
{
if(readXMLInteger(itemAttributesNode, "random_min", intMinValue))
if(readXMLInteger(itemAttributesNode, "random_max", intMaxValue))
if(intMaxValue > intMinValue)
it.armor = intMinValue + rand() % (intMaxValue - intMinValue);
if(readXMLInteger(itemAttributesNode, "value", intValue))
it.armor = intValue;
}
But I noticed that this will only be random 1 time the problem with that is that the ItemType only get random. So lets say I made a leather armor with armor 1-10. So lets say the random value was 3 then all armors would have 3 in armor. And if I restart the server it might be 8 or something and all armors would have 8 in armor.
I would like to have so that all leather armors would have have diffrent and random value each time. Anyone could help me?
else if(tmpStrValue == "armor")
{
if(readXMLInteger(itemAttributesNode, "random_min", intMinValue))
if(readXMLInteger(itemAttributesNode, "random_max", intMaxValue))
if(intMaxValue > intMinValue)
it.armor = intMinValue + rand() % (intMaxValue - intMinValue);
if(readXMLInteger(itemAttributesNode, "value", intValue))
it.armor = intValue;
}
But I noticed that this will only be random 1 time the problem with that is that the ItemType only get random. So lets say I made a leather armor with armor 1-10. So lets say the random value was 3 then all armors would have 3 in armor. And if I restart the server it might be 8 or something and all armors would have 8 in armor.
I would like to have so that all leather armors would have have diffrent and random value each time. Anyone could help me?