Last buffed unit?

saw792

Is known to say things. That is all.
Reaction score
280
Is there any way to get 'Last Buffed Unit' or the last unit buffed with a specific buff in the trigger editor (or jass, if that's the only way)? The idea is that a multiple units are given a buff one after the other through a spell that doesn't target them. The last unit to be effected has another action applied to it. Any ideas?
 

Tyman2007

Ya Rly >.
Reaction score
74
Try using a unit array and setting the buffed unit like if its giving a buff through an ability you could use "Target unit of ability being cast" or "Triggering unit" if its the casting units.
 

saw792

Is known to say things. That is all.
Reaction score
280
As I said in the question the units are given the buff without being targeted. The spell has a glaive effect and applies the buff to each unit struck by the glaive, and causes another effect on the final unit. Thus, since only the first unit is targeted by the spell the best way I could think to apply an action to the last unit would be to 'get' the last buffed unit.
 

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
I will be helping you don't worry... last question... how many times does it bounce including the last target
 

saw792

Is known to say things. That is all.
Reaction score
280
The bounces change every level (3, then 4, then 5).
 

denmax

You can change this now in User CP.
Reaction score
155
Is this somehow in a line? Or a bounce? or does it have a limit of units? etc..

A line "last buffed unit" would be hard as hell, but not bounce and unit limit is quite easy since that it has a constant value of targets..
 

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
Sorry for Double Posting/Replying



Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to BUff 
    Actions
        Set Bounces = 0
        Set unit_casting = (Casting unit)
        Set Caster_Position = (Position of unit_casting)
        Set unit_target = (Target unit of ability being cast)
        Set Bounces = (Bounces + 1)
        Unit - Create 1 Dummy Unit for (Owner of unit_casting) at (Position of unit_casting) facing Default building facing degrees
        Unit - Add Inner Fire to (Last created unit)
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Human Priest - Inner Fire unit_target
        Countdown Timer - Start Timer as a Repeating timer that will expire in 0.40 seconds



Code:
Untitled Trigger 002
    Events
        Time - Timer expires
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Bounces Less than (2 + (Level of BUff  for unit_casting))
            Then - Actions
                Set Temp_Group = (Units within 500.00 of (Position of unit_target) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Match
                Set unit_target = (Random unit from Temp_Group)
                Set Bounces = (Bounces + 1)
                Unit - Create 1 Dummy Unit for (Owner of unit_casting) at (Position of unit_target) facing (Position of unit_target)
                Unit - Add Inner Fire to (Last created unit)
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Human Priest - Inner Fire unit_target
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Bounces Equal to (2 + (Level of BUff  for unit_casting))
                    Then - Actions
                        Set Temp_Group = (Units within 500.00 of (Position of unit_target) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Match
                        Set unit_target = (Random unit from Temp_Group)
                        Unit - Kill unit_target
                        Game - Display to (All players) the text: that is all folks  
                        Countdown Timer - Pause Timer
                    Else - Actions
                        Do nothing


Variables:

Bounces [Integer]
Caster Position[Point]
Temp Group[Unit Group]
Timer[Timer]
unit_casting[unit]
unit_target[unit]


set dummy unit's cast back swing and cast point both to 0


and... well.. theres .4second delay. in those successive cast OH WAIT THERES SOMETHING THAT WAS CUTTED!

Code:
Set Temp_Group = (Units within 500.00 of (Position of unit_target) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Matching unit) not equal to (unit_casting) and (((matching unit) not equal to (unit type of dummy unit)

use this complete temp group, and replace the temp group above.
 

saw792

Is known to say things. That is all.
Reaction score
280
Thanks demo, the only problem is with the visual effects. Your trigger picks a random unit in Temp_Group but the glaive effect of the ability may not strike that unit if there are too many units in the group. Thus there could be units not hit with the glaive that have the buff and not buffed hit by the glaive.
 

denmax

You can change this now in User CP.
Reaction score
155
Sorry for Double Posting/Replying



Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to BUff 
    Actions
        Set Bounces = 0
        Set unit_casting = (Casting unit)
        Set Caster_Position = (Position of unit_casting)
        Set unit_target = (Target unit of ability being cast)
        Set Bounces = (Bounces + 1)
        Unit - Create 1 Dummy Unit for (Owner of unit_casting) at (Position of unit_casting) facing Default building facing degrees
        Unit - Add Inner Fire to (Last created unit)
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Human Priest - Inner Fire unit_target
        Countdown Timer - Start Timer as a Repeating timer that will expire in 0.40 seconds



Code:
Untitled Trigger 002
    Events
        Time - Timer expires
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Bounces Less than (2 + (Level of BUff  for unit_casting))
            Then - Actions
                Set Temp_Group = (Units within 500.00 of (Position of unit_target) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Match
                Set unit_target = (Random unit from Temp_Group)
                Set Bounces = (Bounces + 1)
                Unit - Create 1 Dummy Unit for (Owner of unit_casting) at (Position of unit_target) facing (Position of unit_target)
                Unit - Add Inner Fire to (Last created unit)
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Human Priest - Inner Fire unit_target
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Bounces Equal to (2 + (Level of BUff  for unit_casting))
                    Then - Actions
                        Set Temp_Group = (Units within 500.00 of (Position of unit_target) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Match
                        Set unit_target = (Random unit from Temp_Group)
                        Unit - Kill unit_target
                        Game - Display to (All players) the text: that is all folks  
                        Countdown Timer - Pause Timer
                    Else - Actions
                        Do nothing


Variables:

Bounces [Integer]
Caster Position[Point]
Temp Group[Unit Group]
Timer[Timer]
unit_casting[unit]
unit_target[unit]


set dummy unit's cast back swing and cast point both to 0


and... well.. theres .4second delay. in those successive cast OH WAIT THERES SOMETHING THAT WAS CUTTED!

Code:
Set Temp_Group = (Units within 500.00 of (Position of unit_target) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Matching unit) not equal to (unit_casting) and (((matching unit) not equal to (unit type of dummy unit)

use this complete temp group, and replace the temp group above.

Wait wait wait, for the last bounce, it would kill the unit??

Great lol :D..

Well, he didn't say what kind of buffs lol :D..

And of course, the leaks, but I think you'd ignore it since it's not even your tirgger lol :D..

anyway, LEAKLESS TRIGGER..

Code:
Untitled Trigger 001
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to BUff 
    Actions
        Set Bounces = 0
        Set unit_casting = (Casting unit)
        Set Caster_Position = (Position of unit_casting)
        Set unit_target = (Target unit of ability being cast)
        Set Bounces = (Bounces + 1)
        Unit - Create 1 Dummy Unit for (Owner of unit_casting) at (Position of unit_casting) facing Default building facing degrees
        Unit - Add Inner Fire to (Last created unit)
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Human Priest - Inner Fire unit_target
        Countdown Timer - Start Timer as a Repeating timer that will expire in 0.40 seconds



Code:
Untitled Trigger 002
    Events
        Time - Timer expires
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Bounces Less than (2 + (Level of BUff  for unit_casting))
            Then - Actions
                [B]Set unit_targetLOC = (Position of (unit_target))[/B]
                Set Temp_Group = (Units within 500.00 of ([B]unit_targetLOC[/B]) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Matching unit) not equal to (unit_casting) and (((matching unit) not equal to (unit type of dummy unit)
                Set unit_target = (Random unit from Temp_Group)
                Set Bounces = (Bounces + 1)
                Unit - Create 1 Dummy Unit for (Owner of unit_casting) at (unit_targetLoc) facing (unit_targetLOC)
                Unit - Add Inner Fire to (Last created unit)
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Human Priest - Inner Fire unit_target
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Bounces Equal to (2 + (Level of BUff  for unit_casting))
                    Then - Actions
                        [B]Set unit_targetLOC = (Position of (unit_target))[/B]
                        Set Temp_Group = (Units within 500.00 of ([B]unit_targetLOC[/B]) matching ((((Matching unit) belongs to an ally of (Owner of unit_target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) has buff Inner Fire) Equal to False) and (((Matching unit) not equal to (unit_casting) and (((matching unit) not equal to (unit type of dummy unit)
                        Set unit_target = (Random unit from Temp_Group)
                        Unit - Kill unit_target
                        Game - Display to (All players) the text: that is all folks  
                        Countdown Timer - Pause Timer
                    Else - Actions
            [B]Custom Script: call RemoveLocation(udg_unit_targetLOC)
            Custom Script: call RemoveLocation(udg_Caster_Position)
            Custom Script: call DestroyGroup(udg_Temp_Group)[/B]

EDIT:

"Thanks demo, the only problem is with the visual effects. Your trigger picks a random unit in Temp_Group but the glaive effect of the ability may not strike that unit if there are too many units in the group. Thus there could be units not hit with the glaive that have the buff and not buffed hit by the glaive."

Doesn't the Glaive strike a random unit in Temp_Group? Then the problem would be about the timer, since sometimes the glaive could be overrun and may take more than 0.4 seconds..
 

saw792

Is known to say things. That is all.
Reaction score
280
He wasn't making the trigger for me so much as showing me how it would be done. I am quite capable of fixing the leaks and changing the buffs, etc. The glaive / buff problem, however, not so much :)

Thanks for showing interest in my thread. Appreciate it.
 

demotry241

Don't Ever Categorize Yourself.
Reaction score
105
Hehehe.... I always make Cheesy Beefy do the Leakless version, he is awesome!.


about the spell.. so i guess you want the units to get hit not once, but a few times..... then remove the unit has a specific buff =???

about special effect.

Set unit_target = (Random unit from Temp_Group)
Set Bounces = (Bounces + 1)
create special effect at position of unit_target
destroy special effect
 

denmax

You can change this now in User CP.
Reaction score
155
EDIT:

"Thanks demo, the only problem is with the visual effects. Your trigger picks a random unit in Temp_Group but the glaive effect of the ability may not strike that unit if there are too many units in the group. Thus there could be units not hit with the glaive that have the buff and not buffed hit by the glaive."

Doesn't the Glaive strike a random unit in Temp_Group? Then the problem would be about the timer, since sometimes the glaive could be overrun and may take more than 0.4 seconds..

The solution is another big type of trigger, which would give at least one damage to the target so that it could detect the event "takes damage" from an invisible dummy unit that did fire the glaive, since it is detected, the glaive will bounce to another random unit..

Problem, I have no idea how..
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • 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

      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