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

Thinking of making custom buffs.

Status
Not open for further replies.
Level 21
Joined
Mar 27, 2012
Messages
3,232
Basically I need a system where I can quickly modify bonuses, just like with buffs, but with more power.
Aka, I put on a buff that adds 50% damage and then slowly reduce the bonus to 0, at which point it's removed.
It could be done through invisible abilities, but it's clumsy and I will need lots of such things anyway.
Thus, I wanna code a custom buff system.

I am relatively skilled in JASS and can use basic vJASS to simplify things.

Current idea:
I use a linked list or table to store the buffs of each unit. They all have a set of possible attributes and I can access them separately somehow.
It should also be possible to refer to them(DO: Get the buff named SLOW and remove it from unit)

The problem is that I don't know how to make those things come together.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
vJass would be the best for this u could make structs and store the data. When u need to call the data back u could use a hashtable that tells u which struct that piece of data was stored to.

True, I could. But I prefer to keep things at a level that I can understand.
I only partially understand structs and if I would fully understand them, then I still wouldn't use them.
They're just arrays with allocation for all I need to know.

Anyways, the great question is organization.
I could put the stats in in a dozen different ways and so far I don't know a good way.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
structs are badically arrays with allocation but they serve a lot higher purpose. they organize everything a lot better than normal arrays. they can also store a ton of different info in one struct and now u dont need to have a dynamic array or a ton of hashtable reads to get all that info. structs also have a lot nicer of a syntax.

i dont understand y ppl bash anything b4 they fully understand its capabilities lol.

structs would be great for organizing everything. then u could use hashtables keyed to the unit to load the struct that it uses. and then all ur info is right in front of u.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
structs are badically arrays with allocation but they serve a lot higher purpose. they organize everything a lot better than normal arrays. they can also store a ton of different info in one struct and now u dont need to have a dynamic array or a ton of hashtable reads to get all that info. structs also have a lot nicer of a syntax.

i dont understand y ppl bash anything b4 they fully understand its capabilities lol.

structs would be great for organizing everything. then u could use hashtables keyed to the unit to load the struct that it uses. and then all ur info is right in front of u.

Well, I don't think this is actually the problem for me.
In this case I simply don't know a clean way atm.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Separate it into a library for setting bonus stats and another one that provides the buff interface for a unit. Then you can still create template buffs that may be instantiated and take parameters in order to build buffs of similar kind.

I dunno what you think would not be clean/pose a problem.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Separate it into a library for setting bonus stats and another one that provides the buff interface for a unit. Then you can still create template buffs that may be instantiated and take parameters in order to build buffs of similar kind.

I dunno what you think would not be clean/pose a problem.

I actually have my own BonusMod, so even the stats are easy to make.
What's confusing me is how should I know which buff has which stat.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
By picking evident names? The above could be "DmgBoostDecay". Unless you have a zillion types, whereby the typing would lose meaning, this is not really a problem. But just do it the way that you can add modifiers to the specific buff and parametrize it like buff.addMod(statsType,amount,relative,doesDecay) in init, so you can assemble it from components.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
By picking evident names? The above could be "DmgBoostDecay". Unless you have a zillion types, whereby the typing would lose meaning, this is not really a problem. But just do it the way that you can add modifiers to the specific buff and parametrize it like buff.addMod(statsType,amount,relative,doesDecay) in init, so you can assemble it from components.

This gave me an idea. Solved.
 
Status
Not open for further replies.
Top