GroupBlink

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
Hey,
I'm sure you've all seen the Starcraft 2 ingame preview trailer. I really liked the way the zealots can now rapidly leap to a position thus greatly improving their melee fighting capabilities. I tried to emulate that with wc3. Well, first I was a bit disappointed, since in wc3 only one unit actually casts the spell, even if a bunch of the same unit type is selected. So even out of ten selected units with the blink ability, only one will actually blink to the position.
To get that right, I wrote this little trigger, which I used on satyrs with a modified blink ability. Now it's real fun moving and blinking them around in a bunch. Here's my simpleton trigger:

JASS:

function OneId_filter takes nothing returns boolean
    return GetUnitTypeId(GetFilterUnit()) == bj_groupEnumTypeId and GetWidgetLife(GetFilterUnit()) > 0.4
endfunction

function GroupBlink takes nothing returns nothing
    local group g=CreateGroup()
    local boolexpr b=Filter(function OneId_filter)
    local unit u=GetOrderedUnit()
    if GetIssuedOrderId()==OrderId("blink") then
        call DisableTrigger(gg_trg_Order)
        set bj_groupEnumTypeId='n00M'
        call GroupEnumUnitsSelected(g, GetOwningPlayer(u), b)
        call GroupPointOrder(g,"blink",GetOrderPointX(),GetOrderPointY())
        call TriggerSleepAction(0.2)
        call EnableTrigger(gg_trg_Order)
    endif
    call DestroyGroup(g)
    call DestroyBoolExpr(b)
    set u=null
    set b=null
    set g=null
endfunction
        
function InitTrig_Order takes nothing returns nothing
    local integer i=0
    set gg_trg_Order = CreateTrigger()
    loop
        exitwhen i>5
        call TriggerRegisterPlayerUnitEvent(gg_trg_Order,Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null)
        call TriggerAddAction(gg_trg_Order, function GroupBlink)
        set i=i+1
    endloop
endfunction


little annotation: my map only got 6 players, that's why 'exitwhen i>5' in the trigger.
 

N-a-z-g-u-l

New Member
Reaction score
30
looks nice ;) i also made a script like that to sell multiple towers without the stupid flag at the towers in a TD...
there is only one thing i would improve: i dont know if that works, but either reduce the TriggerSleepAction thing to TriggerSleepAction(0) or remove it completely, as your trigger reacts on the order, and im pretty sure the order has no delay so the wait is not needed...
as i read over it again, i found another thing... you are creating the unit group and the filter even if the ability isnt blink, it would save performance if you put that into the if-part (well, would not make a difference, but is better style ;) )
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
oh, that's to prevent the trigger from repeating itself - we don't want useless cycles which eventually crash the game

@hero
show me the script of Some! - if Some's script is better, then I'll ask if I can use it.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Nice code here.

JASS:
call DestroyBoolExpr(b) // Never destroy a BoolExpr


You could put the units in a global group when leaping and then as a condition check that the ordered unit is not is the global group, this way no need to disable the trigger.
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
you're the first one to say that a boolexpr shouldn't be destroyed.
I've always destroyed them, and never got any problems with it.

so what's your point?

and whom or what do you refer to with your conclusion? (official jass manual, forum discussion, own experience...?)
 

grim001

New Member
Reaction score
10
there's no point in destroying a boolexpr, it always returns the same handle, so just use Condition() always or put it in a global.
 

Sim

Forum Administrator
Staff member
Reaction score
534
> I really liked the way the zealots can now rapidly leap to a position thus greatly improving their melee fighting capabilities.

The Zealots charge, while the Stalkers blink ;)

----------------------------------------------

Good stuff!
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
there's no point in destroying a boolexpr, it always returns the same handle, so just use Condition() always or put it in a global.

so in this case there won't be any need to declare it either. (local boolexpr b=....) ?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • 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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top