• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Need Help With Item Drop System...

Status
Not open for further replies.
Level 4
Joined
Jan 14, 2005
Messages
73
So ORPG Map. I basically Want creatures to drop Items Based off thier level (Creatures Level)

So if the Creep is level 1 then I want it too randomly Drop a level 1 Item. Now I have 3 Tier sets of items, Common/Magic/Unique I have a trigger that Randomly Drops a Common/Magic/Unique (using an Ok rarity System (Im not sure of the Exact % chances to drop Items but its Pretty Rare something around 1% for a common .1% for Magic .01% for unique + 1% per Monster Level).

However I am just now Realizing that I Need to make it so the Items dropped are not Totally Overpowered For the Creature Dropping it.

So lets say you kill a level 1 wolf, The Wolf Drops a Common Super Over Powered Item that was Intended to drop from a level 50 Creature.

Im just not sure How to Get an Items level From the Item-Type. Or any other solution to my problem.

I dont care how much work it is too setup as long as its Not Laggy, And it works :p

heres My Drop Trigger (It already Gets Creep Level)

  • Creep Item Drop
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
    • Actions
      • Set RandomNumberItemDrop = (Random integer number between 1 and 100)
        • Do Multiple ActionsFor each (Integer A) from 1 to (eou_NumberOfCreepTypes x 4), do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of (Triggering unit)) Equal to (==) Creature_UnitTypes[(Integer A)]
              • Then - Actions
                • Set RandomNumberItemDrop = (Integer_CreatureMagicFind[(Integer A)] + RandomNumberItemDrop)
                • Set Integer_ItemMaxLevelDrop = (Integer A)
              • Else - Actions
      • Set Temp_Point = (Position of (Triggering unit))
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomNumberItemDrop Greater than or equal to (>=) 100
          • Then - Actions
            • Set RandomNumberItemDrop = (RandomNumberItemDrop + (Random integer number between 1 and 100))
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomNumberItemDrop Greater than or equal to (>=) 200
                • Then - Actions
                  • Set RandomNumberItemDrop = (RandomNumberItemDrop + (Random integer number between 1 and 100))
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • RandomNumberItemDrop Greater than or equal to (>=) 300
                      • Then - Actions
                        • -------- Drop Unique Item --------
                        • Item - Create ItemDrop_Unique[(Random integer number between 1 and eou_ItemDropUniqueArraySize)] at Temp_Point
                      • Else - Actions
                        • -------- Drop Magic Item --------
                        • Item - Create ItemDrop_Magic[(Random integer number between 1 and eou_ItemDropMagicArraySize)] at Temp_Point
                • Else - Actions
                  • -------- Drop Common Item --------
                  • Item - Create ItemDrop_Common[(Random integer number between 1 and eou_ItemDropCommonArraySize)] at Temp_Point
          • Else - Actions
      • Custom script: call RemoveLocation(udg_Temp_Point)
And Heres My Setup for Item Variables
Theres 3 of these one for Common,Magic, and Unique.
  • Set Variables Containing Common Items
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set ItemDrop_Common[1] = Wooden Stick
      • Set ItemDrop_Common[2] = Wooden Stick
      • Set ItemDrop_Common[3] = Wooden Shield
      • Set ItemDrop_Common[4] = Axe
 
Level 8
Joined
Sep 23, 2007
Messages
357
Condition - Integer Comparison
Unit - Level of Dying Unit =

If you want to further improve this system, you can give certain boss units or special units certain classifications or maybe put them in certain unit groups so that they drop certain items depending not only on their level but on the type of creep they are
 
Level 4
Joined
Jan 14, 2005
Messages
73
Thank you but its not exactly whT i need. I can already get creature level. What i need is some way of organizing my items that are going to drop so that i can easily pick a random item up to 5 levels below the creature. I would prefer to integrate it into the trigger i already have. I have no idea how to get the items level without creating the item first. Thank you for any help.

Seriously anyone have any other ideas?

PS: Slightly Better Way to describe What I was attempting to do.

If you look at the trigger I posted above. Where it creates the Item I want an IF/THEN/ELSE statement, This statement Needs to check if the
"Item Level is < Creature Level & Item Level > Creature Level - 5" I already Can Obtain The Creature Level What I need Is to Obtain the Item Level. The Problem is I dont want to have to continually Generate a random Number Until It gets one Low Enough To spawn a random Item with a level of Creature to Level of Creature - 5

I do not know how I need to go about Storing The items Inside a Variable? One for each level Would Be quite a hassle, If I could spawn a random Item Higher Then level 8 It would be Nice as well. But the GUI trigger Says MAX Level 8 When using "Create Random Item". Also If I use the Create Random Item then, I believe it would be ALOT harder to deal with My "Common/Magic/Unique" Item System.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
I would propably use item pools, but those require JASS.

JASS:
function Setup takes nothing returns nothing
    local itempool ip = CreateItemPool()
    set udg_hash = InitHashtable()
    
    call ItemPoolAddItemType(ip, 'ratc', 1)
    call ItemPoolAddItemType(ip, 'bspd', 4)
    call SaveItemPoolHandle(udg_hash, 'hfoo', 0, ip)
    
    set ip = CreateItemPool()
    
    call ItemPoolAddItemType(ip, 'ratc', 3)
    call ItemPoolAddItemType(ip, 'bspd', 2)
    call SaveItemPoolHandle(udg_hash, 'hkni', 0, ip)
    
    set ip = null
endfunction

function Die takes nothing returns nothing
    local unit u
    if GetRandomInt(1, 4) == 4 then
        set u = GetTriggerUnit()
        call PlaceRandomItem(LoadItemPoolHandle(udg_hash, GetUnitTypeId(u), 0), GetUnitX(u), GetUnitY(u))
        set u = null
    endif
endfunction

I'm using object raw codes here. Ctrl + D in object editor to view them.

ratc = raw code of Claws of Attack +12
bspd = raw code of Boots of Speed
hfoo = footman
hkni = knight

I'm creating item pools for each unit type. Each added item type is given spesific weight. Ratc has weight of 1 and bspd 4 for the footman. So Ratc has 1 in 5 change to drop, bspd 4/5.

The Die functions shows how to create random item, the chance of creating being 1/4.
 
Level 4
Joined
Jan 14, 2005
Messages
73
Thanks Maker Ive never Used Jass But I SHALL ATTEMPT :D... Im sure Il figure it out soon since it seems fairly straight forward. Again Thanks Alot :)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
i used gui then converted to jass, this just a ideea
1st of all for this need ItemLv integer array for store the level requiment for items, and ItemType array (obviously item type array :D) for store every dropable item what i also use in different place, like equipments

if ( ( GetRandomInt(1, 100) < (1 + udg_Difficulty * 5) ) ) then
drop rate depend on difficulty and in normal rate 5% chance for creep or player 11 drop a item
if (GetRandomInt(1, 100) < 76 ) then
if droping item then 75% chance for droping any item (i dont replaced yet but i will do potion drop)
droping equipment if dont drop potion
(in my map 100-109 the normal heavy armor,110-149 the rare heavy armor, 150-159 normal light armor, 160-199 the rare armors etc,
each item got unique item level (dont have 2 equipment type with same item level) and i declared the item level requiment in map init like 1st heavy armor(1st heavy armor is lv100 item) need lv 5 then ItemLv[100]=5)

if mob was the dying unit then i create normal item (find until item level is +-10 compared with dying unit level and item isnt rare item[so drop only 100-109,150-159.... items])
if dying unit is hero then he could drop rare item too (like 100-149,150-199.... items)

(in my case the equipments item levels are between 100 and 1100 but i dont want drop items between 550-559 this is why there a if)

i use item rot system this is why i set the item custom value, else u dont need this
call SetItemUserData( GetLastCreatedItem(), (120 + k) )

JASS:
//TESH.scrollpos=24
//TESH.alwaysfold=0

function itemcheck takes nothing returns boolean
    if ( not ( udg_TempNr > 549 ) ) then
        return false
    endif
    if ( not ( udg_TempNr < 600 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Respawn_Actions takes nothing returns nothing
    local unit du
    local integer dutype
    local player duplayer
    local location duloc
    local integer ulv
    local boolean h
    local integer outit
    local integer k = GetConvertedPlayerId(GetOwningPlayer(GetKillingUnit()))

    set outit = 0
    set du=GetDyingUnit()
    set dutype=GetUnitTypeId(du)
    set duplayer=GetOwningPlayer(du)
    set duloc=GetUnitLoc(du)
    if ( IsUnitType(du, UNIT_TYPE_HERO) == true ) then
               set ulv = GetHeroLevel(du)
               set h = true
               else
               set ulv = GetUnitLevel(du)
               set h = false
    endif
    
    if ( ( GetRandomInt(1, 100) < (1 + udg_Difficulty * 5) ) ) then
        if (GetRandomInt(1, 100) < 75 ) then
        call CreateItemLoc( ChooseRandomItemBJ(-1), udg_Point )
        else
    loop
        exitwhen outit > 0
           set udg_TempNr = GetRandomInt(100, 1000)
          if ( itemcheck() ) then
          else
          if ( udg_Item_Lv[udg_TempNr] - 10 < ulv ) then
          if ( udg_Item_Lv[udg_TempNr] + 10 > ulv ) then
          if ( udg_Item_Lv[udg_TempNr] != 0 ) then
          if (h == true) then
             set outit = udg_TempNr
          else
          if (ModuloInteger(udg_TempNr, 25) < 10) then
            set outit = udg_TempNr
          endif
          endif
          endif
          endif
          endif
          endif
    endloop
        call CreateItemLoc( udg_Item_Type[outit], duloc )
        call SetItemUserData( GetLastCreatedItem(), (120 + k) )
        endif
    endif
    call RemoveLocation(udg_TempPoint)
    call PolledWait( GetRandomReal(25.00, 55.00) )
    call CreateNUnitsAtLoc(1,dutype,duplayer,duloc,45)
    if ( h == true ) then
     call SetHeroLevelBJ( GetLastCreatedUnit(), ulv, false )
    endif
endfunction

//===========================================================================
function InitTrig_Respawn takes nothing returns nothing
    set gg_trg_Respawn = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Respawn, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Respawn, Player(10), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Respawn, function Trig_Respawn_Actions )
endfunction
 
Status
Not open for further replies.
Top