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

Item Charge Bug

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hey.

I have a little problem with one of my newest systems. Idea of the system is to check if any of player boxes have specific items. If so, uses it(minus 1 charge or remove it) and heals character. Now only heal comes, but items won't lose any charge / won't be removed.

What's wrong? How I can fix?

  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • Unit Group - Remove all units from TempGroup2
              • For each (Integer A) from 1 to 9, do (Actions)
                • Loop - Actions
                  • Unit Group - Pick every unit in TempGroup and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                        • Then - Actions
                          • Unit Group - Add (Picked unit) to TempGroup2
                          • Set TempUnit2 = (Random unit from TempGroup2)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                            • Then - Actions
                              • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                            • Else - Actions
                              • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                          • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                          • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Skip remaining actions
            • Else - Actions
 
  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • For each (Integer A) from 1 to 9, do (Actions)
                • Loop - Actions
                  • Unit Group - Pick every unit in TempGroup and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                        • Then - Actions
                          • Set TempUnit2 = Picked Unit
                        • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                      • Then - Actions
                        • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                      • Else - Actions
                        • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                  • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                  • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                  • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Skip remaining actions
            • Else - Actions
 
Last edited:
Level 37
Joined
Aug 14, 2006
Messages
7,601
Trigger is like this now. Still no charges drop and no item removed when I have 1 potion left.

  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • For each (Integer A) from 1 to 9, do (Actions)
                • Loop - Actions
                  • Unit Group - Pick every unit in TempGroup and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                        • Then - Actions
                          • Set TempUnit2 = (Picked unit)
                        • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                    • Then - Actions
                      • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                    • Else - Actions
                      • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                  • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                  • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                  • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Skip remaining actions
            • Else - Actions
          • -------- === END === --------
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
The problem is actually simple: I don't know how to pick a random unit from group that units have this item.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
The integer loop and unit group loop should be the other way around.

First pick every unit in the group, then loop from 1 to 9 for picked unit.

All the actions from If charges remaining... to Skip remaining actions should be right after Set TempUnit2 = Picked Unit.

Remember to add call DestroyGroup() before Skip remaining actions, since it will get skipped otherwise.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
The integer loop and unit group loop should be the other way around.

First pick every unit in the group, then loop from 1 to 9 for picked unit.

All the actions from If charges remaining... to Skip remaining actions should be right after Set TempUnit2 = Picked Unit.

Remember to add call DestroyGroup() before Skip remaining actions, since it will get skipped otherwise.

Hmm. Like this?

  • Actions
    • -------- === PHODOM === --------
    • Set TempUnit = AAAPhodom
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (AAAPhodom is alive) Equal to True
      • Then - Actions
        • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
        • -------- === HEALING POTIONS === --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
              • Then - Actions
                • For each (Integer A) from 1 to 9, do (Actions)
                  • Loop - Actions
                    • Unit Group - Pick every unit in TempGroup and do (Actions)
                      • Loop - Actions
                        • Set TempUnit2 = (Picked unit)
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                          • Then - Actions
                            • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                          • Else - Actions
                            • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                        • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                        • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                        • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                        • Special Effect - Destroy (Last created special effect)
                        • Custom script: call DestroyGroup(udg_TempGroup)
                        • Skip remaining actions
              • Else - Actions
          • Else - Actions
        • -------- === END === --------
        • Custom script: call DestroyGroup(udg_TempGroup)
      • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
This, but "unit has item of type" should be inside the pick every unit loop.

  • Actions
    • -------- === PHODOM === --------
    • Set TempUnit = AAAPhodom
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (AAAPhodom is alive) Equal to True
      • Then - Actions
        • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
        • -------- === HEALING POTIONS === --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
              • Then - Actions
                • Unit Group - Pick every unit in TempGroup and do (Actions)
                  • Loop - Actions
                    • Set TempUnit2 = (Picked unit)
                    • For each (Integer A) from 1 to 9, do (Actions)
                      • Loop - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                          • Then - Actions
                            • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                          • Else - Actions
                            • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                        • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                        • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                        • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                        • Special Effect - Destroy (Last created special effect)
                        • Custom script: call DestroyGroup(udg_TempGroup)
                        • Skip remaining actions
              • Else - Actions
          • Else - Actions
        • -------- === END === --------
        • Custom script: call DestroyGroup(udg_TempGroup)
      • Else - Actions
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Like this?

  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                • Then - Actions
                  • Unit Group - Pick every unit in TempGroup and do (Actions)
                    • Loop - Actions
                      • Set TempUnit2 = (Picked unit)
                      • For each (Integer A) from 1 to 9, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                            • Then - Actions
                              • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                            • Else - Actions
                              • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                          • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                          • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call DestroyGroup(udg_TempGroup)
                          • Skip remaining actions
                • Else - Actions
            • Else - Actions
          • -------- === END === --------
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Like this?

  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • Set TempUnit2 = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                • Then - Actions
                  • Unit Group - Pick every unit in TempGroup and do (Actions)
                    • Loop - Actions
                      • For each (Integer A) from 1 to 9, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                            • Then - Actions
                              • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                            • Else - Actions
                              • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                          • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                          • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call DestroyGroup(udg_TempGroup)
                          • Skip remaining actions
                • Else - Actions
            • Else - Actions
          • -------- === END === --------
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
This fucking makes no sense to me.

My own new edition...

  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Set TempUnit2 = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                    • Then - Actions
                      • For each (Integer A) from 1 to 9, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                            • Then - Actions
                              • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                            • Else - Actions
                              • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                          • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                          • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call DestroyGroup(udg_TempGroup)
                          • Skip remaining actions
                    • Else - Actions
            • Else - Actions
          • -------- === END === --------
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
My own new edition...

  • Use Potion From Box
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to GUse Health Potion (PHODOM)
          • (Ability being cast) Equal to GUse Mana Potion (PHODOM)
          • (Ability being cast) Equal to GUse Health Scroll (PHODOM)
          • (Ability being cast) Equal to GUse Mana Scroll (PHODOM)
    • Actions
      • -------- === PHODOM === --------
      • Set TempUnit = AAAPhodom
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AAAPhodom is alive) Equal to True
        • Then - Actions
          • Set TempGroup = (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) is Mechanical) Equal to True))
          • -------- === HEALING POTIONS === --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to GUse Health Potion (PHODOM)
            • Then - Actions
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Set TempUnit2 = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has an item of type Restore_Panel_HealPot[TempInteger]) Equal to True
                    • Then - Actions
                      • For each (Integer A) from 1 to 9, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) Greater than 1
                            • Then - Actions
                              • Item - Set charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)]) to ((Charges remaining in (Item carried by TempUnit2 of type Restore_Panel_HealPot[(Integer A)])) - 1)
                            • Else - Actions
                              • Item - Remove (Item carried by TempUnit2 of type Restore_Panel_HealPot[TempInteger])
                          • Unit - Set life of TempUnit to ((Life of TempUnit) + (Real(Restore_Panel_HealPot_I[(Integer A)])))
                          • Unit - Set mana of TempUnit to ((Mana of TempUnit) + (Real(Restore_Panel_HealPot_I2[(Integer A)])))
                          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call DestroyGroup(udg_TempGroup)
                          • Skip remaining actions
                    • Else - Actions
            • Else - Actions
          • -------- === END === --------
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions

This is correct. Unit has item is after Unit = picked unit.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hey. I thought that this was an easy system but I was wrong. I made it straight to the campaign which was a mistake. I put the system to a simple map now, the system doesn't work at all. Maybe you could look at it, tell me what's wrong and perhaps fix it? I would be very thankful and then finally I can release the next version of the campaign I have been working very hard.

The idea is this: "Use a healing potion on Phodom from any box you currently have." There's currently only one potion but I'm sure when this works it's just easy to copy.

Thanks again for the help you have given.
 

Attachments

  • Restore Panel System.w3x
    22.7 KB · Views: 35
Status
Not open for further replies.
Top