• 🏆 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!

[Spell] Auto-cast Multishot

Status
Not open for further replies.
Level 3
Joined
Nov 18, 2015
Messages
41
Currently I'm using searing arrows order Id's to add/remove a hidden spellbook to make my multishot auto-cast. I know there's another way I just can't find the thread I originally found.

The problem with this, also, is that it only works if you're using the ability as an auto-cast, even though you have the option of clicking the ability by hand and selectively using it to conserve mana, it won't work because that doesn't trigger the same order Id.

What should I do in place of this to ensure the ability works ALL the time.

This is what I'm using right now. Very simple.

  • Splitshot Activate
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(flamingarrows))
    • Actions
      • Unit - Add Split-shot (Spell Book) to (Triggering unit)
      • Game - Display to (All players) the text: added
  • Splitshot Deactivate
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(unflamingarrows))
    • Actions
      • Unit - Remove Split-shot (Spell Book) from (Triggering unit)
      • Game - Display to (All players) the text: removed
EDIT: Decided to simply merge the two triggers.

  • Splitshot Toggle
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(flamingarrows))
      • (Issued order) Equal to (Order(unflamingarrows))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(flamingarrows))
        • Then - Actions
          • Unit - Add Split-shot (Spell Book) to (Triggering unit)
          • Game - Display to (All players) the text: added
        • Else - Actions
          • Unit - Remove Split-shot (Spell Book) from (Triggering unit)
          • Game - Display to (All players) the text: removed
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
That trigger condition will never evaluate to true because by default all conditions are ANDed together. If you wanna do it that way you need to put them together inside of an OR block.

It is possible that single-casting searing arrows doesn't have an order string, but it should definitely have an order ID (orders are integers internally, some also have string versions that GUI can recognize). To test this, make a trigger like:
  • OrderID
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg(OrderId2String(GetIssuedOrderId()) + " ---- " + I2S(GetIssuedOrderId()))
If it has a DIFFERENT order ID than autocasting searing arrows you can then use the following to do stuff (can't put it in a trigger condition):
  • Custom script: if GetIssuedOrderId() == 12345678 then //put the appropriate number there
  • -------- Do stuff --------
  • Custom script: endif
The real hard question to answer is what you should do if you detect the cast once order. Afaik there's no event that would fire when it is successfully cast (AKA: the unit attacks with it active for one attack). If you are using a damage detection system that differentiates between attacks and spells you could add the spellbook and put the unit in a group; when it attacks a target and is in the group then remove the spellbook. It is possible the "a unit is attacked" event could work with the same method though that would be prone to the same sorts of buggy/unexpected behavior that event has.
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
The order string for a single cast is flamingarrowstarg but that trigger @Pyrogasm has above is a nice method of finding the order ID of an ability. I usually use the following trigger to get the order strings. To each his own I guess.

  • Order Strings
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Issued order)))

As for how to pull off the multi-shot, I'd take the lazy approach of using a toggle ability, such as Immolation, to turn on and off the multi-shot in conjunction with the passive Bear Form transformation trick. But that's just me. ¯\_(ツ)_/¯
 
Level 12
Joined
May 9, 2009
Messages
735
I don't know how to deal with the likes of searing arrows or black arrows and I don't think it is a good idea.
I would suggest you instead use an autocast like curse or fairie fire - your unit will always use it any enemy it can. You can trigger your unit to use it on attack too like searing arrows based on if it has its autocast activated.

This way you have a simple event - unit starts effect of ability. Now do what you like. Maybe create a dummy unit with the same damage and the multishot ability, maybe create several dummies and order then to shoot non-same targets (if you want the damage dice) and you could create conditions checking if your hero has that ability or that damage boost to alter the dummies.
 
Level 3
Joined
Nov 18, 2015
Messages
41
That trigger condition will never evaluate to true because by default all conditions are ANDed together. If you wanna do it that way you need to put them together inside of an OR block.
Yeah that was a goofy mistake, I just overlooked that in my tiredness.

As for how to pull off the multi-shot, I'd take the lazy approach of using a toggle ability, such as Immolation, to turn on and off the multi-shot in conjunction with the passive Bear Form transformation trick. But that's just me. ¯\_(ツ)_/¯
Enlighten me on what the "passive bear form transformation trick" is?

I don't know how to deal with the likes of searing arrows or black arrows and I don't think it is a good idea.
I would suggest you instead use an autocast like curse or fairie fire - your unit will always use it any enemy it can. You can trigger your unit to use it on attack too like searing arrows based on if it has its autocast activated.

This way you have a simple event - unit starts effect of ability. Now do what you like. Maybe create a dummy unit with the same damage and the multishot ability, maybe create several dummies and order then to shoot non-same targets (if you want the damage dice) and you could create conditions checking if your hero has that ability or that damage boost to alter the dummies.
Seems silly to use a dummy unit to attack another unit in place of the unit already attacking?
 
Level 8
Joined
Jan 28, 2016
Messages
486
Enlighten me on what the "passive bear form transformation trick" is?

This should explain how to achieve the Bear Form trick to passively transform one unit into another. However, I was basing my idea off of DotA's Medusa's Split Shot ability, which turns out uses Bear Form as a basic transformation ability to morph into a copy of itself with the Barrage ability in a spellbook, rather than editing the Number of Targets of the copy's attack (see below; more info on unit editor fields here).

My bad here. You should probably just stick to the hidden spellbook with Barrage like you stated in your OP.

World Editor Tutorials said:
Combat - Attack x - Maximum Number of Targets (Integer)
This is for the 'Missile-Bounce' weapon type. It determines the total number of units the attack can hit.
 
Level 3
Joined
Nov 18, 2015
Messages
41
Oh understood. I've succeeded in getting everything working, but like you said the hard part is the detection of when to remove the barrage ability after the single cast. I've run in to a wall so I decided to give it a break and brainstorm a bit and maybe something will come to me.
 
Level 3
Joined
Nov 18, 2015
Messages
41
You're not using an damage detection systems in your map already? Doing it that way seems the easiest to me.

No I'm not yet. I was planning on looking in to it at some point but haven't yet.
I figured out a way to do what I was trying to do, however. A neat little trick I remembered from that page I was thinking of.

What I did was I made a dummy orb ability out of the Orb of Fire ability, and set the AoE and damage bonus to null.
Then you add the orb ability AND the spellbook to the unit. Ensure that the orb ability is UNDERNEATH the spellbook ability. Effectively, this will remove the barrage ability inside the spellbook (can't stack orb abilities), so it uses the most recently added effect.

This is the trick you can use, the ability searing arrow's will overwrite your dummy orb effect and since it's the only "orb" effect that is ALSO compatible with barrage, it will allow you to use barrage while you're casting searing arrows, both autocast AND single target, without the need for a single trigger.

It's pretty simple but so few know about Searing arrow's compatibility. It might be worth me making a tutorial for this. Tested, worked great.
 
Level 12
Joined
Jan 2, 2016
Messages
973
I have made an auto-cast ability, that deals bonus damage, based on the mana the unit has.
I made the base ability Black Arrow, and I'm removing the buff from the unit as soon as it takes damage, and it has the custom buff I've given to the black arrow.
JASS:
function Trig_Orb_of_Magic_Conditions takes nothing returns boolean
    local real dam
    local texttag ttg
    if GetUnitAbilityLevel(udg_GDD_DamagedUnit, 'B004') > 0 then
        call UnitRemoveAbility( udg_GDD_DamagedUnit, 'B004' )
        set dam = (GetUnitState(udg_GDD_DamageSource, UNIT_STATE_MANA) + (54 - 6*GetUnitAbilityLevel(udg_GDD_DamageSource, 'A02A')))/5
        call UnitDamageTarget( udg_GDD_DamageSource, udg_GDD_DamagedUnit, dam, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
        set ttg = CreateTextTag()
        call SetTextTagText( ttg, I2S(R2I(dam)), 0.023 )
        call SetTextTagPos( ttg, GetUnitX(udg_GDD_DamagedUnit), GetUnitY(udg_GDD_DamagedUnit), 0 )
        call SetTextTagColor( ttg, 51, 127, 255, 255 )
        call SetTextTagPermanent( ttg, false )
        call SetTextTagVelocity( ttg, 0, 0.071/2 )
        call SetTextTagFadepoint( ttg, 1.00 )
        call SetTextTagLifespan( ttg, 2.5 )
        set ttg = null
    endif
    return false
endfunction

//===========================================================================
function InitTrig_Orb_of_Magic takes nothing returns nothing
    set gg_trg_Orb_of_Magic = CreateTrigger(  )
    call TriggerRegisterVariableEvent( gg_trg_Orb_of_Magic, "udg_GDD_Event", EQUAL, 0 )
    call TriggerAddCondition( gg_trg_Orb_of_Magic, Condition( function Trig_Orb_of_Magic_Conditions ) )
    call DisableTrigger(gg_trg_Orb_of_Magic)
endfunction
No need to be worried that it's in jass. It used to be in GUI, but I reoworked it in jass to make it more efficient.

Anyways... in my signature you can see "Custom Multishot". If you get it, you wouldn't need to add the barrage ability and then wonder when to remove it.
Your trigger will look like:
JASS:
function Trig_Orb_of_Magic_Conditions takes nothing returns boolean
    local real dam
    if GetUnitAbilityLevel(udg_GDD_DamagedUnit, 'B004') > 0 then
        call UnitRemoveAbility( udg_GDD_DamagedUnit, 'B004' )
        call MultishotLightAdvanced(udg_GDD_DamageSource, udg_GDD_DamagedUnit, udg_GDD_Damage, 0, 180, 600 /*the range of your unit*/, true, ATTACK_TYPE_PIERCE /*the attack type of your unit*/, missile /*you'd need to set this yourself*/, 0.00, false, DAMAGE_TYPE_MELEE, 900.00)
    endif
    return false
endfunction

Look at the example triggers I have on the test map to get the hang of it.
 
Level 3
Joined
Nov 18, 2015
Messages
41
I have made an auto-cast ability, that deals bonus damage, based on the mana the unit has.
I made the base ability Black Arrow, and I'm removing the buff from the unit as soon as it takes damage, and it has the custom buff I've given to the black arrow.
JASS:
function Trig_Orb_of_Magic_Conditions takes nothing returns boolean
    local real dam
    local texttag ttg
    if GetUnitAbilityLevel(udg_GDD_DamagedUnit, 'B004') > 0 then
        call UnitRemoveAbility( udg_GDD_DamagedUnit, 'B004' )
        set dam = (GetUnitState(udg_GDD_DamageSource, UNIT_STATE_MANA) + (54 - 6*GetUnitAbilityLevel(udg_GDD_DamageSource, 'A02A')))/5
        call UnitDamageTarget( udg_GDD_DamageSource, udg_GDD_DamagedUnit, dam, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
        set ttg = CreateTextTag()
        call SetTextTagText( ttg, I2S(R2I(dam)), 0.023 )
        call SetTextTagPos( ttg, GetUnitX(udg_GDD_DamagedUnit), GetUnitY(udg_GDD_DamagedUnit), 0 )
        call SetTextTagColor( ttg, 51, 127, 255, 255 )
        call SetTextTagPermanent( ttg, false )
        call SetTextTagVelocity( ttg, 0, 0.071/2 )
        call SetTextTagFadepoint( ttg, 1.00 )
        call SetTextTagLifespan( ttg, 2.5 )
        set ttg = null
    endif
    return false
endfunction

//===========================================================================
function InitTrig_Orb_of_Magic takes nothing returns nothing
    set gg_trg_Orb_of_Magic = CreateTrigger(  )
    call TriggerRegisterVariableEvent( gg_trg_Orb_of_Magic, "udg_GDD_Event", EQUAL, 0 )
    call TriggerAddCondition( gg_trg_Orb_of_Magic, Condition( function Trig_Orb_of_Magic_Conditions ) )
    call DisableTrigger(gg_trg_Orb_of_Magic)
endfunction
No need to be worried that it's in jass. It used to be in GUI, but I reoworked it in jass to make it more efficient.

Anyways... in my signature you can see "Custom Multishot". If you get it, you wouldn't need to add the barrage ability and then wonder when to remove it.
Your trigger will look like:
JASS:
function Trig_Orb_of_Magic_Conditions takes nothing returns boolean
    local real dam
    if GetUnitAbilityLevel(udg_GDD_DamagedUnit, 'B004') > 0 then
        call UnitRemoveAbility( udg_GDD_DamagedUnit, 'B004' )
        call MultishotLightAdvanced(udg_GDD_DamageSource, udg_GDD_DamagedUnit, udg_GDD_Damage, 0, 180, 600 /*the range of your unit*/, true, ATTACK_TYPE_PIERCE /*the attack type of your unit*/, missile /*you'd need to set this yourself*/, 0.00, false, DAMAGE_TYPE_MELEE, 900.00)
    endif
    return false
endfunction

Look at the example triggers I have on the test map to get the hang of it.

Decent but unnecessary for my purposes, a simple multishot based off of Barrage will suffice. As it stands the multishot is auto-castable and works for single-use without any triggers adding/removing or otherwise related to the abilities. All done with the ability editor.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
I figured out a way to do what I was trying to do, however. A neat little trick I remembered from that page I was thinking of.

What I did was I made a dummy orb ability out of the Orb of Fire ability, and set the AoE and damage bonus to null.
Then you add the orb ability AND the spellbook to the unit. Ensure that the orb ability is UNDERNEATH the spellbook ability. Effectively, this will remove the barrage ability inside the spellbook (can't stack orb abilities), so it uses the most recently added effect.

This is the trick you can use, the ability searing arrow's will overwrite your dummy orb effect and since it's the only "orb" effect that is ALSO compatible with barrage, it will allow you to use barrage while you're casting searing arrows, both autocast AND single target, without the need for a single trigger.

It's pretty simple but so few know about Searing arrow's compatibility. It might be worth me making a tutorial for this. Tested, worked great.
Decent but unnecessary for my purposes, a simple multishot based off of Barrage will suffice. As it stands the multishot is auto-castable and works for single-use without any triggers adding/removing or otherwise related to the abilities. All done with the ability editor.
/me casts Summon @Kyrbi0
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
An old friend whose quest in Wc3 modding is to do everything possible without the use of the trigger editor. He would appreciate the ingenuity of your solution and probably eventually use that knowledge to do something else with it.
 
Level 8
Joined
Jan 28, 2016
Messages
486
I figured out a way to do what I was trying to do, however. A neat little trick I remembered from that page I was thinking of.

Is this the page you were thinking of? The Warcraft III Ability Guide from Warcraft III Campaigns.

The Warcraft III Ability Guide said:
Aroc (Barrage): Barrage allows unit to attack several targets with one attack and therefore it can be used for multishot abilities. The bonus damage field must be set to at least 1, because 0 will cause serious problems. Each target will be dealt the normal damage of the unit's attack and the amount of bonus damage specified here. The number of targets is 1 plus the maximum number of targets field of barrage. The projectile art field can have more than 1 entry and will override the default projectile of the unit. The art for each shot will be chosen at random from this list. The area of effect is the range for the additional attacks. This doesn't affect the main attack, only the extra attacks granted by barrage. Also set the maximum possible damage field to 0 if you don't want to limit the damage dealt. Unfortunately combining barrage with other attack enhancing abilities is pretty difficult. Many of them will completely eliminate the effect of barrage like all arrow abilities on autocast except AHfa (Searing Arrows) and many orb abilities. Orb abilities that do have an effect ability field only disable barrage when this effect ability comes into action. All other abilities like critical strike slow poison, freezing breath, lightning attack, liquid fire and similar spells pretty much work with barrage but will always only affect the main target and never the additional barrage targets. Basic enhancements like damage bonus, attack speed bonus and the like however will affect all targets. The AHfa (Searing Arrows) spell is very special. It's the only arrow ability that works with barrage and it even reenables barrage on autocast if it was disabled by an incompatible orb ability allowing to create an autocastable multishot ability.
 
Status
Not open for further replies.
Top