• 🏆 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!

Ability Management System

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
So I have this Ghost unit. He is a hero which learns abilities automatically as he levels up. In other words, the abilities he learns is always in the same order. I want to create a system where all the Ghost's abilities are removed if they he leaves the presence of either 4 unit types which Ill refer to as the "Marine" units and dummy abilities (passive abilities with no effect) will replace them. Once the ghost comes back in range of any Marine unit, his abilities (and their level before removal) is restored.

  • Ghost Ability Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set GhostAbility[1] = Death Ball
      • Set GhostAbility[2] = Unholy Frenzy (Ghost)
      • Set GhostAbility[3] = Life Transfusion (Ghost)
      • Set GhostAbility[4] = Polymorph (Ghost)
      • Set GhostAbility[5] = Dark Portal (Ghost)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set GhostAbilityCounter[(Player number of (Picked player))] = 1
          • Set GhostHasAbilities[(Player number of (Picked player))] = True
  • Stop Ghost Beta
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Ghost))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Set GhostUnit = (Picked unit)
          • Set TempPoint = (Position of (Picked unit))
          • Set TempUnitGroup2 = (Units within 600.00 of TempPoint matching (((Unit-type of (Matching unit)) Equal to Commander) or (((Unit-type of (Matching unit)) Equal to Firebat) or (((Unit-type of (Matching unit)) Equal to Medic) or ((Unit-type of (Matching unit)) Equal to Sniper)))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in TempUnitGroup2) Equal to 0
              • GhostHasAbilities[(Player number of (Owner of GhostUnit))] Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Ability have been f...
              • Game - Display to (All players) the text: (Ghosts: + (String((Number of units in TempUnitGroup))))
              • Game - Display to (All players) the text: (Marines: + (String((Number of units in TempUnitGroup2))))
              • Game - Display to (All players) the text: (AbilityCounter: + (String(GhostAbilityCounter[(Player number of (Owner of GhostUnit))])))
              • For each (Integer GhostAbilityCounter[(Player number of (Owner of GhostUnit))]) from 1 to GhostAbilityCounter[(Player number of (Owner of GhostUnit))], do (Actions)
                • Loop - Actions
                  • Unit - Remove GhostAbility[GhostAbilityCounter[(Player number of (Owner of GhostUnit))]] from GhostUnit
              • Set GhostHasAbilities[(Player number of (Owner of GhostUnit))] = False
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GhostHasAbilities[(Player number of (Owner of GhostUnit))] Equal to False
                • Then - Actions
                  • Game - Display to (All players) the text: Ability have not be...
                  • Game - Display to (All players) the text: (Ghosts: + (String((Number of units in TempUnitGroup))))
                  • Game - Display to (All players) the text: (Marines: + (String((Number of units in TempUnitGroup2))))
                  • Game - Display to (All players) the text: (AbilityCounter: + (String(GhostAbilityCounter[(Player number of (Owner of GhostUnit))])))
                  • For each (Integer GhostAbilityCounter[(Player number of (Owner of GhostUnit))]) from 1 to GhostAbilityCounter[(Player number of (Owner of GhostUnit))], do (Actions)
                    • Loop - Actions
                      • Unit - Add GhostAbility[GhostAbilityCounter[(Player number of (Owner of GhostUnit))]] to GhostUnit
                      • Unit - Set level of GhostAbility[GhostAbilityCounter[(Player number of (Owner of GhostUnit))]] for GhostUnit to GhostLevel[GhostAbilityCounter[(Player number of (Owner of GhostUnit))]]
                  • Set GhostHasAbilities[(Player number of (Owner of GhostUnit))] = True
                • Else - Actions
                  • Game - Display to (All players) the text: Marines detected bu...
          • Custom script: call RemoveLocation (udg_TempPoint)
          • Custom script: call DestroyGroup (udg_TempUnitGroup2)
      • Custom script: call DestroyGroup (udg_TempUnitGroup)
1.) All the abilities are added to the Ghost despite what value I manually input for GhostAbilityCount.
2.) Upon testing, the Game Text Message reports the value of AbilityCounter to be 1817 the second time the trigger is run. It reports 1 (what it should be) the first time, then the second time it runs, it reads 1817. Why is this?

Can anyone help me out? What am I doing wrong?
 
Last edited:
Status
Not open for further replies.
Top