• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Blink Spell Question

Status
Not open for further replies.
Level 4
Joined
Oct 1, 2004
Messages
77
Hey Guys, Just a question in reference to blink.

I've essentially made an attack unit that can teleport in and out of combat quickly, The only problem is when there are multiple units of the same type selected and I order them to blink to a target only one of them will blink at a time.

Is there anyway I can fix so when ordered to blink to a target all the units use the spell at the same time over just one?

Thanks for your time

Derrick
 
Level 11
Joined
Feb 11, 2010
Messages
199
Hey Guys, Just a question in reference to blink.

I've essentially made an attack unit that can teleport in and out of combat quickly, The only problem is when there are multiple units of the same type selected and I order them to blink to a target only one of them will blink at a time.

Is there anyway I can fix so when ordered to blink to a target all the units use the spell at the same time over just one?

Thanks for your time

Derrick

Yeah, use a non-Unique Cast ability as the base, and trigger the blink yourself (especially since it's such an easy ability to trigger...) As long as you're using a Unique Cast ability as your base ability, only one unit in a selected group is going to be ordered to use it, because that's what Unique Cast means!
Alternatively, you could detect all units of that type in your selection and order each of them individually to use your Blink spell with triggers.
 
Level 9
Joined
Dec 6, 2007
Messages
233
perhaps you can trigger it so that when a blink order is cast, it issues a blink order to all of the units currently selected by the player. Otherwise, you would have to manually trigger a blink based off a skill that can be casted by several units at once.

EDIT: ninja'd, but w/e. Just provides further proof that it would work.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,467
This I made for ShiFt on TheHelper.net, and it does something similar but it blinks ALL nearby allies with the cast of just one blink:

JASS:
scope GROUPBLINK initializer Init 

globals 
    private constant    integer         SPELL_ID = 'A0BN'
    
    private group   g           = CreateGroup()
    private real    TravelXVec  = 0.
    private real    TravelYVec  = 0.
endglobals

private function GroupFilt takes nothing returns boolean
    local unit t = GetFilterUnit()
 
    if IsUnitType(t, UNIT_TYPE_HERO) and IsUnitAlly(t,bj_groupEnumOwningPlayer) then
        call SetUnitX(t,GetUnitX(t) +TravelXVec)
        call SetUnitY(t,GetUnitY(t) +TravelYVec)
    endif
    
    set t= null
    return false
endfunction

private function Actions takes unit u returns nothing
    local real x1 = GetUnitX(u)
    local real y1 = GetUnitY(u)
    local real radius = 512
    local real x2 = GetSpellTargetX()
    local real y2 = GetSpellTargetY()
    local real x3 = x2 -x1
    local real y3 = y2 -y1
    local real a = Atan2(y3,x3)
    local real dist = SquareRoot(x3 *x3 + y3 *y3)
    
    set TravelXVec = dist *Cos(a)
    set TravelYVec = dist *Sin(a)
    set bj_groupEnumOwningPlayer= GetTriggerPlayer()
        
    call GroupEnumUnitsInRange( g, x1, y1, radius, Filter( function GroupFilt ))
    
endfunction

private function Conditions takes nothing returns boolean
    if GetSpellAbilityId() == SPELL_ID then
        call Actions(GetTriggerUnit())
    endif
    return false
endfunction

//===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 11
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
            set i = i + 1
        endloop

        call TriggerAddCondition( t, Condition( function Conditions ) )
    endfunction
    
endscope
 
Level 4
Joined
Oct 1, 2004
Messages
77
Dayem Bribe that looks confusing as hell, I appreciate the code but maybe a GUI trigger? I basically want for each unit to all cast the same spell at the same time if they're all selected, mainly for balancing issues eg cool downs, mana costs and I don't want units who aren't this type of unit to be blinked with them
 
Level 9
Joined
Dec 6, 2007
Messages
233
  • Multi Blink
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Set Temp_Group = (Units currently selected by (Owner of (Triggering unit)))
      • Unit Group - Remove (Triggering unit) from Temp_Group
      • Set Temp_Loc = (Target point of ability being cast)
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Night Elf Warden - Blink Temp_Loc
      • Custom script: call RemoveLocation(udg_Temp_Loc)
      • Custom script: call DestroyGroup(udg_Temp_Group)
This works in any situation. It's better than just a multi-castable trigger blink because you still can't multi-blink with heroes with that. Tested and works.

EDIT: Make a small adjustment to the above trigger.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(blink))
    • Actions
Otherwise there is a slight delay
 
Last edited:
Status
Not open for further replies.
Top