System BuffStruct

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;
  }
};
 
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.
 
..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!.>
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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().
 
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.
 
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.
 
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.
 
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.
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new
  • Ghan Ghan:
    Good stuff.
  • Ghan Ghan:
    Just make sure it is secure. :)
  • The Helper The Helper:
    It will only be on internal network

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top