• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Game UI]Switch between spell sets

Status
Not open for further replies.
Level 2
Joined
Apr 6, 2012
Messages
12
Hey, I'm making a hero that has two separate spell sets. Each spell set has 4 spells. She has 2 constant spells as well: Switch Tier and her ultimate (Incantation)

The problem right now is that the Switch Tier spell is supposed to toggle between the two spell sets, but it isn't working as intended. My idea of how to do this was to remove the current spells from the hero, and then add the other spell set's spells to the hero and set those abilities' levels to the levels (stored variable) of the previous spell set spells. Each spell in the first spell set corresponds to a spell in the second spell set, and levelling up either one of the "pair" will level up both. This might be a bit confusing so I'll put it into context with the first "pair" of spells:

The hero has the abilities Summer Red (first spell set) and Illumination (second spell set). However, Illumination is initially not available (it's not in the hero pallette). Initially, you start out with the first spell set available. When you use Switch Tier, Summer Red will dissappear (removed) and will be replaced with Illumination. Illumination should be the same level as the removed Summer Red. Therefore, if you level up and decide to put a skill point into Summer Red or Illumination, it will level up BOTH at the same time.

The error is that the Illumination skill doesn't show up when I use Switch Tier, and the Summer Red skill doesn't dissappear. Also, when I cast Summer Red, for some reason Switch Tier goes on cooldown as if it had been used (I suspect it IS being used, but I don't know for sure or why).

Here are the triggers involved. You should also know that in the Object Manager, the Summer Red and Illumination custom abilities SHARE THE SAME NORMAL/LEARN BUTTON POSITION. Switch Tier's normal button position is (2, 1):

In the initialization trigger, the variable Patchouli_CurrentTier is set to 1

  • Switch Tier
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Switch Tier (Patchouli)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Patchouli_CurrentTier Equal to 1
        • Then - Actions
          • Unit - Remove Summer Red (Patchouli) from Great Unmoving Library 0001 <gen>
          • Unit - Add Illumination (Patchouli) to Great Unmoving Library 0001 <gen>
          • Unit - Set level of Illumination (Patchouli) for Great Unmoving Library 0001 <gen> to SummerRed_Level
          • Set Patchouli_CurrentTier = 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Patchouli_CurrentTier Equal to 2
        • Then - Actions
          • Unit - Remove Illumination (Patchouli) from Great Unmoving Library 0001 <gen>
          • Unit - Add Summer Red (Patchouli) to Great Unmoving Library 0001 <gen>
          • Unit - Set level of Summer Red (Patchouli) for Great Unmoving Library 0001 <gen> to Illumination_Level
        • Else - Actions
If someone could help me get this working, that would be appreciated. Thanks!
 
Last edited:
Level 2
Joined
Apr 6, 2012
Messages
12
@Maker

I could try learning vJass I guess. I program fairly well in JCreator (Java) - is it similar?

The Libram thing looks exactly what I'm looking for. I might try it if I can't get this fixed.

@Meticulous

Sorry, just edited to include the problem in the original post
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
OK, first of all, if that variable is never set to anything in map initialization so it wont do anything

2nd, you forgot to put the tier in the ifthenelse (2nd one)

3rd, aobut the two abilities being the same cooldown, if you remove an add an ability, the cooldown will play. Idk if that has any effect
 
If this is on the hero I suggest enabling/disabling spell rather than removing/adding to preserve cooldowns of specific abilities... Removing/adding will allow the user to spam the spells you know... I use summer red/ then switch, then switch again and poof summer red is reusable already...

Also, make sure you add Set Patchouli_CurrentTier = 1 on the second set of actions, becoz right now, once you switch to tier2, it will always stay at tier2
 
Level 11
Joined
Nov 15, 2007
Messages
781
It looks like you based Summer Red and Switch Tier on the same ability and their order ids are conflicting, if using one causes the other to go on cooldown.
 
Status
Not open for further replies.
Top