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

The real problem for me... (don't know what to call it)

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hi, gentlemen.
Well, in my map:
Red is allied with Blue, Teal, Purple, Orange and Yellow.
Green is allied with Pink, Gray, light blue, dark green, brown.

and I have some towers that when killed are replaced with another random tower from the list.
The problem is that towers can be of 3 colors: Red, if the killing unit belongs to an ally of Player Red, Green, if the killing unit belongs to an ally of Player Green and Neutral Hostile in all other cases.

SOme heroes use dummy-based skills, for example there can be a sumoned unit. But for some reason SOMETIMES when this summoned unit kills a tower, the next tower is created for Neutral Hostile, bot for Player Red for example. Sometimes it works properly, but sometimes not.

I've made a tracing, displaying the player number of killing unit to see what's going on, and I found out that sometimes it says the number of owner of killing unit and sometimes it writes 1 (which is, for some reason, not even considered Player Red, though it should as Player Red is #1, Blue is #2 etc.)

I'm giving you some triggers to show how it works:

  • Kill the tower
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Tower[0]
          • (Unit-type of (Triggering unit)) Equal to Tower[1]
          • (Unit-type of (Triggering unit)) Equal to Tower[2]
          • (Unit-type of (Triggering unit)) Equal to Tower[3]
          • (Unit-type of (Triggering unit)) Equal to Tower[4]
    • Actions
      • Set Tower_Int = (Player number of (Owner of (Triggering unit)))
      • Set Killed_Tower[Tower_Int] = (Triggering unit)
      • Set Tower_Death_Point = (Position of Killed_Tower[Tower_Int])
      • Special Effect - Create a special effect at Tower_Death_Point using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- kills LIGHT SIDE --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) belongs to an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • -------- kill minions --------
          • Set Tower_Death_Group = (Units within 1100.00 of Tower_Death_Point matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is A Hero) Not equal to True)) and ((Owner of (Matching unit)) Equal to Player 7 (Green))))
          • Unit Group - Pick every unit in Tower_Death_Group and do (Actions)
            • Loop - Actions
              • Unit - Kill (Picked unit)
          • Custom script: call DestroyGroup(udg_Tower_Death_Group)
          • Unit Group - Remove (Triggering unit) from Riot_Tower_Group[0]
          • Unit Group - Remove (Triggering unit) from Riot_Tower_Group[1]
          • Unit - Create 1 Tower[(Random integer number between 0 and 4)] for Player 1 (Red) at Tower_Death_Point facing Default building facing degrees
          • Set New_Tower = (Last created unit)
          • Unit Group - Add (Last created unit) to Riot_Tower_Group[0]
          • Custom script: call SetUnitX (udg_New_Tower, GetLocationX (udg_Tower_Death_Point))
          • Custom script: call SetUnitY (udg_New_Tower, GetLocationY (udg_Tower_Death_Point))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Killed_Tower[Tower_Int] Equal to TOWER[0]
            • Then - Actions
              • Set TOWER[0] = New_Tower
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Killed_Tower[Tower_Int] Equal to TOWER[1]
                • Then - Actions
                  • Set TOWER[1] = New_Tower
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Killed_Tower[Tower_Int] Equal to TOWER[2]
                    • Then - Actions
                      • Set TOWER[2] = New_Tower
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Killed_Tower[Tower_Int] Equal to TOWER[3]
                        • Then - Actions
                          • Set TOWER[3] = New_Tower
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Killed_Tower[Tower_Int] Equal to TOWER[4]
                            • Then - Actions
                              • Set TOWER[4] = New_Tower
                            • Else - Actions
          • -------- points --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Dying unit)) Equal to Player 7 (Green)
            • Then - Actions
              • Set Income_Team_2 = (Income_Team_2 - 1.00)
              • Set Exping_Team_2 = (Exping_Team_2 - 5.00)
            • Else - Actions
          • Set Income_Team_1 = (Income_Team_1 + 1.00)
          • Set Exping_Team_1 = (Exping_Team_1 + 5.00)
          • Set Tower_Level = (Tower_Level + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Tower_Level Greater than 80
            • Then - Actions
              • Set Tower_Level = (Tower_Level + 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Tower_Level Greater than 50
                • Then - Actions
                  • Set Tower_Level = (Tower_Level + 1)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Tower_Level Greater than 20
                    • Then - Actions
                      • Set Tower_Level = (Tower_Level + 1)
                    • Else - Actions
        • Else - Actions
          • -------- kills DARK SIDE --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Killing unit) belongs to an ally of Player 7 (Green)) Equal to True
            • Then - Actions
              • -------- kill minions --------
              • Set Tower_Death_Group = (Units within 1100.00 of Tower_Death_Point matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is A Hero) Not equal to True)) and ((Owner of (Matching unit)) Equal to Player 1 (Red))))
              • Unit Group - Pick every unit in Tower_Death_Group and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • Custom script: call DestroyGroup(udg_Tower_Death_Group)
              • Unit Group - Remove (Triggering unit) from Riot_Tower_Group[0]
              • Unit Group - Remove (Triggering unit) from Riot_Tower_Group[1]
              • Unit - Create 1 Tower[(Random integer number between 0 and 4)] for Player 7 (Green) at Tower_Death_Point facing Default building facing degrees
              • Set New_Tower = (Last created unit)
              • Custom script: call SetUnitX (udg_New_Tower, GetLocationX (udg_Tower_Death_Point))
              • Custom script: call SetUnitY (udg_New_Tower, GetLocationY (udg_Tower_Death_Point))
              • Unit Group - Add (Last created unit) to Riot_Tower_Group[1]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Killed_Tower[Tower_Int] Equal to TOWER[0]
                • Then - Actions
                  • Set TOWER[0] = New_Tower
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Killed_Tower[Tower_Int] Equal to TOWER[1]
                    • Then - Actions
                      • Set TOWER[1] = New_Tower
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Killed_Tower[Tower_Int] Equal to TOWER[2]
                        • Then - Actions
                          • Set TOWER[2] = New_Tower
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Killed_Tower[Tower_Int] Equal to TOWER[3]
                            • Then - Actions
                              • Set TOWER[3] = New_Tower
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Killed_Tower[Tower_Int] Equal to TOWER[4]
                                • Then - Actions
                                  • Set TOWER[4] = New_Tower
                                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Dying unit)) Equal to Player 1 (Red)
                • Then - Actions
                  • Set Income_Team_1 = (Income_Team_1 - 1.00)
                  • Set Exping_Team_1 = (Exping_Team_1 - 5.00)
                • Else - Actions
              • Set Income_Team_2 = (Income_Team_2 + 1.00)
              • Set Exping_Team_2 = (Exping_Team_2 + 5.00)
              • Set Tower_Level = (Tower_Level + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Tower_Level Greater than 30
                • Then - Actions
                  • Set Tower_Level = (Tower_Level + 1)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Tower_Level Greater than 20
                    • Then - Actions
                      • Set Tower_Level = (Tower_Level + 1)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Tower_Level Greater than 10
                        • Then - Actions
                          • Set Tower_Level = (Tower_Level + 1)
                        • Else - Actions
            • Else - Actions
              • -------- kills NEUTRAL --------
              • -------- kill minions --------
              • Set Tower_Death_Group = (Units within 1100.00 of Tower_Death_Point matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is A Hero) Not equal to True)) and ((Owner of (Matching unit)) Equal to (Owner of (Killing unit)))))
              • Unit Group - Pick every unit in Tower_Death_Group and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • Custom script: call DestroyGroup(udg_Tower_Death_Group)
              • Unit Group - Remove (Triggering unit) from Riot_Tower_Group[0]
              • Unit Group - Remove (Triggering unit) from Riot_Tower_Group[1]
              • Unit - Create 1 Tower[(Random integer number between 0 and 4)] for Neutral Hostile at Tower_Death_Point facing Default building facing degrees
              • Set New_Tower = (Last created unit)
              • Custom script: call SetUnitX (udg_New_Tower, GetLocationX (udg_Tower_Death_Point))
              • Custom script: call SetUnitY (udg_New_Tower, GetLocationY (udg_Tower_Death_Point))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Triggering unit) Equal to TOWER[0]
                • Then - Actions
                  • Set TOWER[0] = (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Triggering unit) Equal to TOWER[1]
                    • Then - Actions
                      • Set TOWER[1] = (Last created unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Triggering unit) Equal to TOWER[2]
                        • Then - Actions
                          • Set TOWER[2] = (Last created unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Triggering unit) Equal to TOWER[3]
                            • Then - Actions
                              • Set TOWER[3] = (Last created unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Triggering unit) Equal to TOWER[4]
                                • Then - Actions
                                  • Set TOWER[4] = (Last created unit)
                                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Dying unit)) Equal to Player 1 (Red)
                • Then - Actions
                  • Set Income_Team_1 = (Income_Team_1 - 1.00)
                  • Set Exping_Team_1 = (Exping_Team_1 - 5.00)
                • Else - Actions
              • Set Tower_Level = (Tower_Level + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Tower_Level Greater than 30
                • Then - Actions
                  • Set Tower_Level = (Tower_Level + 1)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Tower_Level Greater than 20
                    • Then - Actions
                      • Set Tower_Level = (Tower_Level + 1)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Tower_Level Greater than 10
                        • Then - Actions
                          • Set Tower_Level = (Tower_Level + 1)
                        • Else - Actions
      • -------- Tower Level --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Tower_Level Less than or equal to 150
        • Then - Actions
          • Player - Set the current research level of TOWER UPGRADE to Tower_Level for Player 1 (Red)
          • Player - Set the current research level of TOWER UPGRADE to Tower_Level for Player 7 (Green)
          • Player - Set the current research level of TOWER UPGRADE to Tower_Level for Neutral Hostile
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Tower_Death_Point)
Hope that you can give me a hint about that :)
 
Level 13
Joined
Jul 15, 2007
Messages
763
If the killing unit ceases to exist (e.g. your summon shoots an attack, expires, and then lands the killing blow) then the killing unit will be no-unit (which as you can imagine belongs to no player). Check that your killing unit is still in the game when the trigger fires.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
There is also no killing unit if a unit is killed by losing all its current life. For example as the result of too many maximum life upgrades or if a trigger is used to set the units current life too low. A common cause of this is improperly written trigger enhanced abilities which reduce unit current life rather than dealing damage from a unit.
 
Level 10
Joined
Mar 17, 2012
Messages
579
i dont see anywhere the new unit will be neutral hostile. is there any other triggers that could be interfering?
no, there is no other triggers there :(

If the killing unit ceases to exist (e.g. your summon shoots an attack, expires, and then lands the killing blow) then the killing unit will be no-unit (which as you can imagine belongs to no player). Check that your killing unit is still in the game when the trigger fires.
I have already found it out. When I test my map, there is no bugs, but when other people do it, I can witness that stuff... It seems like it happens spontaneously...
 
Level 10
Joined
Mar 17, 2012
Messages
579
If the killing unit ceases to exist (e.g. your summon shoots an attack, expires, and then lands the killing blow) then the killing unit will be no-unit (which as you can imagine belongs to no player). Check that your killing unit is still in the game when the trigger fires.

Yet it was the same theory of disappearing dummy that was making my mood :) Found the problem, but in the other spell))))
 
Status
Not open for further replies.
Top