• 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.

[Solved] Make a JASS spell not "initially on"

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

I have a JASS spell which deals 100 damage. Once an item is picked up, I want to turn OFF the "100-damage" JASS spell, and enable another JASS spell which is based on the same ability code, but the damage number is adjusted to 200 damage.

For GUI spells I can easily turn off the first trigger and turn on another which is not "initially on". But for JASS spells this option doesn't exist. And when disabling it, I cannot turn it on via
vJASS:
call EnableTrigger(udg_Trigger_NEW)

So.. how can I leave a JASS trigger off on map initialization, but give me the option to enable it when the need arises?
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Well, it sounds like you could just use a global variable to define the damage dealt and adjust it when necessary, but I'll assume there's more to it than just that.

Enable/Disable trigger should work fine in Jass as far as I know. Are you sure you're typing in the correct trigger name?
udg_Trigger_NEW would be referencing a GUI trigger variable with the name "Trigger_NEW".

The proper syntax for referencing a GUI trigger directly (without a variable) would be:
JASS:
call EnableTrigger( gg_trg_NAME )
call DisableTrigger( gg_trg_NAME )
NAME is the actual name of the trigger. Use underscores to represent spaces.

 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
Hi Uncle,

I double checkt if I typed the wrong name, but no. This is the trigger for which I want to adjust the damage value (and yes, I don't want to make it a global variable, because I'm using kinda a "system" to replicate Aghanim's Ultimate improvement as in Dota for several heroes)

Name of the JASS triggers (original and improved):

1622746971511.png


Here the full trigger:
This JASS code is just one example, I have in total 5 different heroes/Ultimates stored in this way:
JASS:
function Trig_Aghanim_Initialisation_Actions takes nothing returns nothing
    // The Northwind
    set udg_Aghanim_UnitType[5] = 'H000'
    set udg_Aghanim_Ability_Original[5] = 'A000'
    set udg_Aghanim_Tooltip_NEW_Learn[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts dealing damage at nearby enemy units and slowing them for 4 seconds. |n|n|cffffcc00Level 1|r - Deals 40 damage per bolt. |n|cffffcc00Level 2|r - Deals 100 damage per bolt. |n|cffffcc00Level 3|r - Deals 160 damage per bolt. |n|n|cff99ccffCooldown:|r 80/70/60 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_1[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts. Each bolt deals |cff00BFFF40 magic damage|r to nearby enemies and |cff97FFFFslows|r them for 4 seconds. |n|n|cff99ccffCooldown:|r 80 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_2[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts. Each bolt deals |cff00BFFF100 magic damage|r to nearby enemies and |cff97FFFFslows|r them for 4 seconds. |n|n|cff99ccffCooldown:|r 70 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_3[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts. Each bolt deals |cff00BFFF160 magic damage|r to nearby enemies and |cff97FFFFslows|r them for 4 seconds. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_SFX_Placement_1[5] = "weapon"
    set udg_Aghanim_SFX_Placement_2[5] = "XXX"
    set udg_Aghanim_SFX_Effect[5] = "Abilities\\Weapons\\LichMissile\\LichMissile.mdl"
    set udg_Aghanim_Trigger_NEW[5] = gg_trg_Frozen_Orb_Aghanim
    set udg_Aghanim_Trigger_OLD[5] = gg_trg_Frozen_Orb
    set udg_Aghanim_Cooldown_OLD_Level_1[5] = 120
    set udg_Aghanim_Cooldown_OLD_Level_2[5] = 110
    set udg_Aghanim_Cooldown_OLD_Level_3[5] = 100
    set udg_Aghanim_Cooldown_NEW_Level_1[5] = 80
    set udg_Aghanim_Cooldown_NEW_Level_2[5] = 70
    set udg_Aghanim_Cooldown_NEW_Level_3[5] = 60

endfunction

//===========================================================================
function InitTrig_Aghanim_Initialisation takes nothing returns nothing
    set gg_trg_Aghanim_Initialisation = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Aghanim_Initialisation, function Trig_Aghanim_Initialisation_Actions )
endfunction

  • Aghanim Scepter Acquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Aghanim's Scepter
    • Actions
      • Set VariableSet Aghanim_Unit = (Triggering unit)
      • Set VariableSet Aghanim_Index = 1
      • Custom script: loop
      • Custom script: exitwhen udg_Aghanim_Index > 6
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Aghanim_Unit) Equal to Aghanim_UnitType[Aghanim_Index]
        • Then - Actions
          • Custom script: call EnableTrigger(udg_Aghanim_Trigger_NEW[udg_Aghanim_Index])
          • Custom script: call DisableTrigger(udg_Aghanim_Trigger_OLD[udg_Aghanim_Index])
          • -------- --------
          • Set VariableSet Aghanim_Tooltip_OLD_Learn[Aghanim_Index] = (Extended Tooltip (Learn) of Aghanim_Ability_Original[Aghanim_Index] for level 0)
          • Set VariableSet Aghanim_Tooltip_OLD_Level_1[Aghanim_Index] = (Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] for level 0)
          • Set VariableSet Aghanim_Tooltip_OLD_Level_2[Aghanim_Index] = (Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] for level 1)
          • Set VariableSet Aghanim_Tooltip_OLD_Level_3[Aghanim_Index] = (Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] for level 2)
          • -------- --------
          • Ability - Set Extended Tooltip (Learn) of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_NEW_Learn[Aghanim_Index] for level 0
          • Ability - Set Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_NEW_Level_1[Aghanim_Index] for level 0
          • Ability - Set Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_NEW_Level_2[Aghanim_Index] for level 1
          • Ability - Set Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_NEW_Level_3[Aghanim_Index] for level 2
          • -------- --------
          • Unit - For Unit Aghanim_Unit, Set cooldown of ability Aghanim_Ability_Original[Aghanim_Index], Level: 0 to Aghanim_Cooldown_NEW_Level_1[Aghanim_Index]
          • Unit - For Unit Aghanim_Unit, Set cooldown of ability Aghanim_Ability_Original[Aghanim_Index], Level: 1 to Aghanim_Cooldown_NEW_Level_2[Aghanim_Index]
          • Unit - For Unit Aghanim_Unit, Set cooldown of ability Aghanim_Ability_Original[Aghanim_Index], Level: 2 to Aghanim_Cooldown_NEW_Level_3[Aghanim_Index]
          • -------- --------
          • Unit - Add Aghanim_Ability_Added[Aghanim_Index] to Aghanim_Unit
          • Unit - For Unit Aghanim_Unit, start cooldown of ability Aghanim_Ability_Added[Aghanim_Index] " over "Aghanim_Cooldown_Added_Ability[Aghanim_Index] seconds.
          • -------- --------
          • Special Effect - Create a special effect attached to the Aghanim_SFX_Placement_1[Aghanim_Index] of Aghanim_Unit using Aghanim_SFX_Effect[Aghanim_Index]
          • Set VariableSet Aghanim_SFX_1[Aghanim_Index] = (Last created special effect)
          • Special Effect - Create a special effect attached to the Aghanim_SFX_Placement_2[Aghanim_Index] of Aghanim_Unit using Aghanim_SFX_Effect[Aghanim_Index]
          • Set VariableSet Aghanim_SFX_2[Aghanim_Index] = (Last created special effect)
          • Custom script: exitwhen true
        • Else - Actions
      • Set VariableSet Aghanim_Index = (Aghanim_Index + 1)
      • Custom script: endloop
  • Aghanim Scepter Lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Aghanim's Scepter
    • Actions
      • Set VariableSet Aghanim_Unit = (Triggering unit)
      • Set VariableSet Aghanim_Index = 1
      • Custom script: loop
      • Custom script: exitwhen udg_Aghanim_Index > 6
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Aghanim_Unit) Equal to Aghanim_UnitType[Aghanim_Index]
        • Then - Actions
          • Custom script: call EnableTrigger(udg_Aghanim_Trigger_OLD[udg_Aghanim_Index])
          • Custom script: call DisableTrigger(udg_Aghanim_Trigger_NEW[udg_Aghanim_Index])
          • -------- --------
          • Ability - Set Extended Tooltip (Learn) of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_OLD_Learn[Aghanim_Index] for level 0
          • Ability - Set Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_OLD_Level_1[Aghanim_Index] for level 0
          • Ability - Set Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_OLD_Level_2[Aghanim_Index] for level 1
          • Ability - Set Extended Tooltip of Aghanim_Ability_Original[Aghanim_Index] to Aghanim_Tooltip_OLD_Level_3[Aghanim_Index] for level 2
          • -------- --------
          • Unit - For Unit Aghanim_Unit, Set cooldown of ability Aghanim_Ability_Original[Aghanim_Index], Level: 0 to Aghanim_Cooldown_OLD_Level_1[Aghanim_Index]
          • Unit - For Unit Aghanim_Unit, Set cooldown of ability Aghanim_Ability_Original[Aghanim_Index], Level: 1 to Aghanim_Cooldown_OLD_Level_2[Aghanim_Index]
          • Unit - For Unit Aghanim_Unit, Set cooldown of ability Aghanim_Ability_Original[Aghanim_Index], Level: 2 to Aghanim_Cooldown_OLD_Level_3[Aghanim_Index]
          • -------- --------
          • Set VariableSet Aghanim_Cooldown_Added_Ability[Aghanim_Index] = (Ability Cooldown Remaining of Aghanim_Unit for ability Aghanim_Ability_Added[Aghanim_Index]..)
          • Unit - Remove Aghanim_Ability_Added[Aghanim_Index] from Aghanim_Unit
          • -------- --------
          • Special Effect - Destroy Aghanim_SFX_1[Aghanim_Index]
          • Special Effect - Destroy Aghanim_SFX_2[Aghanim_Index]
          • Custom script: exitwhen true
        • Else - Actions
      • Set VariableSet Aghanim_Index = (Aghanim_Index + 1)
      • Custom script: endloop
 
Last edited:

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
2,010
Make sure the triggers can actually reach and execute the that.
Also, I don't understand what you mean with this:
Hi Uncle,

This is the trigger for which I want to adjust the damage value (and yes, I don't want to make it a global variable, because I'm using kinda a "system" to replicate Aghanim's Ultimate improvement as in Dota for several heroes)
In what part of the triggers are you considering that you're not making it a global variable?
Also, what the hell is this:
JASS:
    set udg_Aghanim_Trigger_NEW[5] = gg_trg_Frozen_Orb_Aghanim
    set udg_Aghanim_Trigger_OLD[5] = gg_trg_Frozen_Orb
Why is it in index 5? why not 1 2 3 4? Maybe that's why it isn't doing anything.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
1) Make sure this is even being called: Trig_Aghanim_Initialisation_Actions

2) Why bother using Jass at all here?
  • Custom script: call EnableTrigger(udg_Aghanim_Trigger_NEW[udg_Aghanim_Index])
  • Custom script: call DisableTrigger(udg_Aghanim_Trigger_NEW[udg_Aghanim_Index])
Just use the GUI Turn off/Turn on functions.

If the GUI functions don't work then those variables aren't set. The Jass versions should probably work as well so it's probably the same problem.

Also, this seems unnecessary. You can simply add a Condition to check if the Caster has Aghanims in both of your Frozen Orb and Frozen Orb Aghanim triggers.
 
Level 12
Joined
May 16, 2020
Messages
660
Make sure the triggers can actually reach and execute the that.

Well that's where I believe the problem lies. In GUI, if I disable "Initially on" (= make the trigger grey), I can still select it with "Turn on trigger". If I disable it however (make it crossed out and red), it doesn't even appear on the list (in GUI).

In what part of the triggers are you considering that you're not making it a global variable?

I don't want to make 1 global variable for "damage", "distance", "speed", "stun" or whatever other attribute I want to improve on the ultimate. By turning on/off a separate trigger, I can store all these additional enhancements within the enchaned ultimate. Not sure if that is clear, but I can attach my map to make it clearer.

JASS:
set udg_Aghanim_Trigger_NEW[5] = gg_trg_Frozen_Orb_Aghanim
set udg_Aghanim_Trigger_OLD[5] = gg_trg_Frozen_Orb
Why is it in index 5? why not 1 2 3 4? Maybe that's why it isn't doing anything.

That's what I meant with "This JASS code is just one example, I have in total 5 different heroes/Ultimates stored in this way:" Here the full init:

JASS:
function Trig_Aghanim_Initialisation_Actions takes nothing returns nothing
    // Lina
    set udg_Aghanim_UnitType[1] = 'H002'
    set udg_Aghanim_Ability_Original[1] = 'A007'
    set udg_Aghanim_Tooltip_NEW_Learn[1] = "Fires off a bolt of lightning at a single target, dealing critical damage. |n|n|cffffcc00Level 1|r - Deals 500 pure damage. |n|cffffcc00Level 2|r - Deals 700 pure damage. |n|cffffcc00Level 3|r - Deals 900 pure damage. |n|n|cff99ccffCooldown:|r 60/50/40 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_1[1] = "Fires off a bolt of lightning at a single enemy unit, dealing |cffFFC125500 pure damage|r. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_2[1] = "Fires off a bolt of lightning at a single enemy unit, dealing |cffFFC125700 pure damage|r. |n|n|cff99ccffCooldown:|r 50 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_3[1] = "Fires off a bolt of lightning at a single enemy unit, dealing |cffFFC125900 pure damage|r. |n|n|cff99ccffCooldown:|r 40 seconds"
    set udg_Aghanim_SFX_Placement_1[1] = "left hand"
    set udg_Aghanim_SFX_Placement_2[1] = "right hand"
    set udg_Aghanim_SFX_Effect[1] = "Abilities\\Weapons\\WitchDoctorMissile\\WitchDoctorMissile.mdl"
    set udg_Aghanim_Trigger_NEW[1] = gg_trg_Laguna_Blade
    set udg_Aghanim_Cooldown_OLD_Level_1[1] = 70
    set udg_Aghanim_Cooldown_OLD_Level_2[1] = 60
    set udg_Aghanim_Cooldown_OLD_Level_3[1] = 50
    set udg_Aghanim_Cooldown_NEW_Level_1[1] = 60
    set udg_Aghanim_Cooldown_NEW_Level_2[1] = 50
    set udg_Aghanim_Cooldown_NEW_Level_3[1] = 40

    // Twin Headed Dragon
    set udg_Aghanim_UnitType[2] = 'H00B'
    set udg_Aghanim_Ability_Original[2] = 'A06R'
    set udg_Aghanim_Tooltip_NEW_Learn[2] = "Jakiro conjures several pillars of flame in front of him, which deal damage per second to any enemy units caught in the fire. As the pillars of flame subside, units within the fire continue taking moderate damage per second. The path lasts 15 seconds.|n|n|cffffcc00Level 1|r - Deals 140/105 damage per second. |n|cffffcc00Level 2|r - Deals 180/135 damage per second. |n|cffffcc00Level 3|r - Deals 220/165 damage per second. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_1[2] = "Jakiro conjures several pillars of flame in front of him, which deal |cff00BFFF140 magic damage|r per second to any enemy units caught in the fire. As the pillars of flame subside, units within the fire continue taking |cff00BFFF105 magic damage|r per second. The path lasts 15 seconds. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_2[2] = "Jakiro conjures several pillars of flame in front of him, which deal |cff00BFFF180 magic damage|r per second to any enemy units caught in the fire. As the pillars of flame subside, units within the fire continue taking |cff00BFFF135 magic damage|r per second. The path lasts 15 seconds. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_3[2] = "Jakiro conjures several pillars of flame in front of him, which deal |cff00BFFF220 magic damage|r per second to any enemy units caught in the fire. As the pillars of flame subside, units within the fire continue taking |cff00BFFF165 magic damage|r per second. The path lasts 15 seconds. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_SFX_Placement_1[2] = "head"
    set udg_Aghanim_SFX_Placement_2[2] = "XXX"
    set udg_Aghanim_SFX_Effect[2] = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeDamageTarget.mdl"
    set udg_Aghanim_Trigger_NEW[2] = gg_trg_Macropyre_Aghanim
    set udg_Aghanim_Trigger_OLD[2] = gg_trg_Macropyre
    set udg_Aghanim_Cooldown_OLD_Level_1[2] = 60
    set udg_Aghanim_Cooldown_OLD_Level_2[2] = 60
    set udg_Aghanim_Cooldown_OLD_Level_3[2] = 60
    set udg_Aghanim_Cooldown_NEW_Level_1[2] = 60
    set udg_Aghanim_Cooldown_NEW_Level_2[2] = 60
    set udg_Aghanim_Cooldown_NEW_Level_3[2] = 60

    // Queen of Pain
    set udg_Aghanim_UnitType[3] = 'U004'
    set udg_Aghanim_Ability_Original[3] = 'A021'
    set udg_Aghanim_Tooltip_NEW_Learn[3] = "Creates a gigantic wave of sound which deals heavy damage to all units in its wake and pushes them back.|n|n|cffffcc00Level 1|r - Deals 410 damage. |n|cffffcc00Level 2|r - Deals 560 damage.  |n|cffffcc00Level 3|r - Deals 710 damage. |n|n|cff99ccffCooldown:|r 40 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_1[3] = "Creates a gigantic wave of sound in front of Queen of Pain, dealing |cffFFC125410 pure damage|r to all enemy units in its wake and |cffc2a56fpushing|r them back. |n|n|cff99ccffCooldown:|r 40 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_2[3] = "Creates a gigantic wave of sound in front of Queen of Pain, dealing |cffFFC125560 pure damage|r to all enemy units in its wake and |cffc2a56fpushing|r them back. |n|n|cff99ccffCooldown:|r 40 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_3[3] = "Creates a gigantic wave of sound in front of Queen of Pain, dealing |cffFFC125710 pure damage|r to all enemy units in its wake and |cffc2a56fpushing|r them back. |n|n|cff99ccffCooldown:|r 40 seconds"
    set udg_Aghanim_SFX_Placement_1[3] = "left hand"
    set udg_Aghanim_SFX_Placement_2[3] = "right hand"
    set udg_Aghanim_SFX_Effect[3] = "Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl"
    set udg_Aghanim_Trigger_NEW[3] = gg_trg_Sonic_Wave_Aghanim
    set udg_Aghanim_Trigger_OLD[3] = gg_trg_Sonic_Wave
    set udg_Aghanim_Cooldown_OLD_Level_1[3] = 125
    set udg_Aghanim_Cooldown_OLD_Level_2[3] = 125
    set udg_Aghanim_Cooldown_OLD_Level_3[3] = 125
    set udg_Aghanim_Cooldown_NEW_Level_1[3] = 40
    set udg_Aghanim_Cooldown_NEW_Level_2[3] = 40
    set udg_Aghanim_Cooldown_NEW_Level_3[3] = 40

    // Lord of Olympia
    set udg_Aghanim_UnitType[4] = 'H00V'
    set udg_Aghanim_Ability_Added[4] = 'A01L'
    set udg_Aghanim_SFX_Placement_1[4] = "weapon"
    set udg_Aghanim_SFX_Effect[4] = "Abilities\\Spells\\Orc\\LightningBolt\\LightningBoltMissile.mdl"
    set udg_Aghanim_Trigger_NEW[4] = gg_trg_Nimbus

    // The Northwind
    set udg_Aghanim_UnitType[5] = 'H000'
    set udg_Aghanim_Ability_Original[5] = 'A000'
    set udg_Aghanim_Tooltip_NEW_Learn[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts dealing damage at nearby enemy units and slowing them for 4 seconds. |n|n|cffffcc00Level 1|r - Deals 40 damage per bolt. |n|cffffcc00Level 2|r - Deals 100 damage per bolt. |n|cffffcc00Level 3|r - Deals 160 damage per bolt. |n|n|cff99ccffCooldown:|r 80/70/60 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_1[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts. Each bolt deals |cff00BFFF40 magic damage|r to nearby enemies and |cff97FFFFslows|r them for 4 seconds. |n|n|cff99ccffCooldown:|r 80 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_2[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts. Each bolt deals |cff00BFFF100 magic damage|r to nearby enemies and |cff97FFFFslows|r them for 4 seconds. |n|n|cff99ccffCooldown:|r 70 seconds"
    set udg_Aghanim_Tooltip_NEW_Level_3[5] = "Coalesces a frozen orb from the air, shredding an area with freezing bolts. Each bolt deals |cff00BFFF160 magic damage|r to nearby enemies and |cff97FFFFslows|r them for 4 seconds. |n|n|cff99ccffCooldown:|r 60 seconds"
    set udg_Aghanim_SFX_Placement_1[5] = "weapon"
    set udg_Aghanim_SFX_Placement_2[5] = "XXX"
    set udg_Aghanim_SFX_Effect[5] = "Abilities\\Weapons\\LichMissile\\LichMissile.mdl"
    set udg_Aghanim_Trigger_NEW[5] = gg_trg_Frozen_Orb_Aghanim
    set udg_Aghanim_Trigger_OLD[5] = gg_trg_Frozen_Orb
    set udg_Aghanim_Cooldown_OLD_Level_1[5] = 120
    set udg_Aghanim_Cooldown_OLD_Level_2[5] = 110
    set udg_Aghanim_Cooldown_OLD_Level_3[5] = 100
    set udg_Aghanim_Cooldown_NEW_Level_1[5] = 80
    set udg_Aghanim_Cooldown_NEW_Level_2[5] = 70
    set udg_Aghanim_Cooldown_NEW_Level_3[5] = 60

endfunction

//===========================================================================
function InitTrig_Aghanim_Initialisation takes nothing returns nothing
    set gg_trg_Aghanim_Initialisation = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Aghanim_Initialisation, function Trig_Aghanim_Initialisation_Actions )
endfunction


1) Make sure this is even being called: Trig_Aghanim_Initialisation_Actions

2) Why bother using Jass at all here?
  • page.gif
    Custom script: call EnableTrigger(udg_Aghanim_Trigger_NEW[udg_Aghanim_Index])
  • page.gif
    Custom script: call DisableTrigger(udg_Aghanim_Trigger_NEW[udg_Aghanim_Index])
Just use the GUI Turn off/Turn on functions.

If the GUI functions don't work then those variables aren't set. The Jass versions should probably work as well so I think it's never set in the first place.

1) To which line are you referring with Trig_Aghanim_Initialisation_Actions?

2) I used GUI before, but I hoped by using JASS, I can circumvent the "grey/red" problem (see the first response in this comment).

But so I guess in JASS there is no way to have a trigger in the "turned off state" upon loading a map (=the "initially on" disabled state)?


***

Here the map if you guys want to test. The heroes to test are on the top left (the Chimera, Sorceress, and Reaver). You will need to add the item "Aghanim's Scepter" to the map (for some reason it always gets deleted when loading the map fresh)
 

Attachments

  • Land of Legends v0.2.03.w3m
    80.7 MB · Views: 24
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Trig_Aghanim_Initialisation_Actions is the name of the function that is called when your trigger fires:
call TriggerAddAction( gg_trg_Aghanim_Initialisation, function Trig_Aghanim_Initialisation_Actions )

If this function is never called then those Actions never run. It's like having a GUI trigger with no Events, the Actions won't run until an Event sets them off.

You should confirm that these variables are even being set (function is called and actions are running). You can debug with Text Messages by putting a message at the end of the function. If this message doesn't appear then you know something went wrong.

And this should work the same as Initially Off:
vJASS:
set yourTrig = CreateTrigger()
call DisableTrigger(yourTrig)
 
Level 12
Joined
May 16, 2020
Messages
660
Trig_Aghanim_Initialisation_Actions is the name of the function that is called when your trigger fires:
call TriggerAddAction( gg_trg_Aghanim_Initialisation, function Trig_Aghanim_Initialisation_Actions )

If this function is never called then those Actions never run. It's like having a GUI trigger with no Events, the Actions won't run until an Event sets them off.

It does fire correctly. For all GUI spells which are referenced in the init table, the tooltips/cooldowns/effects/new spells etc. get correctly adjusted as soon as I pick up the item. However, for this JASS spell it doesn't...

And this should work the same as Initially Off:
vJASS:
set yourTrig = CreateTrigger()
call DisableTrigger(yourTrig)

Ok, so I guess you suggest to leave both JASS spells on, but turn one off via trigger on initializing the map?

1622822228867.png


The problem: They simply refuse to turn off >_>

I tried the disable via JASS and GUI trigger on map initialization or after 0.1 sec, but both triggers still stay on:

  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Custom script: call DisableTrigger( gg_trg_Frozen_Orb )
      • Custom script: call DisableTrigger( gg_trg_Frozen_Orb_Aghanim )
      • Trigger - Turn off Frozen Orb <gen>
      • Trigger - Turn off Frozen Orb Aghanim <gen>
 
Level 12
Joined
May 16, 2020
Messages
660
I'm quite sure that I don't turn it on somewhere, as I never touched this JASS spell with my GUI triggering so far...

But as a workaround:
Would you be able to help please adjust the original JASS trigger to include an IF statement?

Basically I want to add the following IF statement to where the global configuration of the values happens, so that DAMAGE_BASE, DAMAGE_INC and ORB_RANGE are adjusted if the caster holds the item 'schl'.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • UNIT XXX has an item of type Aghanim's Scepter ('schl') Equal to False
    • Then - Actions
      • Set IMPACT_DAMAGE_BASE = 35
      • Set IMPACT_DAMAGE_INC = 45
      • Set ORB_RANGE = 1200
    • Else - Actions
      • Set IMPACT_DAMAGE_BASE = 45
      • Set IMPACT_DAMAGE_INC = 55
      • Set ORB_RANGE = 1600

JASS:
library FrozenOrb initializer Init requires xebasic
    //------------------------------------------------------<>
    // 'FROZEN ORB'
    //
    // Submitted by Eccho   2010-02-05 (1.0)
    //                      2010-02-15 (1.01)
    // Changelog can be found at the official submission post
    // at
    // http://www.hiveworkshop.com/forums/spells-569/frozen-orb-v1-0-a-158026/
    //
    // Give credits if used!!
    //------------------------------------------------------<>
  
    //------------------------------------------------------<>
    // 'Introduction'
    //
    // The reason why I did this spell is because I have not
    // seen yet any frozen orb spell which is properly
    // functional, or that I think does not look diablo 2'ish
    // enough (Vexorian made a frozen orb spell, I know, but
    // it isn't working at all anymore. This spell was indeed
    // an interpretation of the sorceress' spell Frozen Orb
    // in Diablo 2.
    //
    // A small note before I continue, due to some
    // complications with vJass I did not manage certain
    // things I had in mind in the beginning. The code may
    // indeed (the callback especially) be written in
    // another way, and I tried that, and failed.
    // Suggestions are welcome.
    //
    // A second note is that, frozen orb by default demands
    // some attention in the memory. Casting this multiply
    // times in a row without a cooldown, is going to have
    // some consequences. This is nothing I can change.
    // Adapt the XE_ANIMATION_PERIOD if needed.
    //
    // Third note is, you will not be able to control the
    // amount of bolts spawned while the orb is alive. These
    // are only depending on the animation period. This is
    // also how Diablo 2 handles Frozen Orb. Each bolt is
    // released each frame until the orb vanishes.
    //
    // 'Implementation instructions'
    //
    // First of all, you will need this library and the
    //  xebasic library. Copy these to your map.
    //
    // Second, you need the Universal Dummy unit found in the
    //  unit editor. Don't forget to import the dummy.mdx and
    //  set the dummy to use it as a model.
    //
    // Important: In order to apply the slow
    //  buff to the affected unit, make sure the universal
    //  dummy has:
    //   A cooldown time > 0
    //   Damage base != 0 (default -1)
    //   Damage die > 0 (default 1)
    //   A fast projectile speed
    //   A decent range
    //   Targets allowed - At least 'ground'
    //   Weapon type - missile
    //   Attack 1 enabled
    //   (if the unit does not have a movement speed, add it)
    //   And the usual stuff
    //
    // Next copy the ability which will cast the spell, and
    // the ability which will apply the buff, and modify the
    // rawcode id's in the constants below. Don't forget to
    // make sure the dummy unit id in the xebasic library is
    // set right as well.
    //
    // 'Credits'
    //
    // Vexorian - JassHelper, xebasic
    // PitzerMike & MindWorX - JNGP
    // Blizzard - Once again for some tooltip inspiration.
    //
    // Give proper credits if used!!
    //------------------------------------------------------<>
  
    //------------------------------------------------------<>
    // 'Native including'
    //
    // If you have this in your code somewhere else,
    // make sure to not double define it.
    //------------------------------------------------------<>

    native UnitAlive takes unit id returns boolean
  
  
    //------------------------------------------------------<>
    // 'Configuration section'
    //
    // Change the spell to fit your needs.
    //------------------------------------------------------<>
  
    globals
        private constant integer   ABILITY_ID              = 'A000'       //The ability triggering the spell
        private constant integer   FROST_SLOW_ID           = 'A001'       //The ability containing the frost attack. It the duration isn't altered of the already existing one in wc3, use that id instead.
        private constant integer   FROST_SLOW_BUFF         = 'Bfro'       //The buff which is used in the slow attack ability
                                                                          
                                                                          //Art of the main orb unit
        private constant string    ORB_ART                 = "war3mapImported\\FrostOrb.mdx"
                                                                          //"Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl"
        private constant integer   ORB_SPEED               = 400          //Max travel speed
        private constant integer   ORB_RANGE               = 1200         //Max travel distance
        private constant integer   ORB_RADIUS              = 128          //The radius the orb has. It is required as a polar projection offset when the orb explodes in the end
        private constant integer   ORB_HEIGHT              = 72           //The z-height from the ground the orb will travel (was 48)
        private constant real      ORB_SCALE               = 0.6          //The size/scaling of the orb (I believe the current model have some issues here, but it works with other models)
                                                                          // 2.0

                                                                            //Art of the released bolts. The bolts released when the orb explodes uses this art too.
        private constant string    MISSILE_ART             = "Abilities\\Weapons\\LichMissile\\LichMissile.mdl"
        private constant integer   MISSILE_SPEED           = 365          //...
                                                                          // 370
        private constant integer   MISSILE_RANGE           = 400          //...
        private constant integer   MISSILE_RADIUS          = 32           //Bolt radius. It is used to check the collision of which enemies the bolts will hit and damage.
        private constant integer   MISSILE_HEIGHT          = 72           //...
        private constant real      MISSILE_SCALE           = 0.5          //...
        private constant real      MISSILE_RAD_OFFSET      = 3*bj_PI/5    //Each bolt is released with a certain angle offset (in radians), and is defined by this constant. Each bolt is added this constant + the previous angle.
        private constant integer   MISSILE_AMOUNT_MAX      = 100          //Keep this constant at a secure amount. The spell could go very wrong if this value is less than the maximum amount of bolts released. 100 is used by default.
      
        private constant integer   ORB_EXPLODE_AMOUNT      = 32           //Amount of bolts released when the orb explodes
        private constant integer   ORB_EXPLODE_SPEED       = 900          //Special bolt travel speed
        private constant integer   ORB_EXPLODE_RANGE       = 900          //Special bolt travel distance
      
                                                                          //If a unit shatters, this effect will be created at it's position
        private constant string    IMPACT_SHATTER_ART      = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
        private constant integer   IMPACT_SHATTER_PER_BASE = 0            //Percental base chance to shatter a unit which dies from the spell
        private constant integer   IMPACT_SHATTER_PER_INC  = 0            //Percental increament chance per level to shatter a unit which dies from the spell (example, if base is 8 and incr is 4, each level adds 4 chance)
        private constant integer   IMPACT_DAMAGE_BASE      = 35           //Base damage
        private constant integer   IMPACT_DAMAGE_INC       = 45           //Increamental damage (works in the same way as the shatter base/incr fields)
                                                                          
                                                                            
        private constant attacktype ATTACK_TYPE             = ATTACK_TYPE_NORMAL 
        private constant damagetype DAMAGE_TYPE             = DAMAGE_TYPE_MAGIC
        private constant weapontype WEAPON_TYPE             = WEAPON_TYPE_WHOKNOWS
    endglobals
  
    //------------------------------------------------------<>
    // 'Damage filter'
    //
    // Add more options as desired.
    // Some info: It is used as a condition not a boolexpr,
    // thus, not going to give any issue with IsUnitType.
    //------------------------------------------------------<> 
  
    private function TargetFilter takes unit enemy, player caster, real x, real y returns boolean
        return UnitAlive(enemy) and IsUnitEnemy(enemy, caster) and IsUnitInRangeXY(enemy, x, y, MISSILE_RADIUS) and not IsUnitType(enemy, UNIT_TYPE_STRUCTURE)
    endfunction
  
    //------------------------------------------------------<>
    // 'Shatter filter'
    //
    // Add more options as desired.
    // It determines the units which may shatter
    // The filter does not need to contain the same context
    // as the damage filter. It is only potentially ran after
    // the target filter have became true.
    //------------------------------------------------------<>
  
    private function ShatterFilter takes unit enemy returns boolean
        return not IsUnitType(enemy, UNIT_TYPE_MECHANICAL) and not IsUnitType(enemy, UNIT_TYPE_HERO) and not IsUnitType(enemy, UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(enemy, UNIT_TYPE_STRUCTURE)
    endfunction
  
    //------------------------------------------------------<>
    // 'Other constants'
    //
    // These should not be altered by default, but if you
    // know what you are doing, or see a way to use other
    // constants instead, feel free.
    //------------------------------------------------------<>
  
    globals
        private constant real      ORB_TMAX                = 1.0*ORB_RANGE/ORB_SPEED
        private constant real      MISSILE_TMAX            = 1.0*MISSILE_RANGE/MISSILE_SPEED
        private constant real      EXPLODE_TMAX            = 1.0*ORB_EXPLODE_RANGE/ORB_EXPLODE_SPEED
        private constant real      RAD_BETWEEN_EXPL        = bj_PI*2/ORB_EXPLODE_AMOUNT
      
        private constant group     ENUM_GROUP              = CreateGroup()
        private constant timer     ANIM_TIMER              = CreateTimer()
    endglobals
  
    //------------------------------------------------------<>
    // 'Spell code'
    //
    // If you even think up of an optimize fully working
    // version, tell me about it.
    //------------------------------------------------------<>
  
    private struct missile
        unit obj
        effect art
        real sx
        real sy
        real xvel
        real yvel
      
        static method create takes string art, player p, real x, real y, real z, real rad, integer speed, real scale returns thistype
            local thistype this = thistype.allocate()
          
            set this.obj = CreateUnit(p, XE_DUMMY_UNITID, x, y, rad*bj_RADTODEG)
            call UnitAddAbility(this.obj, XE_HEIGHT_ENABLER)
            call UnitRemoveAbility(this.obj, XE_HEIGHT_ENABLER)
            call SetUnitFlyHeight(this.obj, z, 0)
            call SetUnitScale(this.obj, scale, scale, scale)
            call SetUnitAnimationByIndex(this.obj, 90)
            call UnitRemoveAbility(this.obj, 'Aatk')
          
            set this.art = AddSpecialEffectTarget(art, this.obj, "origin")
            set this.sx = x
            set this.sy = y
            set this.xvel = speed*Cos(rad)
            set this.yvel = speed*Sin(rad)
          
            return this
        endmethod
      
        method clear takes nothing returns nothing
            call DestroyEffect(this.art)
            call KillUnit(this.obj)
            set this.art = null
            set this.obj = null
        endmethod
    endstruct
  
    private struct spell
        missile orb
        real otick
      
        missile array mis[MISSILE_AMOUNT_MAX]
        real array mtick[MISSILE_AMOUNT_MAX]
        integer mcount
        integer mtot
      
        missile array xpl[ORB_EXPLODE_AMOUNT]
        real xtick //All exploding missiles have the same tickoffset

        unit caster
        player owner
        integer damage
        integer chance
      
        static thistype array tta
        static integer tot = 0
      
        static method callback takes nothing returns nothing
            local thistype this
            local missile m
            local integer i = 0
            local integer j
            local integer k
            local real x
            local real y
            local unit u
            local unit v
          
            loop
                exitwhen (i >= thistype.tot)
                set this = thistype.tta[i]
              
              
                //Bolts goes here
                set j = 0
                loop
                    exitwhen (j >= this.mtot)
                  
                    if (this.mis[j].obj != null) then
                        set this.mtick[j] = this.mtick[j]+XE_ANIMATION_PERIOD
                        set x = this.mis[j].sx+this.mis[j].xvel*this.mtick[j]
                        set y = this.mis[j].sy+this.mis[j].yvel*this.mtick[j]
                      
                        call GroupEnumUnitsInRange(ENUM_GROUP, x, y, XE_MAX_COLLISION_SIZE+MISSILE_RADIUS, null)
                        loop
                            set u = FirstOfGroup(ENUM_GROUP)
                            exitwhen (u == null)
                            call GroupRemoveUnit(ENUM_GROUP, u)
                            exitwhen (TargetFilter(u, this.owner, x, y))
                        endloop
                      
                                                                //A nice BJ, wrapped anyway
                        if (this.mtick[j] <= MISSILE_TMAX and RectContainsCoords(bj_mapInitialPlayableArea, x, y) and u == null) then
                            call SetUnitX(this.mis[j].obj, x)
                            call SetUnitY(this.mis[j].obj, y)
                      

                        else
                          
                          
                            if (u != null) then
                              
                                call UnitDamageTarget(this.caster, u, this.damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
                                  
                                if (UnitAlive(u)) then
                                    if (GetUnitAbilityLevel(u, FROST_SLOW_BUFF) == 0) then
                                  
                                        set v = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), XE_DUMMY_UNITID, x, y, 0)
                                        call UnitAddAbility(v, FROST_SLOW_ID)
                                        call UnitApplyTimedLife(v, 'BTLF', 1.0)
                                        call IssueTargetOrder(v, "attackonce", u)
                                    endif
                                elseif (GetRandomInt(0, 100) <= this.chance and ShatterFilter(u)) then

                                    call DestroyEffect(AddSpecialEffect(IMPACT_SHATTER_ART, x, y))
                                    call RemoveUnit(u)
                                endif
                            endif
                          
                            //A note - instances are not destroyed until the end of the spell, when all instances are properly cleared.
                            call this.mis[j].clear()
                            set this.mcount = this.mcount-1

                        endif
                    endif
                  
                    set j = j+1
                endloop

              
                //Orb goes here
                if (this.orb.obj != null) then
                    set this.otick = this.otick+XE_ANIMATION_PERIOD
                    set x = this.orb.sx+this.orb.xvel*this.otick
                    set y = this.orb.sy+this.orb.yvel*this.otick
                  
                    if (this.otick < ORB_TMAX and RectContainsCoords(bj_mapInitialPlayableArea, x, y)) then
                        call SetUnitX(this.orb.obj, x)
                        call SetUnitY(this.orb.obj, y)
                      
                      
                        set this.mis[this.mtot] = missile.create(MISSILE_ART, this.owner, x, y, MISSILE_HEIGHT, this.mtot*MISSILE_RAD_OFFSET, MISSILE_SPEED, MISSILE_SCALE)
                        set this.mtick[this.mtot] = 0
                        set this.mcount = this.mcount+1
                        set this.mtot = this.mtot+1

                      
                    else
                        //Clears the orb
                        call this.orb.clear()
                      
                        //Proceeds with creating special bolts, aka bolts released when the orb vanishes.
                        set j = 0
                        loop
                            exitwhen (j >= ORB_EXPLODE_AMOUNT)
                            set this.xpl[j] = missile.create(MISSILE_ART, this.owner, x+ORB_RADIUS*Cos(j*RAD_BETWEEN_EXPL), y+ORB_RADIUS*Sin(j*RAD_BETWEEN_EXPL), MISSILE_HEIGHT, j*RAD_BETWEEN_EXPL+bj_PI*0.25, ORB_EXPLODE_SPEED, MISSILE_SCALE)
                            set j = j+1
                        endloop
                        set this.xtick = 0
                      
                    endif
                else
              
                    //Special bolt stuff goes here
                    set this.xtick = this.xtick+XE_ANIMATION_PERIOD
                  
                    set j = 0
                    loop
                        exitwhen (j >= ORB_EXPLODE_AMOUNT)
                          
                        if (this.xpl[j].obj != null) then
                            set x = this.xpl[j].sx+this.xpl[j].xvel*this.xtick
                            set y = this.xpl[j].sy+this.xpl[j].yvel*this.xtick
                          
                          
                            call GroupEnumUnitsInRange(ENUM_GROUP, x, y, XE_MAX_COLLISION_SIZE+MISSILE_RADIUS, null)
                            loop
                                set u = FirstOfGroup(ENUM_GROUP)
                                exitwhen (u == null)
                                call GroupRemoveUnit(ENUM_GROUP, u)
                                exitwhen (TargetFilter(u, this.owner, x, y))
                            endloop
                          
                            if (this.xtick < EXPLODE_TMAX and RectContainsCoords(bj_mapInitialPlayableArea, x, y) and u == null) then
                                call SetUnitX(this.xpl[j].obj, x)
                                call SetUnitY(this.xpl[j].obj, y)
                                  
                            else
                              
                                if (u != null) then
                                  
                                    call UnitDamageTarget(this.caster, u, this.damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
                                      
                                    if (UnitAlive(u)) then
                                        if (GetUnitAbilityLevel(u, FROST_SLOW_BUFF) == 0) then

                                            set v = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), XE_DUMMY_UNITID, x, y, 0)
                                            call UnitAddAbility(v, FROST_SLOW_ID)
                                            call UnitApplyTimedLife(v, 'BTLF', 1.0)
                                            call IssueTargetOrder(v, "attackonce", u)
                                        endif
                                    elseif (GetRandomInt(0, 100) <= this.chance and ShatterFilter(u)) then

                                        call DestroyEffect(AddSpecialEffect(IMPACT_SHATTER_ART, x, y))
                                        call RemoveUnit(u)
                                    endif
                                endif
                              
                                //Clears a special bolt
                                call this.xpl[j].clear()
                            endif
                        endif
                        set j = j+1
                    endloop
                  
                endif
              
                //Completely destroys the spell and all instances
                if (this.mcount == 0 and this.orb.obj == null and this.xtick >= ORB_TMAX) then
                  
                    set j = 0
                    loop
                        exitwhen (j >= this.mcount)
                        call this.mis[j].destroy()
                        set j = j+1
                    endloop
                    set j = 0
                    loop
                        exitwhen (j >= ORB_EXPLODE_AMOUNT)
                        call this.xpl[j].destroy()
                        set j = j+1
                    endloop
                  
                    call this.orb.destroy()
                    call this.destroy()
                    set this.caster = null
                    set thistype.tot = thistype.tot-1
                    set thistype.tta[i] = thistype.tta[thistype.tot]
                  
                  
      
                    if (thistype.tot == 0) then
                        call PauseTimer(ANIM_TIMER)
                    endif
                  
                else
                    set i = i+1
                endif
            endloop
            set v = null
        endmethod
      
        static method create takes unit su, real tx, real ty returns thistype
            local thistype this = thistype.allocate()
            local real x = GetUnitX(su)
            local real y = GetUnitY(su)
            local integer level = GetUnitAbilityLevel(su, ABILITY_ID)
          
            set this.caster = su
            set this.owner = GetOwningPlayer(su)
            set this.orb = missile.create(ORB_ART, this.owner, x, y, ORB_HEIGHT, Atan2(ty-y, tx-x), ORB_SPEED, ORB_SCALE)
            set this.otick = 0
            set this.mcount = 0
            set this.mtot = 0
            set this.damage = IMPACT_DAMAGE_BASE+IMPACT_DAMAGE_INC*(level-1)
            set this.chance = IMPACT_SHATTER_PER_BASE+IMPACT_SHATTER_PER_INC*(level-1)
          
            set thistype.tta[thistype.tot] = this
          
            if (thistype.tot == 0) then
                call TimerStart(ANIM_TIMER, XE_ANIMATION_PERIOD, true, function thistype.callback)
            endif
          
            set thistype.tot = thistype.tot+1
          
            return this
        endmethod
      
    endstruct
  
    private function Evaluate takes nothing returns boolean
        if (GetSpellAbilityId() == ABILITY_ID) then
            call spell.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
        endif
        return false
    endfunction
  
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Filter(function Evaluate))
    endfunction

endlibrary
 
Status
Not open for further replies.
Top