• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Pick Every Unit And Do Action

Status
Not open for further replies.
Level 2
Joined
May 31, 2013
Messages
19
Hello. I got this problem...
i Made this trigger but the problem is that i want an action to be performed only ONCE not once every picked unit. as a result of this trigger depending on how many units are picked that amount of messages and damages are done. To be clear - i want that if supply used by picked units is higher than supply limit then do damage(ONCE) to all living units and show message (ONCE).

  • Events
    • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
        • Actions -
          • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
            • Actions -
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units owned by (Picked player) matching ((Supply used by (Picked unit)) Higher Than (>) 0))) Higher Than (>) ((Picked player) Food Limit)
                • Then - Actions
                  • Game - Display to (Player group((Picked player))) for 20.00 seconds the text: |cffff0000Food Shor...
                  • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
                    • Actions -
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditionsi
                          • ((Picked unit) is Building) Equal to (==) NO
                        • Then - Actions
                          • Unit - Cause Stone Wall (V) 0746 <gen> to damage circular area after 0.00 seconds of radius 5.00 at (Position of (Picked unit)), dealing 10.00 damage of attack type Magic and damage type Normal
                        • Else - Actions
                • Else - Actions
 
Last edited:
Level 30
Joined
Nov 29, 2012
Messages
6,637
Hello. I got this problem...
i Made this trigger but the problem is that i want an action to be performed only ONCE not once every picked unit. as a result of this trigger depending on how many units are picked that amount of messages and damages are done. To be clear - i want that if supply used by picked units is higher than supply limit then do damage(ONCE) to all living units and show message (ONCE).

food shortage
Event
Time - Every 10.00 seconds of game time
Condition
Action
Player Group - Pick every player in Player Group - Player 1 (red) and do (Actions)
Actions -
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Actions -
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Condition
(Number of units in (Units owned by (Picked player) matching ((Supply used by (Picked unit)) Higher than (>) 0))) Higher Than(>) ((Picked player) Food Limit)
Then - Action
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Condition
((Picked unit) is Budynek) Equal to (==) NIE
To - Akcje
Game - Display to (Player group((Picked player))) for 20.00 seconds the text: |cffff0000Food Shor...
Unit - Cause Stone Wall (V) 0746 <gen> to damage circular area after 0.00 seconds of radius 5.00 at (Position of (Picked unit)), dealing 10.00 damage of attack type Magic and damage type Normal
Else - Action

Or - Actions

Turn off Trigger. through this:

  • Trigger - Turn off (This trigger)
Just put it maybe in the ITEs or should we say If/Then/Else. If it bugs try putting it at the end of the trigger.
 
Level 2
Joined
May 31, 2013
Messages
19
it doesnt solve the problem because! it runs once then it turns off and i want it to be periodic event plus it still shows messages and does damages based on the number of picked units
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
This is the trigger:
food shortage
Event
Time - Every 10.00 seconds of game time
Condition
Action
Player Group - Pick every player in Player Group - Player 1 (red) and do (Actions)
Actions -
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Actions -
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Condition
(Number of units in (Units owned by (Picked player) matching ((Supply used by (Picked unit)) Higher than (>) 0))) Higher Than(>) ((Picked player) Food Limit)
Then - Action
Game - Display to (Player group((Picked player))) for 20.00 seconds the text: |cffff0000Food Shor...
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Actions -
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is Budynek) Equal to (==) NIE
Then - Actions
Unit - Cause Stone Wall (V) 0746 <gen> to damage circular area after 0.00 seconds of radius 5.00 at (Position of (Picked unit)), dealing 10.00 damage of attack type Magic and damage type Normal

Else - Actions

Else - Actions

Wrap it in TRIGGER tags.
 
Level 2
Joined
May 31, 2013
Messages
19
This is the trigger:
food shortage
  • Event
  • Time - Every 10.00 seconds of game time
  • Condition
  • Action
  • Player Group - Pick every player in Player Group - Player 1 (red) and do (Actions)
  • Actions -
  • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
  • Actions -
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Condition
  • (Number of units in (Units owned by (Picked player) matching ((Supply used by (Picked unit)) Higher than (>) 0))) Higher Than(>) ((Picked player) Food Limit)
  • Then - Action
    • Game - Display to (Player group((Picked player))) for 20.00 seconds the text: |cffff0000Food Shor...
    • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
      • Actions -
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is Budynek) Equal to (==) NIE
          • Then - Actions
            • Unit - Cause Stone Wall (V) 0746 <gen> to damage circular area after 0.00 seconds of radius 5.00 at (Position of (Picked unit)), dealing 10.00 damage of attack type Magic and damage type Normal
          • Else - Actions
    • Else - Actions
 
Level 2
Joined
May 31, 2013
Messages
19
The problem is my UMSWE is in mixed languages
  • food shortage
    • Wydarzenia
      • Czas - Every 10.00 seconds of game time
    • Warunki
    • Akcje
      • Grupa graczy - Pick every player in Grupa gracza - Gracz 1 (Czerwony) and do (Actions)
        • PÄ™tla - Akcje
          • Grupa jednostek - Pick every unit in (Units owned by (Picked player)) and do (Actions)
            • PÄ™tla - Akcje
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • JeĹ›li - Warunki
                  • (Number of units in (Units owned by (Picked player) matching ((Supply used by (Picked unit)) WiÄ™ksze niĹĽ (>) 0))) WiÄ™ksze niĹĽ (>) ((Picked player) Ograniczenie ĹĽywnoĹ›ci)
                • To - Akcje
                  • Gra - Display to (Player group((Picked player))) for 20.00 seconds the text: |cffff0000Food Shor...
                  • Grupa jednostek - Pick every unit in (Units owned by (Picked player)) and do (Actions)
                    • PÄ™tla - Akcje
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • JeĹ›li - Warunki
                          • ((Picked unit) is Budynek) RĂłwna siÄ™ (==) NIE
                        • To - Akcje
                          • Jednostka - Cause Stone Wall (V) 0746 <gen> to damage circular area after 0.00 seconds of radius 5.00 at (Position of (Picked unit)), dealing 10.00 damage of attack type ZaklÄ™cia and damage type Normalny
                        • Albo - Akcje
                          • Do nothing
                • Albo - Akcje
 
Level 2
Joined
May 31, 2013
Messages
19
umswe is included in jassnewgenpack -_- i have it btw. i use only one player because im testing it on one then ill make it up to 10. just gonna change the player numbers. i use player group action because if i use pick every player in all players it produces some leaks and random stuff happen so instead i use player group for every player ;P works perfect for me.

Doomlord - still nth changed

oh sry i used to work on umswe like couple years ago it seems its New Gen World Editor but its from jassnewgenpack ;P
 
Level 2
Joined
May 31, 2013
Messages
19
food shortage - btw i did got rid of do nothing xD i dont know why its there xD i might have tried to use it and see if it solves but then forgot to delete ;P
  • Events
    • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
        • Actions -
          • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
            • Actions -
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units owned by (Picked player) matching ((Supply used by (Picked unit)) Higher Than (>) 0))) Higher Than (>) ((Picked player) Food Limit)
                • Then - Actions
                  • Game - Display to (Player group((Picked player))) for 20.00 seconds the text: |cffff0000Food Shor...
                  • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
                    • Actions -
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditionsi
                          • ((Picked unit) is Building) Equal to (==) NO
                        • Then - Actions
                          • Unit - Cause Stone Wall (V) 0746 <gen> to damage circular area after 0.00 seconds of radius 5.00 at (Position of (Picked unit)), dealing 10.00 damage of attack type Magic and damage type Normal
                          • Custom script: return
                        • Else - Actions
                • Else - Actions
i try to translate triggers... takes damn time.
 
Last edited:
Level 2
Joined
May 31, 2013
Messages
19
i never did any custom scripts so i kinda dont have an idea what are you talking about ;P as to the integr value i cant put it to specific number because it depends on supply used
 
Level 2
Joined
May 31, 2013
Messages
19
why would you need that ? the trigger is obvious my map is huge and have more than 130 triggers you woudnt know wth is going on either way ;P + i dont really wanna post unproteced maps.
 
Create a new trigger that is initially off.

Turn it on with the trigger you are using to select the unit group. Turn that trigger off at the end.

The new trigger will do your action. I'm assuming this is some type of starve damage. (Please explain exactly what the system is supposed to do. You first post is helpful but still not completely clear.)

Then have the new trigger turn off at the end and turn the first trigger back on.

This will create a loop and separate your actions into two triggers so that you can work with them in a more organized way.

There are many ways to do this, but this is one I like to use. You can also loop actions with "multiple functions." There maybe many more solutions as well. This seems like a fairly simple system with a really cool effect. +1 rep to you. I think part of your problem is that you are stuck in the structure of your trigger. You are counting units and then doing the action that many times...?? I think what you want is to have it select all units in the unit group. Count the units and compare it to the food supply. There now set the variables "hungry men" (or whatever) and "little cake." Then in the other periodic event trigger and a condition, if hungry men is greater than little cake - do your action "make them starve a little." I'm sorry I'm at work and I can't test it or write it out for you. Hope this helps.

Did you look at this?
 
Last edited:
Level 2
Joined
May 31, 2013
Messages
19
hmm

ok now... the trigger works perfect but! not on my map suddenly when i was working on this trigger sth happened and killed a lot of my triggers its like they dont want to go... everything looks fine its just they are not running... eh... i backed up older ver put that trigger in it and now it doesnt work proper.
 

Attachments

  • TEST MAP.w3x
    13.7 KB · Views: 57
Last edited:
Level 30
Joined
Nov 29, 2012
Messages
6,637
Not on your map? So you used another map to based the triggers and paste it in into your map? Is that what you mean?

If yes, check your triggers and if there are alterations that happen such as ability that has been changed in the process of CnP. Also dont forget to CnP all possible triggers and custom objects used in Object Editor to your map.

Warcraft has this issues that if you CnP triggers into the your map from test map, it will alter some triggers that is possibly doesnt have the required Variables or such to execute trigger.
 
Level 2
Joined
May 31, 2013
Messages
19
they are looped : first starts second and turns itself off then second turn on first and turns itself off
the problem is i dont know meaby in the way it counts units which are using supplies. about that trigger checking maaaan... it will take hours... btw thx for the info about CnP didnt knew bout it

Edit: i add new map with updated triggers it does work but! if you kill a unit and reach cap it counts dead as using supplies and so trigger runs even though you are not short on food
and that might be problem on my map becuase i have spawning units etc... counting is wrong

Edit 2: i tested it on my map and it seems it runs every time i even have 1 food in use... if dont have i doesnt run. so... wth ?

Edit 3: is there a way to fix CnP bugs ? or i have to edit older versions and do it all over again ?
 

Attachments

  • TEST MAP.w3x
    13.7 KB · Views: 63
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
You can use [hidden=Triggers][/hidden] tags to hide triggers so they won't stretch the page.


  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)


And a pro tip, wrap all that in [stable][/stable] tags to make it even neater.



  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)

 
Level 20
Joined
Apr 14, 2012
Messages
2,901
^ Apply it now to your trigger post using the
edit.gif
Button
 
Status
Not open for further replies.
Top