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

Item Drop List

Status
Not open for further replies.

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
Hello Hive users, i´ve got a question here about drop list, you can set a item drop list for when an unit dies it has a chance to drop one of these items, an example it has 50% chance it drop a ring and 50% chance it drops an exp tome, is there a way to make a new unit out of triggers (created in game, not in world edit) that has that same item drop list?
 
Level 13
Joined
Nov 4, 2006
Messages
1,239
  • Events
    • Unit - a Unit dies
  • Conditions
    • unit-type of dying Unit equal to your unit-type
    • dying Unit equal to your Unit (choose the one of those two which fits your needs)
  • Actions
    • set randomnumber = random number between 1 and 2
    • if randomnumber = 1 then create item 1 at position of dying unit, else create item 2 at postion of dyin Unit
randomnumber is an integervariable
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
this helps me a bit more but still is not what i am looking for, what about if i want a different chance like 40% and 60%?
 
Level 9
Joined
Apr 3, 2008
Messages
700
You can set any chance withrandom number.
Furthermore, item drop list don't allow you to set not integer chances (like 1.5%), but with random number you can do it.

set r = random number between 1 and 10
if r<=4 then
elseif r>=5 then
endif
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
You can set any chance withrandom number.
Furthermore, item drop list don't allow you to set not integer chances (like 1.5%), but with random number you can do it.

set r = random number between 1 and 10
if r<=4 then
elseif r>=5 then
endif

it´s getting closer to what i want, what if like there are more than just two items, like an item 10% another one 25% and other one 45% and last 20%
 
Level 12
Joined
Mar 26, 2005
Messages
790
set randomnumber=random number between 1 and 100

If randomnumber=less or equal to 10
then blabla

Else-If randomnumber=less or equal to 25
then blabla

Else-If randomnumber=less or equal to 45
then blabla

Else blabla
 
Level 13
Joined
May 11, 2008
Messages
1,198
there is a tutorial on a item drop list which works for all neutral hostile units...
you can of course edit the event to something else like a specific unit type for example or a unit matching condition. like in my map i think i made it so that sappers drop items.

anyway in that you can add the items to the item pool, and when you do that there is a number to the right of the item id which is the chance.

it is out of the total chance which is the total of all the numbers' chances in the item pool. so if all the numbers in the item pool, the chances add up to 100, then you will get a percentage for each item according to what that number is. pretty easy. the difficult part is editing the items and the event. as for the event i make an event in gui and turn the trigger to custom text and copy that event to the trigger. as for the items you need to turn on display raw data in the object editor to the get the item id strings.

http://www.hiveworkshop.com/forums/f280/itempools-guide-35180/

edit: i guess you could do it for preplaced units too. you have to go make a gui trigger probably and (generated global) select the unit that is preplaced to be the unit that dies and then convert the trigger to custom text like i did with the unit type and copy that event over to the item pool trigger.
 
Level 4
Joined
Sep 2, 2006
Messages
99
  • LootTable
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Set RandomNumber = (Random integer number between 1 and 20)
      • For each (Integer RandomNumber) from 1 to 10, do (Actions)
        • Loop - Actions
          • Item - Create Claws of Attack +15 at (Position of (Triggering unit))
      • For each (Integer RandomNumber) from 11 to 20, do (Actions)
        • Loop - Actions
          • Item - Create Orb of Fire at (Position of (Triggering unit))
 
Level 13
Joined
May 11, 2008
Messages
1,198
well...you want to make a unit in triggers to be added to the event of your drop list.

you may want to make a trigger somehow out of these...and make a add event action being last created unit or whatever dies...

assuming the trigger that created the unit was created...if it was replacing a unit for example you would use last replaced unit dies. even though the trigger making the item says last created unit/trained unit/last replaced unit in it's event and there are other units replacing and training and creating it's only the unit that got added to the event that was the last at that time that it happens to. which is a good thing to know! i learned that from looking at the enfos map.

P.S. i'm not sure if you can use gui action trigger add event to trigger if the trigger you're adding the event to is in custom text...
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
set randomnumber=random number between 1 and 100

If randomnumber=less or equal to 10
then blabla

Else-If randomnumber=less or equal to 25
then blabla

Else-If randomnumber=less or equal to 45
then blabla

Else blabla

burrnnn this will leak like %$/! cause if randomnumer =less or equal to 10 all options will be avaliable
 
Level 9
Joined
Apr 3, 2008
Messages
700
Restor's trigger don't leak.
Dragoon_Jett's trigger leaks location.

To prevent leak you can just use "Hero - create item for hero"

leak cause if randomnumer =less or equal to 10 all options will be avaliable
No. It just means that if r<=10 all items has a chance to be dropped from one unit.

You know the functions you need to make a trigger like this so you can set any chances of drop. Isn't the problem solved?
 
Level 1
Joined
Jan 2, 2009
Messages
6
.Actions:
.For each (integrer A) from 1 to 3 do:
....For each (integrer B) from 4 to 6 do:
......If/then/Else:
........If:
...........Random number between 1 and 10 equal to (Integrer A)
.........Then:
...........Create (Your Item) at position of (dying unit)
...........Skip Remaining Actions
.........Else:
......If/then/Else:
.........If:
...........Random number between 1 and 10 equal to (Integrer B)
.........Then:
...........Create (Your Item 2) at position of (dying unit)
.........Else:
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
  • LootTable
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Set RandomNumber = (Random integer number between 1 and 20)
      • For each (Integer RandomNumber) from 1 to 10, do (Actions)
        • Loop - Actions
          • Item - Create Claws of Attack +15 at (Position of (Triggering unit))
      • For each (Integer RandomNumber) from 11 to 20, do (Actions)
        • Loop - Actions
          • Item - Create Orb of Fire at (Position of (Triggering unit))

hey dude, look at what happened when i did that.

x22a9t.jpg


24qmg6u.jpg



jqtldi.jpg


so what did i do wrong?
 
Level 9
Joined
Oct 24, 2007
Messages
421
This is the trigger from my upcoming diablo 2 map I use for every type of item drop, it doesn't remove leaks but that wouldn't be hard to do, just add destroy scripts after each used variable and point.

The one I've placed in here doesn't always drop an item, but it could be made so if the limits of the integer are changed...
 

Attachments

  • itemdrops.JPG
    itemdrops.JPG
    60.3 KB · Views: 123
Level 9
Joined
Apr 3, 2008
Messages
700
Ham said:
hey dude, look at what happened when i did that.
Omg. You don't need loop.
Dragoon_Jett's trigger is false.
It creates the number of items equal to randim number.
You need just a condition that will check the value of random number.

Need_O2 said:
Best System Ever
I've looked it.
It's really good non-leaking system that sets item tables to unit-types,
but I don't think that he knows Jass...
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
meh you just copy the code and run a simple custom script
I dont remember the script but it was like Blabla(<unit id>,<item id>,<chance>) so no jass knowladge required
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
meh you just copy the code and run a simple custom script
I dont remember the script but it was like Blabla(<unit id>,<item id>,<chance>) so no jass knowladge required

somehow it needs more than this simple custom script, i already tried but it needs a custom scrip code (the one u place at the top where is the map icon) it kinda confuse me, cause there is more than just a script, there are three, idk how to work it well, could u help me there?

EDIT1:
This is the trigger from my upcoming diablo 2 map I use for every type of item drop, it doesn't remove leaks but that wouldn't be hard to do, just add destroy scripts after each used variable and point.

The one I've placed in here doesn't always drop an item, but it could be made so if the limits of the integer are changed...

hey i think the trigger u have made have equal % for each item, like if there are 5 items them all have 20% chances to drop

EDIT2:
there is a tutorial on a item drop list which works for all neutral hostile units...
you can of course edit the event to something else like a specific unit type for example or a unit matching condition. like in my map i think i made it so that sappers drop items.

anyway in that you can add the items to the item pool, and when you do that there is a number to the right of the item id which is the chance.

it is out of the total chance which is the total of all the numbers' chances in the item pool. so if all the numbers in the item pool, the chances add up to 100, then you will get a percentage for each item according to what that number is. pretty easy. the difficult part is editing the items and the event. as for the event i make an event in gui and turn the trigger to custom text and copy that event to the trigger. as for the items you need to turn on display raw data in the object editor to the get the item id strings.

http://www.hiveworkshop.com/forums/f280/itempools-guide-35180/

edit: i guess you could do it for preplaced units too. you have to go make a gui trigger probably and (generated global) select the unit that is preplaced to be the unit that dies and then convert the trigger to custom text like i did with the unit type and copy that event over to the item pool trigger.

i apretiate it sankaku but i am not using jass code it'd mess my whole gui triggers and then i need to go all jass. i preffer to do it with triggers i am sure there must be a way to

EDIT3:
Restor's trigger don't leak.
Dragoon_Jett's trigger leaks location.

To prevent leak you can just use "Hero - create item for hero"


No. It just means that if r<=10 all items has a chance to be dropped from one unit.

You know the functions you need to make a trigger like this so you can set any chances of drop. Isn't the problem solved?

i don't want it to drop all items, i just want to drop just one
 
Last edited by a moderator:

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
Omg. You don't need loop.
Dragoon_Jett's trigger is false.
It creates the number of items equal to randim number.
You need just a condition that will check the value of random number.


I've looked it.
It's really good non-leaking system that sets item tables to unit-types,
but I don't think that he knows Jass...

what condition would it be?

EDIT:
Nice, tripple post =)
If you wanna to drop 1 item, use the way I suggested.

is it wrong? i just thought this way was easier for them to check their answers.. and which way u suggested? the one O2 did? or ?
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Just on unit death, get a random item from the item group you created. Afterall, all those item drops are done in JASS anyway, so you simply need to make a generic unit death trigger that checks unit types and runs pretty much the same code as the noramal single unit death triggers.

This should be far more efficent than any such multiple selection ideas as is is pretty much 1 function call as apposed to multiple comparisions and variable setting.
You can also clean up the item table objects when they are no longer needed.
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
Just on unit death, get a random item from the item group you created. Afterall, all those item drops are done in JASS anyway, so you simply need to make a generic unit death trigger that checks unit types and runs pretty much the same code as the noramal single unit death triggers.

This should be far more efficent than any such multiple selection ideas as is is pretty much 1 function call as apposed to multiple comparisions and variable setting.
You can also clean up the item table objects when they are no longer needed.

yeah it would be cool, would you give me an explample? it would take me weeks to make it myself
 
Last edited:
Status
Not open for further replies.
Top