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

Ability activates another ability.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
JASS:
scope spawnHellHounds initializer activate
//initializer OnInit

globals

public trigger spawner
integer hellDamage = 5
endglobals





function checker takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A046' ) ) then
        return false
    endif
    return true
endfunction


function spawnHell takes nothing returns nothing

    if ( checker() ) then
        call CreateNUnitsAtLocFacingLocBJ( 1, 'n008', GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()), GetSpellTargetLoc() )
        call AddSpecialEffectTargetUnitBJ( "head", GetLastCreatedUnit(), "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl" )
        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", GetSpellTargetLoc() )
        set udg_TempPoint = GetSpellTargetLoc()
        call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
        call SelectUnitAddForPlayer( GetLastCreatedUnit(), GetOwningPlayer(GetTriggerUnit()) )
        call RemoveLocation(udg_TempPoint)
       //call BlzSetUnitBaseDamage( GetLastCreatedUnit(), 1000*hellDamage, 0 )
    else
    endif
endfunction




function activate takes nothing returns nothing
    set spawner = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(spawner, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddAction(spawner, function spawnHell)
endfunction






endscope


So this script creates a unit. I have another ability that creates a gold coin.

  • Spawn Gold Coin
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Exploding Gold Coin
    • Actions
      • Custom script: local item Coin = null
      • Item - Create Fake Gold Coin at (Target point of ability being cast)
      • Set TempPoint = (Target point of ability being cast)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set TEMP_ITEM = (Last created item)
      • Custom script: set Coin = udg_TEMP_ITEM
      • Wait 60.00 seconds
      • Custom script: set udg_TEMP_ITEM = Coin
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TEMP_ITEM Not equal to No item
        • Then - Actions
          • Item - Remove TEMP_ITEM
        • Else - Actions
Your hero has to research both abilities to be able to use them. If only the gold coin is researched and not the unit spawner ability, it will properly spawn the gold coin.

But if I research both abilties, the unit spawner will properly spawn the unit. Yet the gold coin ability will now spawn the unit instead of a gold coin.

The hotkey for the coin is G, the unit is L. Is there anything wrong with my code/trigger that would cause this that I've overlooked?
 
Level 12
Joined
Dec 2, 2016
Messages
733
Are both of these abilities based on channel, or at least the same base spell? I suppose the order IDs are the suspects here, since nothing wrong with your code could cause that. There are some logical errors in your code, but they are unlikely suspects.

Yes they both use channel as well as I believe they are the same base ability duplicated.
 
Level 39
Joined
Feb 27, 2007
Messages
5,028
In the Channel Field, there is a certain base order Id field that has channel as the default entry. You can change that to whatever you please.
Before you get any ideas @Rugarus, the only other spell this works for is Spellbook.

How do you change that? I don't think I've ever come across that before. Or is that like a check I should add to the code and check if the order id = x or y and proceed with the code accordingly?
In the channel-based spell itself. Data - Options check "unique cast" the same way you have to check "visible" to be able to see it on the command card.
 
Status
Not open for further replies.
Top