Itempools via triggers (GUI/JASS)?

mylemonblue

You can change this now in User CP.
Reaction score
7
I'm trying to find some way to add "loot lists" to my map I am making that is more sophisticated than a simple
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to (==) Neutral Hostile
    • Actions
      • If ((Random integer number between 1 and 10) Less than or equal to (<=) 3) then do (Item - Create Tome of Experience at (Center of (Playable map area))) else do (Do nothing)

sort of system, and so I did some searches on Wc3C.net and here at TheHelper, and the best I found was Rising_Dusk's Pool system
http://www.wc3c.net/showthread.php?t=108369

I copied it into my map and I get 14 compile errors
Undefined type hashtable, Bad types for binary operator, Cannot convert null to integer, etc.

I have the latest JAssHelper and patch 1.23 and it gives me the compile errors. I figure it must require 1.24 and I do not want to upgrade to a version that will break the maps I play (Most of which are protected :( ), so is there any other way I can make a system of my own? It doesn't have to be a dynamic and wonderous system with hundreds of thousands of customizable goodness, but I don't want it to be something lame and predictable either (Which is basically the best I can do on my own :( )
Any thoughts?
 

jig7c

Stop reading me...-statement
Reaction score
123
i believe hashtables are an addon to 1.24 upgrade...

if you can define more in detail what a loot-list consist of, maybe one of us can make it for you..
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Blarg! I was hoping that the 1.24 patch would not be involved D:

Moar detail... Humm, let me see...

Alright. When killing a unit, it should have a certain chance to draw from a table (In JASS it was Itempools, in the WE it's something like Item Tables, when you double click on a unit and open the Items Dropped tab.. Loot Lists are basically a synomonous word for Itempools in online RPGs), if an item does drop, it will loop through all the possible drops in a given table for that unit/unit group - with unit specific tables geared for bosses/rare spawns/whatever, and unit group tables for general purpose drops - and calculate the chance for that item to drop.

Umm, that confused me though I am the one typing it o_O
Like, Helm of Kings has a value of... 2, so it has a very low chance of dropping, while Clarity Potion has a value of 40, so it is more likely to get picked, but still has a good chance of not getting picked when looping through the possible drops. It would be entirely possible for an item with a value of 40 and an item with a value of 5 to drop at the same time, so it is not an If/Then/Else type of scenario, but two items sharing the same raw code should not be able to drop simutaneously (I do not know if they can, anyway...)
 

jig7c

Stop reading me...-statement
Reaction score
123
you can setup item tables whilst you're in the editor...

it gives an even chances to all items

chance of an item being dropped = total items/# number of items

if you want more of the same items to be dropped, just add more of the same item in the item table...
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Do you mean Custom/Defined Drop Tables like the kind found in melee maps? That won't work for me, because I have a creep revival system in place (It's an rpg map) and those lists don't transfer over to the newly created unit. Thus me asking about making my own that can be drawn from when a unit dies in general =/
 

jig7c

Stop reading me...-statement
Reaction score
123
you could save each item into an item variable at map init.

and then when a unit dies
(random number between 1 and 100 equal or less than 25
create 1 item[random number between 1 and (however many items you have)] at point
 

mylemonblue

You can change this now in User CP.
Reaction score
7
I guess I'll have to go with that for now, thanks :)
I just found that the Math-Rand Number can be a tad... Um.. Not random, at times. Like when picking a hero at random, on occasion it will pick the same hero multiple times :p

+rep for helping though :) :)
 

jig7c

Stop reading me...-statement
Reaction score
123
I guess I'll have to go with that for now, thanks :)
I just found that the Math-Rand Number can be a tad... Um.. Not random, at times. Like when picking a hero at random, on occasion it will pick the same hero multiple times :p

+rep for helping though :) :)

i hope blizzard reads this :)
 

Bogrim

y hello thar
Reaction score
154
That's the true nature of random. You can roll a dice and get the same number several times.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Right, so now I have to figure out how to restrict certain item drops to certain creeps. (Ie trolls are weak and would yield lower class items, and rarely midlevel items, while a hydra would occasionaly drop a low class item, sometimes a rare item, etc...)

I was looking at how the Rexxar campaign did this, since fresh creeps would be added as timers expired, and only if the player was within range. It seems that certain unit types would be added into an array and were called somehow, but with all the triggers in the map I couldn't figure out how :(

But it's gotten me thinking about using variables to check what unit is dying and draw from a table accordingly.

EDIT: I guess using a Multiple ConditionsOr might work. I hope...
Trigger:
  • DarkTrolls Common
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • Multiple ConditionsOr - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Dying unit)) Equal to (==) Dark Troll
          • (Unit-type of (Dying unit)) Equal to (==) Dark Troll Shadow Priest
          • (Unit-type of (Dying unit)) Equal to (==) Dark Troll Trapper
    • Actions
      • -------- Drop Item --------
      • Set xDropPoint = (Position of (Dying unit))
      • Set xDropCommonChance = 4.00
      • Set xDropCommonItem = ItemTable[(Random integer number between 0 and 2)]
      • Set xDropRareChance = 2.00
      • Set xDropRareItem = Rune of Restoration
      • Trigger - Run Drop Item <gen> (checking conditions)
 

jig7c

Stop reading me...-statement
Reaction score
123
just use the dying unit's level as a condition

Code:
set temp_int = (level of dying unit)
if
temp_int equal to less then 5 and random number between 1 and 100 less than or equal to 25
then
create an item[random integer from 1 and 10] at point
else
if
and-conditions
temp_int equal to or more than 5 
temp_int less than 10 
random number between 1 and 100 less than or equal to 25
then
create an item[random integer between 1 and 15] at point
else
if 
temp_int equal to or more than 10 and random number between 1 and 100 less than or equal to 25
then
create an item[random integer between 10 and 20] at point
else....

assuming you have set ALL the items that can be dropped to an item array variable :)
25% to drop an item, based on dying unit's level...
 

mylemonblue

You can change this now in User CP.
Reaction score
7
That should work. :)
THank you for helping :D

EDIT: Well I got the Pool library to save in my map, but I cannot figure out how to get items/units into the pools :(
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Is hoping this won't classify as double-posting...

JASS:
function Example takes nothing returns nothing
    local intpool ip = intpool.create()
    call ip.addInt(1, 1.0) //Adds 1 as an integer entry with weight 1.0
    call ip.addInt(2, 0.5) //Adds 2 as an integer entry with weight 0.5
    call ip.getRandomInt() //Gets a random entry
    call ip.getChance(2)   //Returns the chance for a specific entry to be selected
    call ip.getWeight(2)   //Returns the weight for a specific entry
    call ip.removeInt(1)   //Removes integer entry 1
endfunction

This is supposed to be the functions used for calling the itempools, but the ReadMe included with the Pool library doesn't exactly say how the integer entry is supposed be used.


I tried replacing it with the rawcode for Units/Items and got syntax errors. I only know the bare basics of JASS, and so how to use this system eludes me :(
 

mylemonblue

You can change this now in User CP.
Reaction score
7
From Wc3C: http://www.wc3c.net/showthread.php?t=108369

I'm a stranger to JASS, and am only learning the ropes. I know a little about calling things, and how to exit from loops, creating and destroying certain things... But when it comes to using an external library to create your own thngs... It just flies by my head with a distinctive whoosh sound :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top