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

How to?

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
If you only have 1 hero (or unit that can use that ability), you can use
JASS:
call SetPlayerAbilityAvailable( Player, AbilityId, boolean )
"Player" is the owning player of the caster. You can use a variable for this.
"AbilityId" is the raw ID of the spell (such as 'AHds' for divine shield, or 'A001' for a custom ability).
Boolean is a boolean (true or false): false = ability is disabled, true = ability is enabled.

This will effectively remove the ability while not messing with the cooldown.

Example:
  • Remove Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: call SetPlayerAbilityAvailable( Player(0), 'AHds', false )
      • Wait 5.00 seconds
      • Custom script: call SetPlayerAbilityAvailable( Player(0), 'AHds', true )
This will remove the divine-shield ability for Player(0) ( = red ).
After 5 seconds, the ability will be enabled again.


Variables:
  • "player" - Player variable.
  • "abilityId" - Integer variable

  • Remove Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local integer udg_abilityId = GetSpellAbilityId( )
      • Custom script: local player udg_player = GetTriggerPlayer( )
      • Custom script: call SetPlayerAbilityAvailable( udg_player, udg_abilityId, false )
      • Wait 5.00 seconds
      • Custom script: call SetPlayerAbilityAvailable( udg_player, udg_abilityId, true )
      • Custom script: set udg_player = null
Note that this is MUI!

You don't have to change the basics of this too much: the variables will automatically be set to the correct values (the ID of the spell and the triggering player).
This is already MUI due to the local-trick. You can add conditions for the spells you want to change, that should be all.


(I hope I got all of this correct, I'm in a bit of a hurry :p).
 
Level 1
Joined
Sep 10, 2012
Messages
4
If you only have 1 hero (or unit that can use that ability), you can use
JASS:
call SetPlayerAbilityAvailable( Player, AbilityId, boolean )
"Player" is the owning player of the caster. You can use a variable for this.
"AbilityId" is the raw ID of the spell (such as 'AHds' for divine shield, or 'A001' for a custom ability).
Boolean is a boolean (true or false): false = ability is disabled, true = ability is enabled.

This will effectively remove the ability while not messing with the cooldown.

Example:
  • Remove Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: call SetPlayerAbilityAvailable( Player(0), 'AHds', false )
      • Wait 5.00 seconds
      • Custom script: call SetPlayerAbilityAvailable( Player(0), 'AHds', true )
This will remove the divine-shield ability for Player(0) ( = red ).
After 5 seconds, the ability will be enabled again.


Variables:
  • "player" - Player variable.
  • "abilityId" - Integer variable

  • Remove Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local integer udg_abilityId = GetSpellAbilityId( )
      • Custom script: local player udg_player = GetTriggerPlayer( )
      • Custom script: call SetPlayerAbilityAvailable( udg_player, udg_abilityId, false )
      • Wait 5.00 seconds
      • Custom script: call SetPlayerAbilityAvailable( udg_player, udg_abilityId, true )
      • Custom script: set udg_player = null
Note that this is MUI!

You don't have to change the basics of this too much: the variables will automatically be set to the correct values (the ID of the spell and the triggering player).
This is already MUI due to the local-trick. You can add conditions for the spells you want to change, that should be all.


(I hope I got all of this correct, I'm in a bit of a hurry :p).


  • Player - Disable Abillity for Player X
this is what i used :D cuz afaik setplayerability and disable/enable ability is the same :D btw thanks for helping :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Why the hard work for him when you have this ?
  • Player - Disable Abillity for Player X
Player - Enable/Disable Ability

Because my GUI is getting a bit sloppy? :D
(Besides, "hard work"? You're making it sound as if GUI is easier than JASS :wink:. Both functions are 1 line each, so there's no difference in that either).
The local variables are for making it MUI, which cannot be done in GUI in any easy way.
 
Status
Not open for further replies.
Top