• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Whats the best way to do droptables?

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,240
Well, the one I'm going to use is the best of course and quite simple :p (Demo map coming soon™)

Create an array of base item types, a ring, amulet, artifact and so on. You can get away with just one of each.

Then create abilities, you can use item abilities as base. +hp, +damage and so on. Decide which stats are prefix bonuses and which are suffix bonuses. Set the abilities into arrays. The create string arrays so you can name your affixes. For example:

prefixes[1] = strength +1
prefixNames[1] = "Mighty"
suffixes[1] = damage +1
suffixNames[1] = "of Damage"

When a unit dies, randomize a number to see whther an item drops or not. If an item should drop, randomize the base item. Then randomize whether it gets a prefix and/or a suffix. If it gets one or both, save the index of the affixes for the item.

When a unit acquires/loses the item, load the affix integers, and set the level of the abilities accordingly. Get unit's level of x ability and increase/add/remove it.

You can give the items some dummy ability, so that when you left click the item, it shows the name and stats in a multiboard for example.

This way you can even create multile prefixes and suffixes just like in diablo 2 where you could have 3(?) of both resulting in very rare but sweet drops.

And you don't have to create tons of base items, only very few. But you can't show the stats in the tooltip.
 
Level 8
Joined
Mar 3, 2009
Messages
327
:ogre_datass:
(always wanted to use that in context)

Thanks, maker. I thought prefixes and suffixes were out of the question, but they would be pretty sweet to have now that I think about it..

(Lightbulb) I have an idea that you may copy. An ability that targets items thats called something like, identify item. and THAT shows the item stats, and makes much more sense, and doesnt clog up the item's active ability :)

Thankyou good sir, i will get right onto this.

As an afternote, what I was thinking of when I actually made this post was the item dropping stage. How would you make the game calculate different items drop from different units?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
How would you make the game calculate different items drop from different units?

I'll give the affixes different tiers, higher tier means better stats.

I'd use unit level or point value to get the tier the base item drops from. Both can be adjusted in the object editor to reflect the overall power of the unit.

You can store the drop percentages for each unit type, and the affixes that can drop. You could store them by using the unit type id as a key for hashtable data so you don't need to loop through unit type array, you can load the date directly. However I have not though about that yet, I have just implemeted the affix system and I'm just starting to think how different unit types drop different items
 
JASS:
local itempool ip = CreateItemPool()
   call ItemPoolAddItemType(ip, 'I001', 1)
   call ItemPoolAddItemType(ip, 'I002', 1)
   call ItemPoolAddItemType(ip, 'I003', 1)
   call PlaceRandomItem(ip,x,y)

An itempool is basically a set of items given specific "weight" allowing you to easily get a random item from it without having to use any extra variables or predefined values.

For instance, if i do like this:

JASS:
local itempool ip = CreateItemPool()
   call ItemPoolAddItemType(ip, 'I001', 1)
   call ItemPoolAddItemType(ip, 'I002', 2)
   call ItemPoolAddItemType(ip, 'I003', 3)
   call PlaceRandomItem(ip,x,y)

then the item 'I001' will have a chance of 1/6 to spawn, 'I002' a chance of 2/6, and 'I003' a chance of 3/6 (or 50%).
PlaceRandomItem conveniently spawns a random item from the itempool for you.

I think there is a tutorial for this somewhere in the database.

EDIT: Remember to destroy local itempools when you're done with them:

JASS:
call DestroyItemPool(ip)
set ip = null
 
Level 13
Joined
May 11, 2008
Messages
1,198
you can use item pools. you can check either point value or unit type id or even unit level and then make a certain item pool and place an item from the item pool.

i'm not too concerned with item drops at the moment, more like making the items. making items was far simpler when it was all about the chase. now my map's aim is to rival dota.

you're free to look at the code in my the demon hunt tournament map and check out the way i set up my item drops. the item drop system is pretty small for my map, but with some complication here or there. i'd recommend to you to use textmacros for an rpg. my the ancient frontier map will most likely be using textmacros for the item drops. it'll be coded far faster that way. if you need to see an example of a textmacro check out the item stacking system, that has some textmacros in it. that's the sort of thing i mean. it's not necessary, just makes it easier to work with the code.
 
Status
Not open for further replies.
Top