• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Order to cast modified channel

Level 17
Joined
Mar 21, 2011
Messages
1,611
Hi,
i have a custom channel ability, which i modify the "Target Type" of several times during the game.
The problem that i have is, that when issuing a unit to cast this spell, it does not work unless the target type is set to "instant (no target)"
If it is set to "point target" for example, and you issue a point order, it doesn't do anything.

Anyone knows a way around for this or any alternatives? Thanks!
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I have never known any wc3 ability to play nice when having its targeting paradigm changed dynamically (historically this was done with Engineering Upgrade but you didn’t mention your method). Why is this necessary instead of having 3 abilities and swapping between them by disabling 2/3 at a time?

The better question is: what exactly are you trying to accomplish?

In any case, you can’t modify the base order outside of the OE so whatever order you wish to give must use that order, and it likely just doesn’t work at all if you try to use the order with a different targeting paradigm then the order is supposed to be.
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
All units in my map have default channel abilities
I created an Ability interface to have better control over some ability related events and other stuff.
Basically, i don't add an ability to a unit, but i change the already given abilities with the new natives (BlzSetAbilityIntegerLevelField...).
Example:
JASS:
scope Landmine
    
    globals
        AbilityType ABILITY_LANDMINE
    endglobals

    struct Landmine extends Ability
    
        Unit mine
    
        method onCast takes nothing returns nothing
            set this.mine = Unit.create(UNIT_LANDMINE, this.caster.controller, this.spellTargetX, this.spellTargetY, 90)
            set this.mine.summoner = this.caster
            set this.mine.animationSpeed = 0.5
            call this.mine.playAnimation("birth")
        endmethod
    
        method onFinishChannel takes nothing returns nothing
            // ---------
        endmethod
        
        method onInterruptChannel takes nothing returns nothing
            call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Other\\ToonBoom\\ToonBoom.mdl", this.mine.x, this.mine.y))
            call this.mine.remove()
        endmethod
        
        private static method onInit takes nothing returns nothing      
            set ABILITY_LANDMINE = AbilityType.create()
            set ABILITY_LANDMINE.name = "Landmine"
            set ABILITY_LANDMINE.tooltip = "test"
            set ABILITY_LANDMINE.cooldown = 1.0
            set ABILITY_LANDMINE.castRange = 100.0
            set ABILITY_LANDMINE.channelTime = 7.0
            set ABILITY_LANDMINE.targetType = TARGETTYPE_POINT
            set ABILITY_LANDMINE.icon = "ReplaceableTextures\\CommandButtons\\BTNLandMine.blp"
        endmethod

    endstruct
    
endscope

Swapping abilities based on their target type wouldn't work, because they are usually missing other important characteristics like channel time.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
Why can't you modify the other important characteristics AFTER swapping the ability to the version with the correct Target Type?

Assuming a unit can have up to 4 abilities and that you want Hotkeys for each type:
Create 4 Abilities that use the hotkeys Q, W, E, and R.
Create 3 copies of each of those Abilities, each with their own Targeting Type (Instant, Unit, Point) along with a unique and usable Base Order Id.
You could create a new variable in AbilityType to store the Base Order Id so you can reference it later on when issuing the order.
Then Add the appropriate Abilities to the Units at the start of the game using your own custom UnitAddAbility() function.
 
Last edited:
Level 17
Joined
Mar 21, 2011
Messages
1,611
Why can't you modify the other important characteristics AFTER swapping the ability to the version with the correct Target Type?
Because other abilities don't have channel time as a property.

Or do you mean copying the channel ability, each with a different initial "target type" value? I actually haven't tried that yet.

EDIT: it works :) thanks!
 
Top