Braindead's Mordor Site

Personal tools

Item Generation Formula

From Braindead's Mordor Site

(Difference between revisions)
Jump to: navigation, search
Line 16: Line 16:
%Chance for subsequent item spawns = Int(MIC/10)
%Chance for subsequent item spawns = Int(MIC/10)
-
So, in theory, you should be able to find a chest with "infinity" items in it ^^
+
So, in theory, you should be able to find a chest with infinite items in it ^^
[http://mordor.uni.cc/forum/Chests_Item_Generation-t1336.html Discuss this topic in the forum]
[http://mordor.uni.cc/forum/Chests_Item_Generation-t1336.html Discuss this topic in the forum]

Revision as of 23:12, 25 March 2006

Looked through the Chest Code, this was a tough one, but I think I got it.

  1. Get MonsterItemChance (or MIC), it's the "U25" Value in Wabbit's Editor
  2. Pick a Random Number [1 to 100]
  3. Apply Chest Modifier to Random Number
    Chest: -25, Box: Unchanged, Container: +15
  4. Add LN("Floor" + 10)*5 to Random Number if chest wasn't Magically Locked
    Effect: Magically Locked = Higher chance of items.
  5. If Modified Random Number is greater than 90 and %MIC isn't 100, then set Random Number to 90.
    This should result in some chests always giving items, ie. chests from Pseudo-Dragons, Lamurian High Priestess, Minotaurs etc
  6. If Modified Random Number is smaller or equal to MIC, item is spawned.
  7. Get Item Level Ranges.
    Maximum: "Item Drop Level" value in Wabbit's Editor
    Minimum: Int(Maximum / 2), always at least 1.
  8. Apply Chest Modifier to Item Level Ranges.
    Chest: +1 Minimum, Box: Unchanged, Container: -1 Minimum and Maximum.
    Note: Asmodeus Chests always have 14 Minimum and 16 Maximum, regardless of Chest Type.
  9. Get Item Category, 1 random value from the 10 values below "Item Drop Level" in Wabbit's Editor.
    If value is -1, pick a random Item Category.
    Values below -1 in a Category indicate a specific item, and will always be spawned if that Category is chosen.
  10. Generate Item List.
    This one requires a bit of explanation.
    Game will loop through all Item IDs until it finds an Item ID matching both Minimum Item Level Range and Category.
    It will then continue until it finds an Item ID not matching both Maximum Item Level Range and Category. All items between first ID and [second ID - 1] are put in this list. This causes some items, ie. Vorpal Blade, Lamurian Crown etc, to never be spawned unless explicitly instructed to. Unfortunately, it also makes adding items through modding a bit meh. New items will always have IDs outside the "generic" ranges, so they'll never spawn unless you instruct monsters to spawn them or restructure the entire Itemdata File.
  11. Assign Spawn Chance to each Item in List
    Divide the "Chance" value in Wabbit's Editor by the sum of all "Chance" values in the Item List, multiply by 100.
    It works similar to the TC System in Diablo 2, for those who have messed around with that.
  12. Pick a Random Number [0 to 99.9999...], floating-point
  13. Determine which Item is spawned
    If Random Number is equal or lesser than the first Item's chance, spawn that Item.
    Otherwise add chance of next Item in list to the previous chance, and recheck if Random Number is equal or lesser.
    Continue doing this until an Item is spawned.
%Chance for subsequent item spawns = Int(MIC/10)

So, in theory, you should be able to find a chest with infinite items in it ^^

Discuss this topic in the forum

Disclaimers 
Copyrights And Credits