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.

      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