| 01-01-2009, 08:51 AM | #1 |
I have been out of the wc3 loop for awhile, but still I dont see why this doesn't work; Code:
function HideAbility takes integer sid returns nothing
call SetPlayerAbilityAvailable(GetLocalPlayer(), sid, false)
endfunction
//In a trigger on initialization.
call HideAbility('A008')I'm baffled, it doesn't work for GetLocalPlayer, Player(0), or a player loop. (1-12) I'm sure the ability ID is correct, and the ability is definantly a spellbook. I'm sure I'm missing something stupid, anyone care to point it out? Thanks, Blackroot. |
| 01-01-2009, 10:12 AM | #2 |
Maybe you need to add it to the unit first THEN HideAbility() it. |
| 01-01-2009, 12:56 PM | #3 |
At the top of the main WE screen, click on Scenario > Ability Properties. Check "Use Custom Abilities". Disable the ability for each player. They will not appear. If you ever want to make them available again, call SetPlayerAbilityAvailable( player, abilityid, true ). And if you use false now, they will disappear. EDIT: Oh, and you can even toggle basic commands like Attack, Move, etc, using this method. Basic commands are under Neutral - Units. |
| 01-01-2009, 01:44 PM | #4 |
It still should be working in your script. Could you show us the script, with the bits that don't apply cut out? |
| 01-01-2009, 02:00 PM | #5 |
I tested SetPlayerAbilityAvailable. If the ability is not disabled in Ability Properties for a player, it will be visible, clickable, and non-functional. |
| 01-01-2009, 10:59 PM | #6 |
[edit] Hahaha, why does this make the code so much mroe legible? >.< I realized I called a constant function without brackets, so it wasn't returning anything. Got it working, thanks for the help :P. Hiding the ability afterwards didin't work either. Here's the whole code: JASS:constant function ARCANE_CONCENTRATION_WRAPPER_ID takes nothing returns integer return 'A008' endfunction //On Initialization function Trig_Arcn_Init_Actions takes nothing returns nothing call HideAbility(ARCANE_CONCENTRATION_WRAPPER_ID)// call RegisterSpellLearningEvent(ARCANE_CONC_ID(), gg_trg_Arcane_Concentration_Learn) call RegisterSpellCastingEvent(ARCANE_CONC_ID(), gg_trg_Arcane_Concentration)// call RegisterSpellCastingEvent(ARCANE_BOLT_ID(), gg_trg_Arcane_Bolt) endfunction //=========================================================================== function InitTrig_Arcn_Init takes nothing returns nothing set gg_trg_Arcn_Init = CreateTrigger() call TriggerAddAction(gg_trg_Arcn_Init, function Trig_Arcn_Init_Actions) endfunction //When spell is learned: function Trig_Arcane_Concentration_Learn_Actions takes nothing returns nothing set ARCANE_CONCENTRATION_LEARNED = true call UnitAddAbility(LEARNING_EVENT_LEARNER, ARCANE_CONCENTRATION_WRAPPER_ID()) endfunction //=========================================================================== function InitTrig_Arcane_Concentration_Learn takes nothing returns nothing set gg_trg_Arcane_Concentration_Learn = CreateTrigger() call TriggerAddAction(gg_trg_Arcane_Concentration_Learn, function Trig_Arcane_Concentration_Learn_Actions) endfunction It correctly adds the ability and everything functions just fine, but the spellbook just is not being hidden. |
| 01-01-2009, 11:28 PM | #7 |
What system are you using for this? Also, use [jass] tags instead of [code] tags. |
| 01-02-2009, 07:24 AM | #8 |
I'm sure you must be doing it wrong, because this works for me: JASS:function HideAbilityEx takes integer Id returns nothing local integer J = 0 loop call SetPlayerAbilityAvailable(Player(J), Id, false) set J = J+1 exitwhen J > 11 endloop endfunction |
| 01-02-2009, 04:19 PM | #9 |
Uploaded a map that demonstrates the disabling of abilities. Spellbreaker's Spell Steal is disabled during map initialization. Type -add and give the Bloodmage a disabled spellbook. The spellbook was disabled as per the method I mentioned previously. Perhaps you have overlooked a PolledWait or TriggerSleepAction? |
| 01-03-2009, 07:33 AM | #10 |
The issue was I was calling the spell ability id constant without brackets () Unfortunantly the method I was using desyncs the game ;|. Thank you for all your help though :) |
