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

Rare, Epic and Legendary Loot Rolls

Leo32

Getting back into it...
Joined
Sep 21, 2007
Messages
987
Solutions
14
Reaction score
532
Hey Guys,

This is something I've been working on for a while, taking the time to get it right and get all rolls and damages to apply properly.
Thought I'd give you a look, see what y'all think.

When a monster drops loot, there is a chance that it rolls Rare, Epic or Legendary:

iSCVyA6.png


BnmyChq.png


Basic rolls are broken down like so:

One-handed weapon:
+Attack, +Extra Defense, +%Critical Chance, *

Two-handed weapon:
+Attack, +Defense, +%Critical Chance, *

Wands and Rods:
+%Spell Damage

Shields:
+Defense, *

Armor/Legs/Boots/Helmet:
+Armor, *

Bows/Crossbows:
+Range, +Accuracy%, +%Critical Chance, *

* There are special Elemental Damage rolls that target thematically specific items:

Elemental Damage Rolls:
Lua:
-- Elemental Weapons
local fireweapons = {
    7386, -- Merc Sword
    2392, -- Fire Sword
    7430, -- Dragonbone Staff
    2432, -- Fire Axe
    8858, -- Elemental Bow
    7402, -- Dragonslayer Sword
    2414, -- Dragon Lance
    2520, -- Demon Shield
    7382  -- Demonrage Sword
}

local iceweapons = {
    7386, -- Merc Sword
    2445, -- Crystal Mace
    7428, -- Bonebreaker
    7407, -- Haunted Blade
    7437, -- Sapphire Hammer
    7387, -- Diamond Hammer
    7455, -- Mythril Axe
    21696,-- Icicle Bow
    21697,-- Runic Ice Shield
    8858, -- Elemental Bow
    2534  -- Vampire Shield
}

local energyweapons = {
    7386, -- Merc Sword
    7421, -- Onyx Flail
    8858, -- Elemental Bow
    7388, -- Vile Axe
    7404, -- Assassin Dagger
    2414, -- Dragon Lance
    2444, -- Hammer of Wrath
    7402, -- Dragonslayer Sword
    2514, -- Mastermind Shield
    7382  -- Demonrage Sword
}

sv7qQe0.png


HfgQG5d.gif


Some Two-handers can roll both elements:

y52LUoN.png


56C8xHU.gif


Rolling double elemental damage means you miss out on a +%Crit Chance roll, but you have a much higher minimum damage.
Also, when double elements are rolled, one of the elements is added onto your base damage (primaryDamage).

So if you get +%Crit Chance from another source, your elemental damage can now Crit:

GB83sXb.png


Your original damage is preserved regardless, so if you're hunting something that is immune to those elements, your regular physical damage is still applying as per normal:

mFC9UA0.gif


This works for both:
a Two-handed weapon with two elemental rolls.
a One-handed weapon + shield with an elemental roll on each.

Fire has moderate consistent damage and a 33% change to apply burning.
Ice has low consistent damage and a 20% chance to paralyze/slow the target for 3 seconds.
Energy has the highest possible damage, but always has 1 minimum damage so its inconsistent.

+%Spell Damage is self-explanatory:

UWB9kXh.png


Elemental Resistance Equipment and Crit Jewelry:
Lua:
-- Elemental Resistance Equipment
local fireresistance = {
    2516, -- Dragon Shield
    2520, -- Demon Shield
    2539, -- Phoenix Shield
    2519, -- Crown Shield
    2491, -- Crown Helmet
    2493, -- Demon Helmet
    13756,-- Mage's Cap
    2487, -- Crown Armor
    7899, -- Magma Coat
    8867, -- Dragon Robe
    11356,-- Zaoan Robe
    2488, -- Crown Legs
    7894, -- Magma Legs
    7891, -- Magma Boots
    2492, -- Dragon Scale Mail
    2498, -- Royal Helmet
    2655, -- Red Robe
    7900, -- Magma Monocle
    2133, -- Ruby Necklace
    2123 -- Ring of the Sky
}

local iceresistance = {
    3973, -- Tusk Shield
    7460, -- Norse Shield
    21697,-- Runic Ice Shield
    7461, -- Krimhorn Helmet
    7462, -- Ragnir Helmet
    7902, -- Glacier Mask
    7463, -- Mammoth Fur Cape
    7897, -- Glacier Robe
    8878, -- Crystalline Armor
    8887, -- Frozen Armor
    7896, -- Glacier Kilt
    21700,-- Icy Culotte
    7457, -- Fur Boots
    11117,-- Crystal Boots
    7892, -- Glacier Shoes
    7464, -- Mammoth Fur Shorts
    2125, -- Crystal Necklace
    2124  -- Crystal Ring
}

local energyresistance = {
    2514, -- Mastermind Shield
    2515, -- Guardian Shield
    2528, -- Tower Shield
    12644,-- Shield of Corruption
    2535, -- Castle Shield
    2475, -- Warrior Helmet
    2497, -- Crusader Helmet
    7901, -- Lightning Headband
    2472, -- Magic Plate Armor
    2476, -- Knight Helmet
    2492, -- Dragon Scale Mail
    7898, -- Lightning Robe
    8871, -- Focus Cape
    8879, -- Voltage Armor
    11355,-- Spellweaver's Robe
    12607,-- Elite Draken Mail
    2477, -- Knight Legs
    7895, -- Lightning Legs
    23539,-- Mino Shield
    2123, -- Ring of the Sky
    7893  -- Lightning Boots
}

local earthresistance = {
    2518, -- Beholder Shield
    2535, -- Castle Shield
    6131, -- Tortoise Shield
    15491,-- Carapace Shield
    20090,-- Spike Shield
    2540, -- Scarab Shield
    2479, -- Strange Helmet
    3971, -- Charmer's Tiara
    3972, -- Beholder Helmet
    7885, -- Terra Legs
    7903, -- Terra Hood
    2664, -- Wood Cape
    7463, -- Mammoth Fur Cape
    7884, -- Terra Mantle
    8869, -- Greenwood Coat
    8880, -- Swamplair Armor
    3982, -- Crocodile Boots
    2123, -- Ring of the Sky
    2135, -- Scarab Amulet
    7886  -- Terra Boots
}

local physicalresistance = {
    2514, -- Mastermind Shield
    2528, -- Tower Shield
    2535, -- Castle Shield
    2536, -- Medusa Shield
    12644,-- Shield of Corruption
    2532, -- Ancient Shield
    2497, -- Crusader Helmet
    3969, -- Horse Helmet
    5741, -- Skull Helmet
    2472, -- Magic Plate Armor
    2466, -- Golden Armor
    3968, -- Leopard Armor
    8889, -- Skullcracker Armor
    8891, -- Paladin Armor
    21692,-- Albino Plate
    2470, -- Golden Legs
    11304,-- Zaoan Legs
    2645, -- Steel Boots
    20109,-- Buckle
    2179, -- Gold Ring
    11302 -- Zaoan Helmet
}

local deathresistance = {
    2521, -- Dark Shield
    2529, -- Black Shield
    2532, -- Ancient Shield
    2536, -- Medusa Shield
    2462, -- Devil Helmet
    2490, -- Dark Helmet
    10016,-- Batwing Hat
    2489, -- Dark Helmet
    8889, -- Skullcracker Armor
    12607,-- Elite Draken Mail
    20109,-- Buckle
    5462, -- Pirate Boots
    2129, -- Wolf Tooth Chain
    21693,-- Horn
    11302 -- Zaoan Helmet
}

local critjewelry = {
    2136, -- Demonbone Amulet
    21693 -- Horn
}

Elemental protection is pretty straight forward, doesn't really need a disclaimer either:

qeCc9BE.png


The idea here is to enhance the grind mechanic, this game has always been about hunting and looting.
Very well rolled gear is both very powerful, and very valuable.

When you're low level, rolling +10 Attack on a Battle Hammer or Morning Star could be a god send.
Hell, even a simple Crit roll could make all the difference.

The system itself is all contained within loot dropping via LUA (with the appropriate rarity rolls applied as they drop);
And an OnHealthChange creatureevent that processes and adjusts damage/effects based on those rolls.

There's a few more things I want to add like Bleed rolls, an AOE roll, but the core mechanics are there.
I still need to think of quality mechanics I can add to Rod and Wand rolls, I'll add ManaLeech - but I'm looking for some fancier ideas.
Hopefully that's something you guys can help me come up with.
 
Last edited:
In my opinon, that bounch of green text looks bad, the properties would look better and more ''rpgish'' in some kind of window / gump

Nothing else is suitable.

Having a dedicated GUI that pops up or whatever is a shaky idea IMO, and it anchors you to OTC.
Too many cons for an unproven gain.

Keep in mind the Item ID/Action ID and Position stuff is only showing because I'm logged in as a God character.
Here is a more appropriate example:
QpJ2oQ0.png


Edit: You'll notice some of the screenshots say "an legendary", this is just due to me re-rolling to get rolls I want to take a screenshot of;
and getting an Epic roll at one point. Ignore it ;)
 
Last edited:
LonelyPracticalCygnet-max-1mb.gif


Seriously though I know what you're talking about, the likes of displaying items like WoW or Diablo or w/e
But thats some next level shit and locks you to a specific client.

I'm waiting for a webclient, have been for ages, have posted about it for ages.
Nothing I'm doing with my current OT will ever touch the client side until a web-based version comes out.

The roll system is similar to what already exists:

And mine aims to be a cleaner implementation.
 
Last edited:
Manaleech done, don't need to show example of that.

Multi-shot done too, here's an example:
1HnBV3D.gif


Edited, fixed up visuals for scenarios where you have a custom elemental damage roll + using same type of elemental arrow.
 
Last edited:
That looks sick as fuck, well done.

Thanks dude.

There are so many weird little technical hurdles when you're messing with damage numbers and effects on the fly - made this a nightmare but so satisfying to complete.

From;
  • Swapping around the damage Types for better visual clarity (Physical/main damage always on the left, elemental damage always on the right).
    This isn't as simple as you think (look at how a vanilla fire axe damage is displayed for example)
  • What happens when two elemental rolls? what happens when two elemental rolls AND an elemental arrow?
  • Calculating monster/custom character resistances on the fly so damage added and multi-shots don't bypass resistances/immunities
  • Re-calculating both vanilla and custom resistances on Players before applying any custom elemental roll damage.
  • getSpectators() is always listed from top-left to bottom-right, needs to be shuffled properly it so the targets for multi-shot are actually random.
  • creatureType:getImmunities() seems to be busted (concatenates into an unusable single int rather than returning a table)
Like sheesh I get why the noobies give up on this shit.
 
Thanks dude.

There are so many weird little technical hurdles when you're messing with damage numbers and effects on the fly - made this a nightmare but so satisfying to complete.

From;
  • Swapping around the damage Types for better visual clarity (Physical/main damage always on the left, elemental damage always on the right).
    This isn't as simple as you think (look at how a vanilla fire axe damage is displayed for example)
  • What happens when two elemental rolls? what happens when two elemental rolls AND an elemental arrow?
  • Calculating monster/custom character resistances on the fly so damage added and multi-shots don't bypass resistances/immunities
  • Re-calculating both vanilla and custom resistances before applying any custom elemental roll damage.
  • getSpectators() is always listed from bottom-left to bottom-right, needs to be shuffled properly it so the targets for multi-shot are actually random.
  • creatureType:getImmunities() seems to be busted (concatenates into an unusable single int rather than returning a table)
Like sheesh I get why the noobies give up on this shit.
If you use proper functions to deal damage, resistances and everything will be calculated for you.
 
If you use proper functions to deal damage, resistances and everything will be calculated for you.

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
end

The input damage:
primaryDamage, primaryType, secondaryDamage, secondaryType

Are already adjusted for resistances, so because I started down this route in using onHealthChange (started out as a simple crit system), I can either completely start for stratch and be doin some combat.cpp fuckery, or just keep on truckin and adjust the added damage using:
Lua:
monsterType:getElementList()

🤷

Something else I forgot to mention.
Time and Charge based items roll rarities as-well:

CM6ivFV.png


Things like SSA can only get +50 charges max
But Dragon Necklace and the like with 200 vanilla charges~ can get +1000
OsyXTdC.png
 
Last edited:
Thanks dude.

There are so many weird little technical hurdles when you're messing with damage numbers and effects on the fly - made this a nightmare but so satisfying to complete.

From;
  • Swapping around the damage Types for better visual clarity (Physical/main damage always on the left, elemental damage always on the right).
    This isn't as simple as you think (look at how a vanilla fire axe damage is displayed for example)
  • What happens when two elemental rolls? what happens when two elemental rolls AND an elemental arrow?
  • Calculating monster/custom character resistances on the fly so damage added and multi-shots don't bypass resistances/immunities
  • Re-calculating both vanilla and custom resistances on Players before applying any custom elemental roll damage.
  • getSpectators() is always listed from top-left to bottom-right, needs to be shuffled properly it so the targets for multi-shot are actually random.
  • creatureType:getImmunities() seems to be busted (concatenates into an unusable single int rather than returning a table)
Like sheesh I get why the noobies give up on this shit.
getImmunities is an int representing binary flags, you just have to extract the flag you're looking for. ex:
Lua:
if bit.band(creatureType:getImmunities(), COMBAT_FIREDAMAGE) == 1 then
    -- immune to fire damage
end
 
getImmunities is an int representing binary flags, you just have to extract the flag you're looking for. ex:
Lua:
if bit.band(creatureType:getImmunities(), COMBAT_FIREDAMAGE) == 1 then
    -- immune to fire damage
end

Whelp.
Well I'm off to make some changes and undo the 100% resistance lines I added to all my monster files 👍 🤡



Edit: There's like 0 forum posts on getCombatImmunities()
After applying this myself, it works a bit different to the code posted above.
Here is how you actually use it:
Lua:
if bit.band(creature:getType():getCombatImmunities(), COMBAT_FIREDAMAGE) == COMBAT_FIREDAMAGE then
    -- immune to fire damage
end

It doesn't actually return 1 if the monster is immune, it returns the COMBAT_XXXXDAMAGE int back at you.
Hopefully this helps any stragglers who stumble here googling the function.
 
Last edited:
Manaleech done, don't need to show example of that.

Multi-shot done too, here's an example:
1HnBV3D.gif


Edited, fixed up visuals for scenarios where you have a custom elemental damage roll + using same type of elemental arrow.
I think you have a good imagination friend ;)
 
Manaleech done, don't need to show example of that.

Multi-shot done too, here's an example:
1HnBV3D.gif


Edited, fixed up visuals for scenarios where you have a custom elemental damage roll + using same type of elemental arrow.
runaan’s hurricane 😲 cool
 
any 0.4 code? like this

Search for "item upgrade", "slot system" or the like and find one thats 0.4 compatible.
Closest you'll get.
Here are the literal threads/posts I used as a base for all the custom item mods in my project:
I started with those two ideas/scripts, and just customized it until I had what I have now.
My system has some source edits:
  • Remove loot dropping from creatures (so rarity information is included in the loot broadcast message).
  • New onSpawn creatureevent - used to register both "loot via LUA" and "onHealthChange combat modifications" on monsters as they spawn.
This makes it a little fiddly to recommend or release to others at the moment.
 
Last edited:
Stun on wands is done:
chance to apply on wand hits & spells/rune hits.

K9gacJG.gif


Might speed up the animation intervals to make the stun effect more clear, but you get the jist of it.
Last piece for wands will be mana-drain protection I think:

H2NYLpN.png
 
Last edited:
Back
Top