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

[JASS] Adding/Removing Spells from Skill Points Menu

Status
Not open for further replies.
Level 2
Joined
Mar 7, 2008
Messages
8
Adding/RemovingSpellsfromSkillPointsMenu(need help)

HeroUnitID:
H01G:Hant

There's a hero that has spells with RawCodes:
A07E:ANmo ( Normal Spell ) <-- AoE Spell Thunderstorm
A04E:A0s2 ( Normal Spell ) <-- AoE Spell2 Similar to shockwave
A024:A0cl or A024:A0cI ( Normal Spell ) Hard to see. <--- The old Ulti / Chain lightning alike
RawCodes For New Spells:
A023:ANmo ( Old Spell Turned into Ulti ) Thunderstorm
A02B:ANsi ( Normal spell ) <-- Silence/Slow
A070:AUfn ( Normal Spell ) <--similar to frost nova

I need a trigger where Player(6) types a chat message ''-RevertForm''
and remove the New spells from the HeroSkillsMenuSelection and add the Other spells into the HeroSkillsMenuSelection.
All of those spells are levelable up to 4. Would this work? What am I missing?
Spell only works once because there won't be a trigger to reverse it.

JASS:
function RevertForm takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer lvl1 = GetUnitAbilityLevel(u,'A023')
local integer lvl2 = GetUnitAbilityLevel(u,'A02B')
local integer lvl3 = GetUnitAbilityLevel(u,'A070')
call UnitRemoveAbility(u,'A023')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A070')
call UnitAddAbility(u,'A07E')
call UnitAddAbility(u,'A04E')
call UnitAddAbility(u,'A024')
call SetUnitAbilityLevel(u,'A024',lvl1)
call SetUnitAbilityLevel(u,'A07E',lvl2)
call SetUnitAbilityLevel(u,'A04E',lvl3)
set u = null
call DestroyTrigger(GetTriggeringTrigger())
endfunction
function InitTrig_RevertForm takes nothing returns nothing
local trigger RF = CreateTrigger()
call TriggerRegisterPlayerChatEvent(RF,Player(6),''-RevertForm'',true) 
call TriggerAddAction(RF, function RevertForm) 
set RF = null
endfunction
 
Last edited:
Level 2
Joined
Mar 7, 2008
Messages
8
What I want is... changing the choosing spell menu to remove the existing spells from the spell menu ( hotkey O its the red cross thing you all choose spells with ) and placing the other spells into that menu instead
by a chat message




Would I need to make 4 levels for each spell?
 
Level 5
Joined
Aug 16, 2007
Messages
149
JASS:
call TriggerRegisterPlayerChatEvent(RF,Player(6),''-RevertForm'',true)
should be
JASS:
call TriggerRegisterPlayerChatEvent(RF,Player(6),"-RevertForm",true)
you used ' twice instead of one " lol.
 
Level 2
Joined
Mar 7, 2008
Messages
8
I changed the trigger to this.

It's telling me '' Expected Expression '' on the lines ( if integer x = # then )

What do I change to make it work?


Btw, if you're wondering, the first level is prepicked.
JASS:
function RevertForm takes nothing returns nothing
local unit u = gg_unit_H01G_0402
call GetUnitLevel(u)
if integer x = 2 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A07H')
call SetUnitAbilityLevel(u,'A07H',1)
if integer x = 3 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',2)
if integer x = 4 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',1)
if integer x = 5 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',3)
if integer x = 6 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',2)
if integer x = 7 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',4)
if integer x = 8 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',3)
if integer x = 9 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call UnitAddAbility(u,'A024')
call SetUnitAbilityLevel(u,'A024',1)
if integer x = 10 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A04E',4)
if integer x = 11 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',2)
if integer x = 12 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',2)
if integer x = 13 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',3)
if integer x = 14 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',3)
if integer x = 15 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',4)
endfunction
 
Level 5
Joined
Aug 16, 2007
Messages
149
omg... need to type = twice and you don't put the type of the variable in an expression... honestly your JASS knowledge is not exactly 'good'. It should be
JASS:
if x == 5 then
and is x global? Because you didn't declare it as local.
 
Level 2
Joined
Mar 7, 2008
Messages
8
I changed it to this.
JASS:
function RevertForm takes nothing returns nothing
local unit u = gg_unit_H01G_0402
local integer x = GetUnitLevel(u) 
if x == 2 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A07H')
call SetUnitAbilityLevel(u,'A07H',1)
if x == 3 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',2)
if x == 4 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',1)
if x == 5 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',3)
if x == 6 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',2)
if x == 7 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',4)
if x == 8 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',3)
if x == 9 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call UnitAddAbility(u,'A024')
call SetUnitAbilityLevel(u,'A024',1)
if x == 10 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A04E',4)
if x == 11 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',2)
if x == 12 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',2)
if x == 13 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',3)
if x == 14 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',3)
if x == 15 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',4)
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endfunction

//===========================================================================
function InitTrig_RevertForm takes nothing returns nothing
local trigger MPz1 = CreateTrigger() // creates the trigger
call TriggerRegisterPlayerChatEvent(MPz1,Player(6),"-RevertForm",true) // gives it the event
call TriggerAddAction(MPz1, function RevertForm) // gives it an action
endfunction
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
JASS:
if condition = true then
       actions
endif


This is how a If/Then should look...

If you want a If/Then/Else make it like this
JASS:
if condition = true then
       actions
elseif condition = true then
       actions
endif
// you can add as many elseif's as you want
 
Level 2
Joined
Mar 7, 2008
Messages
8
I don't get why it doesn't work after the first x=2 if my hero level is above 2.

Would I write

Is this syntax correct?
JASS:
I added a call GetUnitLevel(u) after every
JASS:
function RevertForm takes nothing returns nothing
local unit u = gg_unit_H01G_0402
local integer x = GetUnitLevel(u)
call GetUnitLevel(u) 
if x == 2 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A07H')
call SetUnitAbilityLevel(u,'A07H',1)
call GetUnitLevel(u) 
elseif x == 3 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',2)
call GetUnitLevel(u) 
elseif x == 4 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',1)
call GetUnitLevel(u) 
elseif x == 5 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',3)
call GetUnitLevel(u) 
elseif x == 6 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',2)
call GetUnitLevel(u) 
elseif x == 7 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',4)
call GetUnitLevel(u) 
elseif x == 8 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',3)
call GetUnitLevel(u) 
elseif x == 9 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call UnitAddAbility(u,'A024')
call SetUnitAbilityLevel(u,'A024',1)
call GetUnitLevel(u) 
elseif x == 10 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A04E',4)
call GetUnitLevel(u) 
elseif x == 11 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',2)
call GetUnitLevel(u) 
elseif x == 12 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',2)
call GetUnitLevel(u) 
elseif x == 13 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',3)
call GetUnitLevel(u) 
elseif x == 14 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',3)
call GetUnitLevel(u) 
elseif x == 15 true then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',4)
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endfunction

//===========================================================================
function InitTrig_RevertForm takes nothing returns nothing
local trigger MPz1 = CreateTrigger() // creates the trigger
call TriggerRegisterPlayerChatEvent(MPz1,Player(6),"-RevertForm",true) // gives it the event
call TriggerAddAction(MPz1, function RevertForm) // gives it an action
endfunction
 
Level 5
Joined
Aug 16, 2007
Messages
149
look, I have made the code so it works... kk?
JASS:
function RevertForm takes nothing returns nothing
local unit u = gg_unit_H01G_0402
local integer x = GetUnitLevel(u)
if x == 2 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A07H')
call SetUnitAbilityLevel(u,'A07H',1)
elseif x == 3 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',2)
elseif x == 4 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',1)
elseif x == 5 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',3)
elseif x == 6 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',2)
elseif x == 7 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call SetUnitAbilityLevel(u,'A07H',4)
elseif x == 8 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',3)
elseif x == 9 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call UnitAddAbility(u,'A024')
call SetUnitAbilityLevel(u,'A024',1)
elseif x == 10 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A04E',4)
elseif x == 11 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',2)
elseif x == 12 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',2)
elseif x == 13 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',3)
elseif x == 14 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A024',3)
elseif x == 15 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
call SetUnitAbilityLevel(u,'A06Z',4)
endif
endfunction
//===========================================================================
function InitTrig_RevertForm takes nothing returns nothing
local trigger MPz1 = CreateTrigger() // creates the trigger
call TriggerRegisterPlayerChatEvent(MPz1,Player(6),"-RevertForm",true) // gives it the event
call TriggerAddAction(MPz1, function RevertForm) // gives it an action
endfunction
Just use that and please don't ask any more stupid questions... It only needs 1 endif.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
You do not need multiple endif's, its a one If/Then/Else/Else/Else/Else/.etc statment and thus you need only one endif.

Now back to your problem, your unit's level is probably 2.
Your units HERO level is a whole diffrent thing.

A unit level can be also called "creep level", its that thing that tells you their levels and changes exp gain and stuff like that.

A hero level is a hero level, get it with this code
JASS:
call GetHeroLevel( your hero )


So for you example it'll be
JASS:
local x = GetHeroLevel( u )
 
Level 2
Joined
Mar 7, 2008
Messages
8
I changed the trigger to something like this.
Level 1 - Degen aura - ThunderStorm~Shockwave~Chain Lightning ( all 3 spells will have 9999 mana cost and does nothing at lvl 1 ( all abilities added to hero at level one ))
Level 2 - ThunderStorm 2 /5
Level 3 - Shockwave 2 / 5
Level 4 - ThunderStorm 3 / 5
Level 5 - Shockwave 3/5
Kind of like this I guess

How do I make a periodic timer interval of 15 secs after the -RevertForm chat message has been typed once, to run the trigger continuously until HeroLevel is equal to 15? But I also want to make
JASS:
elseif x > 1 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
for the entire game


JASS:
function RevertForm takes nothing returns nothing
local unit u = gg_unit_H01G_0402 
local integer x = GetHeroLevel(u)
call UnitAddAbility(u,'A07H')
call SetUnitAbilityLevel(u,'A07H',1)
call UnitAddAbility(u,'A04E')
call SetUnitAbilityLevel(u,'A04E',1)
call UnitAddAbility(u,'A024')
call SetUnitAbilityLevel(u,'A024',1)
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
if x == 2 then
call SetUnitAbilityLevel(u,'A07H',2)
elseif x == 3 then
call SetUnitAbilityLevel(u,'A07H',3)
elseif x == 4 then
call SetUnitAbilityLevel(u,'A04E',2)
elseif x == 5 then
call SetUnitAbilityLevel(u,'A07H',4)
elseif x == 6 then
call SetUnitAbilityLevel(u,'A04E',3)
elseif x == 7 then
call SetUnitAbilityLevel(u,'A07H',5)
elseif x == 8 then
call SetUnitAbilityLevel(u,'A04E',4)
elseif x == 9 then
call SetUnitAbilityLevel(u,'A024',2)
elseif x == 10 then
call SetUnitAbilityLevel(u,'A04E',5)
elseif x == 11 then
call SetUnitAbilityLevel(u,'A024',3)
elseif x == 12 then
call SetUnitAbilityLevel(u,'A06Z',2)
elseif x == 13 then
call SetUnitAbilityLevel(u,'A024',4)
elseif x == 14 then
call SetUnitAbilityLevel(u,'A06Z',3)
elseif x == 15 then
call SetUnitAbilityLevel(u,'A06Z',4)
elseif x > 1 then
call UnitRemoveAbility(u,'A070')
call UnitRemoveAbility(u,'A02B')
call UnitRemoveAbility(u,'A023')
endif
endfunction
//===========================================================================
function InitTrig_RevertForm takes nothing returns nothing
local trigger MPz1 = CreateTrigger() 
call TriggerRegisterPlayerChatEvent(MPz1,Player(6),"-RevertForm",true) 
call TriggerAddAction(MPz1, function RevertForm) 
endfunction
 
Status
Not open for further replies.
Top