HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

suggestions - custom buff system

03-15-2009, 11:32 AM#1
akolyt0r
i am currently writing a custom buff system ...(for stacking buffs ..)
how would you code it ?

i am currently have something like this:
-one struct buffx, which contains the data for each buff ....
-one struct unitbuffs which contains all the buffs for one unit ... (for things like dispel ...for example)

Expand Basic Structure:


well basically ..what do i need for a custom buff .. ?!
-one hidden spellbook adder ability which adds a aura, which gives the buff (and maybe some effects already too) ...
-now i thought of having some method for buffx like addEffect takes integer abiId returns nothing which adds additional effects (also auras in a hidden spellbook ..or item abilities without a icon...well basically that would be up to the user) ...those abilitiy-ids would be stored in some array member variable of buffx (a maximum of 5 additional effects should be sufficient ?)


What do you think of that ?
03-15-2009, 02:44 PM#2
Anitarf
I'd do it like this.
03-15-2009, 06:38 PM#3
akolyt0r
Quote:
Originally Posted by Anitarf
I'd do it like this.
what i really dont like about Abuff is the requirement of Adamage ....
There should be a seperate (optional) module for damage-related stuff for your buff system.
03-15-2009, 06:46 PM#4
Rising_Dusk
I should probably release my buff system sometime. Hrm. Wonder how close it is..
03-15-2009, 07:07 PM#5
akolyt0r
nice suggestions really ...
how did you organize your code basically dusk ? ..i am interrested...#

EDIT: I think i will implement the additional effects using a Linked list ...seems the best imo ...
Also thought about using a linked list for the buffx-list attached to units ... ..but i wont do it, since it would slightly decrease performance ..(or it would stay the same ...unsure 'bout that)
03-15-2009, 07:20 PM#6
Anitarf
Quote:
Originally Posted by akolyt0r
what i really dont like about Abuff is the requirement of Adamage ....
Expand JASS:
Fixed.
03-15-2009, 07:21 PM#7
Rising_Dusk
Collapse JASS:
call UnitAddBuff(SourceUnit, TargetUnit, BuffTypeInteger, RealDuration, RealPeriodicity)
If I remember correctly. Basically, it functioned just like my IDDS, but with buffs.
Collapse JASS:
call RegisterBuffType(BuffTypeInteger, CallbackFunction)
There were two types of buffs; there were those that started and then expired once and there were those that started and then ran periodically, doing something. That 'doing something' is what the CallbackFunction registered to it would be. Inside the callback function, certain event response-like things were available - "GetBuffTargetUnit()", "GetBuffSourceUnit()", "GetBuffType()", etc.

It was really smooth. I just haven't cleaned it up and released it yet. I should, though.
03-15-2009, 07:29 PM#8
akolyt0r
Quote:
Originally Posted by Rising_Dusk
Collapse JASS:
call UnitAddBuff(SourceUnit, TargetUnit, BuffTypeInteger, RealDuration, RealPeriodicity)
If I remember correctly. Basically, it functioned just like my IDDS, but with buffs.
Collapse JASS:
call RegisterBuffType(BuffTypeInteger, CallbackFunction)
There were two types of buffs; there were those that started and then expired once and there were those that started and then ran periodically, doing something. That 'doing something' is what the CallbackFunction registered to it would be. Inside the callback function, certain event response-like things were available - "GetBuffTargetUnit()", "GetBuffSourceUnit()", "GetBuffType()", etc.

It was really smooth. I just haven't cleaned it up and released it yet. I should, though.
yeah i thought about adding a "do something periodic" thing aswell ....since i already have a timer to remove the buffs after the duration has expired ...
But first i will do a minimal buff system ..since such a thing can be easily be done by the users aswell ... (using a periodic timer + check if unit has buff xy..trough a method of the system)

@anitarf: Thats really lame 0.o ..but well... ... i really want a friend keyword for libraries ...REALLY ... would make "additional modules" much nicer ...