• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Item Drop/Loot System

Status
Not open for further replies.
Level 9
Joined
Jun 4, 2007
Messages
205
Hello, I've been trying to make ways of creating an item drop table with % chances, I searched the Spells Section for a system but the only ones I found didn't match what i needed or were in vJass (wich i have little to no clue to implement on my map).

So what I wanted to ask is if anyone can please link me to a system or teach me how to do a item drop without repeating "if" actions (a real system), here are some of the details:

- Every creep may drop different items but according to its level (my map will use level req items), ex: a lvl 5 troll may drop lvl 1-5 items, but a lvl 40 ogre will only drop lvl 30-40 items(no low level items on high level monsters)
-There must be a chance for the item type to drop, like 11% for a normal item type, 3% for a magic item type and 1% for a unique item type, for a total chance of 15% drop per kill

It's much like the diablo 2 way of dropping items, there is a chance and part of this chance is a magic/rare item, and the items become stronger depending on the monsters.

Thankss
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
an easy way to make a chance system is like this

JASS:
function chance takes nothing returns nothing
    local integer i = GetRandomInt( 1, 100)
    if i < 16 then 
        call CreateItem( items[i], unitX, unitY )
    endif
endfunction

function setItems takes nothing returns nothing
    // this is item table 1
    set items[1] = //rare item
    set items[2] = //magic item
    set items[3] = //magic item
    set items[4] = //magic item
    set items[5] = //normal item
    set items[6] = //normal item
    set items[7] = //normal item
    set items[8] = //normal item
    set items[9] = //normal item
    set items[10] = //normal item
    set items[11] = //normal item
    set items[12] = //normal item
    set items[13] = //normal item
    set items[14] = //normal item
    set items[15] = //normal item
endfunction

heres the equivalent in gui without setting the items in an array

  • Actions
    • Set i = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • i Less than 16
      • Then - Actions
        • Item - Create items[i] at (Position of (Triggering unit))
      • Else - Actions
now make an item arrays w normal rare and magic items in them. then were i have the comments just pick a random integer and drop the item that corresponds to tht item in the item array
 
Last edited:
Status
Not open for further replies.
Top