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

[Solved] Dies and limit

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
329
How to fix this trigger?
  • Humans Dead
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in UnitGroup_Humans) Equal to (==) True
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_InGameHumans Greater than (>) 0
        • Then - Actions
          • Set Integer_InGameHumans = (Integer_InGameHumans - 1)
        • Else - Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to (==) (Player((Integer A)))
            • Then - Actions
              • Sound - Play VarimathrasPissed6 <gen>
              • Game - Display to (All players) the text: (String_PlayerColors[(Player number of (Player((Integer A))))] + has fallen.)
              • Set Integer_Claim[((Integer A) - 1)] = 0
            • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) is in PlayerGroup_Vampires) Equal to (==) True
        • Then - Actions
          • Player Group - Remove (Owner of (Dying unit)) from PlayerGroup_Humans
            • Do Multiple ActionsFor each (Integer A) from 1 to 12, do (Actions)
              • Loop - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Owner of (Killing unit)) Equal to (==) (Player((Integer A)))
                  • Then - Actions
                    • Player Group - Add (Owner of (Dying unit)) to PlayerGroup_Vampires
                    • Set Integer_InGameVampires = (Integer_InGameVampires + 1)
                    • Unit - Create 1 Balnazzar (Evil) for (Owner of (Dying unit)) at (Center of 002 Spawn Vampires <gen>) facing Default building facing (270.0) degrees
                    • Game - Display to (All players) the text: (There are |cffffff00 + (((String(Integer_InGameHumans)) + |rHumans and |cffffff00) + ((String(Integer_InGameVampires)) + |rVampires are still alive.)))
                    • Hero - Create Vampiric Research Center and give it to (Last created unit)
                    • Hero - Create Scroll of Recall and give it to (Last created unit)
                    • Player - Set (Owner of (Last created unit)) Current gold to 50
                    • Player - Set (Owner of (Last created unit)) Current lumber to 0
                    • Set Integer_Leak[(Player number of (Owner of (Last created unit)))] = 0
                    • Set Point_Visibility = (Position of Shop 1 0010 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop 2 0021 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop 3 0027 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop 4 0011 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop 5 0015 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop 6 0012 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop Staff 0013 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                    • Set Point_Visibility = (Position of Shop Vampiric 0019 <gen>)
                    • Visibility - Create an initially Enabled visibility modifier for (Owner of (Dying unit)) emitting Visibility from Point_Visibility to a radius of 512.00
                    • Custom script: call RemoveLocation(udg_Point_Visibility)
                  • Else - Actions
                    • Player Group - Add (Owner of (Dying unit)) to PlayerGroup_HumansDead
                      • Do Multiple ActionsFor each (Integer B) from 1 to 3, do (Actions)
                        • Loop - Actions
                          • Multiboard - Set the text for Multiboard[(Integer B)] item in column 1, row (Integer_RowPlayers[(Player number of (Triggering player))] + 2) to (String_PlayerColors[(Player number of (Triggering player))] + (Dead)|r)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) matching (((Unit-type of (Matching unit)) Not equal to (!=) Balnazzar (Evil)) and ((((Matching unit) is A structure) Not equal to (!=) True) and (((Matching unit) is A Hero) Equal to (==) True)))) and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of (Dying unit))) and do (Actions)
            • Loop - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Multiple ConditionsOr - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to (==) Builder (Male)
                      • (Unit-type of (Picked unit)) Equal to (==) Builder (Female)
                • Then - Actions
                  • Unit - Remove (Picked unit) from the game
                • Else - Actions
              • Unit - Change ownership of (Picked unit) to Neutral Hostile and Retain color
              • Animation - Change (Picked unit)'s vertex coloring to (50.00%, 50.00%, 50.00%) with 50.00% transparency
              • Unit - Pause (Picked unit)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) matching ((((Matching unit) is A structure) Equal to (==) True) and (((Matching unit) belongs to an enemy of (Owner of (Dying unit))) Equal to (==) True))) and do (Actions)
            • Loop - Actions
              • Player Group - Make PlayerGroup_Humans treat (Player group((Owner of (Dying unit)))) as an Enemy
              • Player Group - Make (Player group((Owner of (Dying unit)))) treat PlayerGroup_Humans as an Enemy
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit)) matching (((Unit-type of (Matching unit)) Equal to (==) Balnazzar (Evil)) and (((Matching unit) belongs to an ally of (Owner of (Killing unit))) Equal to (==) True))) and do (Actions)
            • Loop - Actions
              • Player Group - Make PlayerGroup_Vampires treat (Player group((Owner of (Dying unit)))) as an Ally with shared vision
              • Player Group - Make (Player group((Owner of (Dying unit)))) treat PlayerGroup_Vampires as an Ally with shared vision
1. When my unit dies, I will go to the enemy group as mini vampires, so my building and other unit will be removed after 30 seconds and their color changes to black and they cannot attack.

2. How to limit the mini vampires when there is 2 vampires in the game, the limit of the mini vampire is 3, But when there is 1 vampire, the limit of mini vampire is 4, And if there are 2 vampires and 3 mini vampires in this game, other humans cannot return as a minion when they die.
 
Last edited:
Level 5
Joined
Jun 13, 2017
Messages
83
I dont know A lot about triggering but i think i got what you want for the second part. Might not be the best but it should work.


Here is how to detect the number of mini vampire:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • -------- Set the Number of Vampire in another trigger --------
      • -------- if Vampire doesn't change from start of the game put them in variable --------
      • -------- ------------------------ --------
      • -------- ------------------------ --------
      • -------- check if the number of vampire = 1 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerVampire Equal to 1
        • Then - Actions
          • -------- Check the number of current Mini vampire with max of 4 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerMiniVampire Less than 4
            • Then - Actions
              • Set IntegerMiniVampire = (IntegerMiniVampire + 1)
              • -------- Do your action to turn them to Mini vampire --------
            • Else - Actions
        • Else - Actions
          • -------- ------------------------ --------
          • -------- ------------------------ --------
          • -------- check if the number of vampire = 2 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerVampire Equal to 2
            • Then - Actions
              • -------- Check the number of current Mini vampire with max of 3 --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerMiniVampire Less than 3
                • Then - Actions
                  • Set IntegerMiniVampire = (IntegerMiniVampire + 1)
                  • -------- Do your action to turn them to Mini vampire --------
                • Else - Actions
            • Else - Actions
 
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
329
What is not working with the trigger? In what way is it broken?

When my builder (he / she) dies, Cannot be added to vamp group. Also other unit should be dead, except structure. And my structure should change to natural passivity by changing the color to black, and they cannot attack, And after 30 seconds the structure will be removed from the game.
 
Last edited:
Level 5
Joined
Jun 13, 2017
Messages
83
As I said I don't know much about triggers so I don't really know about (For Each (integer A) from 1 to 12, do(Action). Not saying it is wrong I just don't know about it, but the part below should work fine as far as I know, because the condition with mini vampire to be less than 4 means, if it is 4 or more nothing will happen and there will be no more mini vampires, unless 1 die and get removed from the variable.




Edit: by the way how do you put it in spoiler so i can put mine instead of taking half the screen lol

Edit 2: got it thanks :)
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Wait cannot be used inside a "pick every unit in unit group" or "pick every player in player group" loop blocks. This is because they are not implemented using JASS loop blocks but rather by function references. Even if they were implemented with JASS loop blocks chances are it will not produce the results you want.

You will have to loop through all units/players doing all actions before the intended wait, then wait (outside the loop block) then loop through all units/players again and do the actions after intended wait.
 
Level 10
Joined
Jun 20, 2017
Messages
329
And the detect doesn't work!
  • Detect Vampires
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in UnitGroup_Humans) Equal to (==) True
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in PlayerGroup_Vampires) Equal to (==) 1
          • Integer_VampiresMini Less than or equal to (<=) 4
        • Then - Actions
          • Player Group - Add (Owner of (Dying unit)) to PlayerGroup_Vampires
          • Set Integer_InGameVampires = (Integer_InGameVampires + 1)
          • Unit - Create 1 Balnazzar (Evil) for (Owner of (Dying unit)) at (Center of 002 Spawn Vampires <gen>) facing Default building facing (270.0) degrees
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of players in PlayerGroup_Vampires) Equal to (==) 2
              • Integer_VampiresMini Less than or equal to (<=) 3
            • Then - Actions
              • Player Group - Add (Owner of (Dying unit)) to PlayerGroup_Vampires
              • Set Integer_InGameVampires = (Integer_InGameVampires + 1)
              • Unit - Create 1 Balnazzar (Evil) for (Owner of (Dying unit)) at (Center of 002 Spawn Vampires <gen>) facing Default building facing (270.0) degrees
            • Else - Actions
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Status
Not open for further replies.
Top