• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Adding an ability based on dummy ability level

Status
Not open for further replies.
Level 1
Joined
Jan 17, 2011
Messages
5
Hello. I'm trying to make a trigger that adds an ability to a Hero when that Hero uses the appropriate dummy ability, and adds one of several abilities depending on the level of the dummy ability.

Basically:

[Hero] uses [Defend], add [Evasion 1, Evasion 2, or Evasion 3] to [Hero]

Thanks in advance!

Edit: I'm not entirely sure if I should have put a prefix on the thread. I noticed the sticky that said not to, but that it was no longer in effect. Sorry if I wrongly added that. :(

Edit 2: I'm using GUI.
 
Last edited:
JASS:
private integer array abilitiesToAdd
////////////////////////
set abilitiesToAdd[1] = /*Evasion 1*/
set abilitiesToAdd[2] = /*Evasion 2*/
set abilitiesToAdd[3] = /*Evasion 3*/

//EVENT_PLAYER_UNIT_ISSUED_ORDER
////////////////////////
if (GetIssuedOrderId() == 'Adef') then //or variant
    call UnitAddAbility(GetTriggerUnit(), abilitiesToAdd[GetUnitAbilityLevel('Adef')])
endif
 
Level 1
Joined
Jan 17, 2011
Messages
5
He uses Defend, he gains new skill ?

Well, the spell is called "Defensive Stance", and it's meant to be able to be turned on/off. When on, it adds a spell based on Drunken Brawler, which would increase the Hero's chance to dodge, but give him a chance to "crit" for reduced damage.


JASS:
private integer array abilitiesToAdd
////////////////////////
set abilitiesToAdd[1] = /*Evasion 1*/
set abilitiesToAdd[2] = /*Evasion 2*/
set abilitiesToAdd[3] = /*Evasion 3*/

//EVENT_PLAYER_UNIT_ISSUED_ORDER
////////////////////////
if (GetIssuedOrderId() == 'Adef') then //or variant
    call UnitAddAbility(GetTriggerUnit(), abilitiesToAdd[GetUnitAbilityLevel('Adef')])
endif

I'm sorry, I should have mentioned that I only know how to use the default WC3 editor and its triggers. >.<
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Here's Nestharus' code in GUI:

  • Untitled Trigger 038
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Abilities[1] = Ability 1
      • Set Abilities[2] = Ability 2
      • Set Abilities[3] = Ability 3
  • Untitled Trigger 039
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(defend))
    • Actions
      • Unit - Add Abilities[(Level of Defend for (Triggering unit))] to (Triggering unit)
When ordered to undefend, remove the ability in similar fashion.
 
Level 1
Joined
Jan 17, 2011
Messages
5
Here's Nestharus' code in GUI:

  • Untitled Trigger 038
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Abilities[1] = Ability 1
      • Set Abilities[2] = Ability 2
      • Set Abilities[3] = Ability 3
  • Untitled Trigger 039
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(defend))
    • Actions
      • Unit - Add Abilities[(Level of Defend for (Triggering unit))] to (Triggering unit)
When ordered to undefend, remove the ability in similar fashion.



I can't seem to find the "Set Abilities[]..." and "(Issued order) Equal to (Order(defend)) triggers. I've tried searching for them, but haven't found anything yet.
 
Level 1
Joined
Jan 17, 2011
Messages
5
I don't have much experience with variables, so let me make sure I'm understanding you correctly...

* Create a variable and make it an array. Should the size be the same as the number of levels for Defend?

* When you set the values of the triggers, are "Ability 1", "Ability 2", and "Ability 3" the placeholders for my three different Evasion spells?

So Set Abilities[1] should = Evasion 1, and so on?

* Finally, for the issued order condition: It's checking for the Turn On order string for Defend, so I'd use the Turn Off order string when making a trigger to remove the Evasion ability, correct?

Thanks for your help and patience.
 
Status
Not open for further replies.
Top