System BuffStruct

13lade619

is now a game developer :)
Reaction score
398
using Hashtables:

when saving a BuffStruct to [ BuffId x UnitHandle ]..
something would go wrong when you stack the same buffs on a single unit.

-

but how about attaching a Queue (FIFO) of buffs to a unit?.
i dont know how to implement it but it's an idea...
Code:
struct fifo_node 
{
  struct fifo_node *next;
  value_type value;
};
 
class fifo
{
  fifo_node *front;
  fifo_node *back;
  fifo_node *dequeue(void)
  {
    fifo_node *tmp = front;
    front = front->next;
    return tmp;
  }
  queue(value)
  {
    fifo_node *tempNode = new fifo_node;
    tempNode->value = value;
    back->next = tempNode;
    back = tempNode;
  }
};
 

13lade619

is now a game developer :)
Reaction score
398
What if you want to see how many stacks there are of a buff on a unit?
..manually having a counter you can +/- and attaching using PUI/AIDS would be my (primitive) solution if i were to code a spell that does that.

What if you want to remove the latest stack, not the first?
http://en.wikipedia.org/wiki/Double-ended_queue

idk if it's possible through JASS though..

again, i'm just tossing in some ideas i dont know how to implement :p.
 

13lade619

is now a game developer :)
Reaction score
398
..reporting in some lag: not preloading.

well, discovered this was the source of my lag, ability ids are not preloaded.

i had to create my own method inside buffstruct to preload the ids... and it reduced my lag.

<hmm.. BuffStruct not preloading + Status not preloading = lagspike!.>
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I got some questions about your system, before upgrading my map to this new system - I read through the posts but I am not 100% sure if everything was answered yet:


1) How can I create stacking buffs with this? Is it enough to just create local buffstructs and just apply them to the unit multiple times? I think it is, but I want to go sure.
JASS:

function bla takes unit target returns nothing
     local BuffA a = BuffA.create(target)
endfunction


2) How can I write a simple dispel ability that removes 2 buffs from a unit? I want it so that if Buff A is 3 times stacked, it only removes 2 stacks and removes no other buff in this case.

3) The textmacros seem not to create the required object data. Is it save to just create the buffs/abilities on your own? How can I tell which AbilID and BuffID they need?

thanks in advance.
 

13lade619

is now a game developer :)
Reaction score
398
Buff effects CAN stack.. but buggy.... but the 'buff' gets removed when the first one is destroyed.. though the effects will remain as long as theyre triggered

3) The textmacros seem not to create the required object data. Is it save to just create the buffs/abilities on your own? How can I tell which AbilID and BuffID they need?
sometimes it takes 2 save/restarts to create object data.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Buff effects CAN stack.. but buggy.... but the 'buff' gets removed when the first one is destroyed.. though the effects will remain as long as theyre triggered
So basicly, there is no 'clean' stacking possible without creating workarounds?
Not sure if I understood you right:
Lets say I apply 3 buffstructs of the same bufftype to a unit. Only one buff icon appears, but internally, the 3 buffs are active. If I now destroy one of those buffstructs, the bufficon disappears although the other two buffs are internally still active? If so, then J4L has to do something about it. The buff icon should only be removed when the last buff of the same type gets destroyed.

sometimes it takes 2 save/restarts to create object data.
Thanks ... after saving twice and then reloading, it works magically.
 

13lade619

is now a game developer :)
Reaction score
398
Lets say I apply 3 buffstructs of the same bufftype to a unit. Only one buff icon appears, but internally, the 3 buffs are active. If I now destroy one of those buffstructs, the bufficon disappears although the other two buffs are internally still active?
precisely. because the first onRemove removes the 'buff'. but the triggered effects created by the 3 onApply's are still active.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
precisely. because the first onRemove removes the 'buff'. but the triggered effects created by the 3 onApply's are still active.
So how can I workaround this most efficiently? By counting the number of buffs on my own and only applying one buff to the unit instead of multiple ones? This totally renders the system useless, as you can easily create non-stacking buffs on your own without the need of complicated systems.

J4L really has to fix that problem. I mean ... it's not that hard after all. Just count the number of buffs of each type per unit and only remove the ability and buff if it was the last one. I would do it on my own, but I do not know how the non-removing of the tornado ability in the destroy/setUnit method affects other parts of the system.

As far as I can see, the .isOn() method retrieves the ability level for the unit. This also needs to be changed in order for it to work.
 

13lade619

is now a game developer :)
Reaction score
398
i can think of an easy fix for now..

a bufftype counter computed on the onApply method.
then conditionally removing the ability..

example:

onApply :

if buffcounter == 0, AddAbilId
else buffcounter +1

onRemove :

buffcounter -1
if buffcounter == 0, RemoveAbilId
else nothing.

so the current .isOn will still work.

allows buff Counting and 'Stacking'.
though this does not solve the retrieval issues.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
though this does not solve the retrieval issues.
Dont know what you mean by that? Can you explain please?


EDIT: Also, can you please upgrade the BuffStruct functionality, so that it allows entering a buff art? I can do that manually by just adding the art to the buff ability, but it would be better if I could do that directly with the system.
 

13lade619

is now a game developer :)
Reaction score
398
you can create effect members of the struct and attach them to the unit at onApply, then destroy/null accordingly.

Dont know what you mean by that? Can you explain please?
it's what J4L is gonna 'fix' soon i hope.

currently, you cannot retrieve a specific instance of buff from a unit just yet.
the only thing you can do, i believe, is

check if Buff.isOn(unit) then call Buff.destroy().
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
check if Buff.isOn(unit) then call Buff.destroy().
Buff.destroy() only removes the right buff instance, as far as I know, so it should work fine. The problem is only, that is takes the ability away when it is removed.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
you do not know which of the 2 got destroyed...
Errr ... what? Are you sure? I think structs are perfectly identified.
I mean, when you call MyBuffInstance.destroy(), then theres no way any other instance than this one can get removed.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I am in the process of fixing when the ability is removed (which is, of course, cosmetic - stacking and stuff already works fine for this system).
It's not cosmetic. The .isOn method checks for the buff ability and thus is also bugged.
 

Grundy

Ultra Cool Member
Reaction score
35
I never really understood why .isOn was there in the first place. I can't think of any situation I would ever use it. If I ever did need to find out if a unit had the buff I think I would rather just have a function in the buff struct that returns the unit the buff is applied to instead of a function that takes a unit as a parameter and returns a boolean. And even that would be so situational I'd probably just write that function in whatever buff struct I needed it in instead of a part of the system that's included in every buffstruct.

Is there a reason why .isOn checks if the unit has the ability instead of comparing it to the unit that the buff was applied to?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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!
    +1
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top