• 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.

[Trigger] Random Crushes (Probably Caused By Triggers)

Status
Not open for further replies.
Level 7
Joined
Apr 5, 2013
Messages
243
I've been working on the upcoming version of my map doing various changes.

Most importantly I've started to learn how to clean leaks, and I thought I have cleared what should be all or most of them but something's going wrong with the triggers (Have I done mistakes in some of the fixes/leak clears? Something's wrong with the new triggers I've added?).

I'm experiencing VERY random crushes:
-Sometimes for example it crushes at faction selection, then with the same player setup and faction choices it doesn't.
-Sometimes it crushes on mid or late game.
-Most times (maybe like 70%) it doesn't crush at all till game is over.
-I'll have to check at my better computer. On this one I've had rare crushes even before the updates while on the better one I have never experienced one. This probably means the map has issues with leaks eating the memory, even though I thought I've fixed them, right?

Since I have no clue on what trigger(s) cause the crashes and there's no point posting all of them, I'm hoping someone is kind enough to check my triggers, or even join the project as a triggerer.

The map is attached here
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
The usual approach to this is disabling all triggers except X amount of triggers (= a batch of triggers). If game crashes with that batch, then problem is in those triggers. If not, disable those triggers and set another batch on and so on, until you find your problem.

Another problem may be infinite loop. Infinite loop is created by at least 2 triggers, where one trigger fires the other.

I'll take a look at your map later, but don't count too much on me, or anybody else to go through all triggers to find out where the problem may be.

---
Could you elaborate more on what you changed/added? If the map worked fine in the last version but now it crashes, the problem will most likely be in your latest changes. The best would be writing down whole list of changes/trigger names that you changed
 
Level 7
Joined
Apr 5, 2013
Messages
243
Thanks for all the advice. Guess I'll do the first if nothing else works, but still it might turn out to be a pain since the crashes are so random. Might have to play test each batch several times.

The map DID crash even before those changes, but very rarely and only at my "slow" computer.

Now, if the problem(s) are in the leak fixes or some minor mistake on "easy" triggers, it might be hard to spot.

It could very well be on the following batch of triggers since sometimes the game crashes during it's function (but others not at all even if i have the same slots playing/same options chosen just like a previous crash - and other time it comes to crash at random points that have nothing to do with this one)

  • Human Selection Spawn
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Pick Your Empire for (Picked player) at ((Picked player) start location) facing Default building facing degrees
          • Selection - Select (Last created unit) for (Picked player)
  • Romans Human
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to |cffffcc00Romans|r
      • ((Owner of (Triggering unit)) Not equal to Player 1 (Red)) and (((Owner of (Triggering unit)) controller) Equal to User)
    • Actions
      • Set Point = ((Owner of (Triggering unit)) start location)
      • Unit - Replace (Triggering unit) with a Roman Civ Center using The old unit's relative life and mana
      • Unit - Create 1 Scout for (Owner of (Triggering unit)) at Point facing Default building facing degrees
      • Unit - Create 5 Roman Villager for (Owner of (Triggering unit)) at Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Point)
      • Player - Make Scythian Colony Unavailable for training/construction by (Owner of (Triggering unit))
      • Player - Make Celtic Colony Unavailable for training/construction by (Owner of (Triggering unit))
      • Player - Make Macedonian Colony Unavailable for training/construction by (Owner of (Triggering unit))
      • Camera - Set the camera bounds for (Owner of (Triggering unit)) to Wait <gen>
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Waiting For Other P...
  • Host and AI Selection 2
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Romans|r
          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Scythians|r
          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Celts|r
          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Macedonians|r
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) controller) Equal to Computer
          • (Player 2 (Blue) Food used) Less than 1
        • Then - Actions
          • Unit - Replace (Triggering unit) with a Pick Your Empire using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for Player 1 (Red)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to |cffffcc00Romans|r
            • Then - Actions
              • Set Point = (Player 2 (Blue) start location)
              • Unit - Create 1 Roman Civ Center for Player 2 (Blue) at Point facing Default building facing degrees
              • Unit - Create 1 Scout for Player 2 (Blue) at Point facing Default building facing degrees
              • Unit - Create 5 Roman Villager for Player 2 (Blue) at Point facing Default building facing degrees
              • AI - Start melee AI script for Player 2 (Blue): war3mapImported\AI Romans.ai
              • Custom script: call RemoveLocation(udg_Point)
              • Game - Display to (All players) the text: Computer 2 (Blue) H...
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Triggering unit)) Equal to |cffffcc00Scythians|r
                • Then - Actions
                  • Set Point = (Player 2 (Blue) start location)
                  • Unit - Create 1 Scythian Civ Center for Player 2 (Blue) at Point facing Default building facing degrees
                  • Unit - Create 1 Scythian Pack Horse for Player 2 (Blue) at Point facing Default building facing degrees
                  • Unit - Create 1 Scout for Player 2 (Blue) at Point facing Default building facing degrees
                  • Unit - Create 4 Scythian Villager for Player 2 (Blue) at Point facing Default building facing degrees
                  • AI - Start melee AI script for Player 2 (Blue): war3mapImported\AI Scythians.ai
                  • Custom script: call RemoveLocation(udg_Point)
                  • Game - Display to (All players) the text: Computer 2 (Blue) H...
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to |cffffcc00Celts|r
                    • Then - Actions
                      • Set Point = (Player 2 (Blue) start location)
                      • Unit - Create 1 Celtic Civ Center for Player 2 (Blue) at Point facing Default building facing degrees
                      • Unit - Create 1 Scout for Player 2 (Blue) at Point facing Default building facing degrees
                      • Unit - Create 5 Celtic Villager for Player 2 (Blue) at Point facing Default building facing degrees
                      • AI - Start melee AI script for Player 2 (Blue): war3mapImported\AI Celts.ai
                      • Custom script: call RemoveLocation(udg_Point)
                      • Game - Display to (All players) the text: Computer 2 (Blue) H...
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Macedonians|r
                        • Then - Actions
                          • Set Point = (Player 2 (Blue) start location)
                          • Unit - Create 1 Macedonian Civ Center for Player 2 (Blue) at Point facing Default building facing degrees
                          • Unit - Create 1 Scout for Player 2 (Blue) at Point facing Default building facing degrees
                          • Unit - Create 5 Macedonian Villager for Player 2 (Blue) at Point facing Default building facing degrees
                          • AI - Start melee AI script for Player 2 (Blue): war3mapImported\AI Macedonians.ai
                          • Custom script: call RemoveLocation(udg_Point)
                          • Game - Display to (All players) the text: Computer 2 (Blue) H...
                        • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 3 (Teal) controller) Equal to Computer
              • (Player 3 (Teal) Food used) Less than 1
            • Then - Actions
              • Unit - Replace (Triggering unit) with a Pick Your Empire using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for Player 1 (Red)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Triggering unit)) Equal to |cffffcc00Romans|r
                • Then - Actions
                  • Set Point = (Player 3 (Teal) start location)
                  • Unit - Create 1 Roman Civ Center for Player 3 (Teal) at Point facing Default building facing degrees
                  • Unit - Create 1 Scout for Player 3 (Teal) at Point facing Default building facing degrees
                  • Unit - Create 5 Roman Villager for Player 3 (Teal) at Point facing Default building facing degrees
                  • AI - Start melee AI script for Player 3 (Teal): war3mapImported\AI Romans.ai
                  • Custom script: call RemoveLocation(udg_Point)
                  • Game - Display to (All players) the text: Computer 3 (Teal) H...
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to |cffffcc00Scythians|r
                    • Then - Actions
                      • Set Point = (Player 3 (Teal) start location)
                      • Unit - Create 1 Scythian Civ Center for Player 3 (Teal) at Point facing Default building facing degrees
                      • Unit - Create 1 Scythian Pack Horse for Player 3 (Teal) at Point facing Default building facing degrees
                      • Unit - Create 1 Scout for Player 3 (Teal) at Point facing Default building facing degrees
                      • Unit - Create 4 Scythian Villager for Player 3 (Teal) at Point facing Default building facing degrees
                      • AI - Start melee AI script for Player 3 (Teal): war3mapImported\AI Scythians.ai
                      • Custom script: call RemoveLocation(udg_Point)
                      • Game - Display to (All players) the text: Computer 3 (Teal) H...
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Celts|r
                        • Then - Actions
                          • Set Point = (Player 3 (Teal) start location)
                          • Unit - Create 1 Celtic Civ Center for Player 3 (Teal) at Point facing Default building facing degrees
                          • Unit - Create 1 Scout for Player 3 (Teal) at Point facing Default building facing degrees
                          • Unit - Create 5 Celtic Villager for Player 3 (Teal) at Point facing Default building facing degrees
                          • AI - Start melee AI script for Player 3 (Teal): war3mapImported\AI Celts.ai
                          • Custom script: call RemoveLocation(udg_Point)
                          • Game - Display to (All players) the text: Computer 3 (Teal) H...
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Triggering unit)) Equal to |cffffcc00Macedonians|r
                            • Then - Actions
                              • Set Point = (Player 3 (Teal) start location)
                              • Unit - Create 1 Macedonian Civ Center for Player 3 (Teal) at Point facing Default building facing degrees
                              • Unit - Create 1 Scout for Player 3 (Teal) at Point facing Default building facing degrees
                              • Unit - Create 5 Macedonian Villager for Player 3 (Teal) at Point facing Default building facing degrees
                              • AI - Start melee AI script for Player 3 (Teal): war3mapImported\AI Macedonians.ai
                              • Custom script: call RemoveLocation(udg_Point)
                              • Game - Display to (All players) the text: Computer 3 (Teal) H...
                            • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 4 (Purple) controller) Equal to Computer
                  • (Player 4 (Purple) Food used) Less than 1
                • Then - Actions
                  • Unit - Replace (Triggering unit) with a Pick Your Empire using The old unit's relative life and mana
                  • Selection - Select (Last replaced unit) for Player 1 (Red)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to |cffffcc00Romans|r
                    • Then - Actions
                      • Set Point = (Player 4 (Purple) start location)
                      • Unit - Create 1 Roman Civ Center for Player 4 (Purple) at Point facing Default building facing degrees
                      • Unit - Create 1 Scout for Player 4 (Purple) at Point facing Default building facing degrees
                      • Unit - Create 5 Roman Villager for Player 4 (Purple) at Point facing Default building facing degrees
                      • AI - Start melee AI script for Player 4 (Purple): war3mapImported\AI Romans.ai
                      • Custom script: call RemoveLocation(udg_Point)
                      • Game - Display to (All players) the text: Computer 4 (Purple)...
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Scythians|r
                        • Then - Actions
                          • Set Point = (Player 4 (Purple) start location)
                          • Unit - Create 1 Scythian Civ Center for Player 4 (Purple) at Point facing Default building facing degrees
                          • Unit - Create 1 Scythian Pack Horse for Player 4 (Purple) at Point facing Default building facing degrees
                          • Unit - Create 1 Scout for Player 4 (Purple) at Point facing Default building facing degrees
                          • Unit - Create 4 Scythian Villager for Player 4 (Purple) at Point facing Default building facing degrees
                          • AI - Start melee AI script for Player 4 (Purple): war3mapImported\AI Scythians.ai
                          • Custom script: call RemoveLocation(udg_Point)
                          • Game - Display to (All players) the text: Computer 4 (Purple)...
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Triggering unit)) Equal to |cffffcc00Celts|r
                            • Then - Actions
                              • Set Point = (Player 4 (Purple) start location)
                              • Unit - Create 1 Celtic Civ Center for Player 4 (Purple) at Point facing Default building facing degrees
                              • Unit - Create 1 Scout for Player 4 (Purple) at Point facing Default building facing degrees
                              • Unit - Create 5 Celtic Villager for Player 4 (Purple) at Point facing Default building facing degrees
                              • AI - Start melee AI script for Player 4 (Purple): war3mapImported\AI Celts.ai
                              • Custom script: call RemoveLocation(udg_Point)
                              • Game - Display to (All players) the text: Computer 4 (Purple)...
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Triggering unit)) Equal to |cffffcc00Macedonians|r
                                • Then - Actions
                                  • Set Point = (Player 4 (Purple) start location)
                                  • Unit - Create 1 Macedonian Civ Center for Player 4 (Purple) at Point facing Default building facing degrees
                                  • Unit - Create 1 Scout for Player 4 (Purple) at Point facing Default building facing degrees
                                  • Unit - Create 5 Macedonian Villager for Player 4 (Purple) at Point facing Default building facing degrees
                                  • AI - Start melee AI script for Player 4 (Purple): war3mapImported\AI Macedonians.ai
                                  • Custom script: call RemoveLocation(udg_Point)
                                  • Game - Display to (All players) the text: Computer 4 (Purple)...
                                • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to |cffffcc00Romans|r
                    • Then - Actions
                      • Set Point = ((Owner of (Triggering unit)) start location)
                      • Unit - Replace (Triggering unit) with a Roman Civ Center using The old unit's relative life and mana
                      • Unit - Create 1 Scout for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                      • Unit - Create 5 Roman Villager for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                      • Custom script: call RemoveLocation(udg_Point)
                      • Player - Make Scythian Colony Unavailable for training/construction by (Owner of (Triggering unit))
                      • Player - Make Celtic Colony Unavailable for training/construction by (Owner of (Triggering unit))
                      • Player - Make Macedonian Colony Unavailable for training/construction by (Owner of (Triggering unit))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Triggering unit)) Equal to |cffffcc00Scythians|r
                        • Then - Actions
                          • Set Point = ((Owner of (Triggering unit)) start location)
                          • Unit - Replace (Triggering unit) with a Scythian Civ Center using The old unit's relative life and mana
                          • Unit - Create 1 Scout for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                          • Unit - Create 1 Scythian Pack Horse for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                          • Unit - Create 4 Scythian Villager for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                          • Custom script: call RemoveLocation(udg_Point)
                          • Player - Make Roman Colony Unavailable for training/construction by (Owner of (Triggering unit))
                          • Player - Make Celtic Colony Unavailable for training/construction by (Owner of (Triggering unit))
                          • Player - Make Macedonian Colony Unavailable for training/construction by (Owner of (Triggering unit))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Triggering unit)) Equal to |cffffcc00Celts|r
                            • Then - Actions
                              • Set Point = ((Owner of (Triggering unit)) start location)
                              • Unit - Replace (Triggering unit) with a Celtic Civ Center using The old unit's relative life and mana
                              • Unit - Create 1 Scout for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                              • Unit - Create 5 Celtic Villager for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                              • Custom script: call RemoveLocation(udg_Point)
                              • Player - Make Scythian Colony Unavailable for training/construction by (Owner of (Triggering unit))
                              • Player - Make Roman Colony Unavailable for training/construction by (Owner of (Triggering unit))
                              • Player - Make Macedonian Colony Unavailable for training/construction by (Owner of (Triggering unit))
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Triggering unit)) Equal to |cffffcc00Macedonians|r
                                • Then - Actions
                                  • Set Point = ((Owner of (Triggering unit)) start location)
                                  • Unit - Replace (Triggering unit) with a Macedonian Civ Center using The old unit's relative life and mana
                                  • Unit - Create 1 Scout for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                                  • Unit - Create 5 Macedonian Villager for (Owner of (Triggering unit)) at Point facing Default building facing degrees
                                  • Custom script: call RemoveLocation(udg_Point)
                                  • Player - Make Scythian Colony Unavailable for training/construction by (Owner of (Triggering unit))
                                  • Player - Make Celtic Colony Unavailable for training/construction by (Owner of (Triggering unit))
                                  • Player - Make Roman Colony Unavailable for training/construction by (Owner of (Triggering unit))
                                • Else - Actions
                  • Player Group - Pick every player in (All players) and do (Actions)
                    • Loop - Actions
                      • Camera - Set the camera bounds for (Picked player) to (Initial camera bounds)
Edit: Played 3 games of a total around 2 hours on my advanced computer and everything worked flawlessly. So I guess it's a leak/overload issue and not some malfunctioning trigger. Can't say for sure thought, 3 games in a row without crash was still possible in the slow computer, with some lag though.
 
Last edited:
since ur learning how to clean leaks u should also make ur triggers more efficient.
anything u use twice or more like owner of triggering unit store it into a variable and use the variable. it is both faster and more efficient.

u can also reduce the size of ur bottom trigger and make it more efficient. u can use a loop to loop through the players to see if what each player has and apply it to the player that ur looping through.
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
Your problem is this dude and i am sure..

Since the random errors occur when your start cleaning the leaks..

-You clean some leak in a wrong way
-You remove a leak that causes the other trigger that use it to malfunction
-You use a loop in a wrong way.
-Or none of the above

Since your experiencing random crashes.. my suggestion is this.

When you experience the crash.. remember how do you that.. then look at the triggers that used by the recent crash..

Example

You get the error in the selection.. then go to your triggers on selection and look at everything carefully if some of the variables get mixed up..
There are actions that cause error even if it just misplaced..
 
Level 7
Joined
Apr 5, 2013
Messages
243
Doing a heavy check on my triggers and tutorials and I'm coming across some questions:

On two periodic triggers running every 60 seconds (or any two or more triggers that happen to run the same time) will using the same variable name cause a problem?

Will a player variable (not player group) leak? If so what command destroys it?

Also I've read that "All players" can cause problems when set into a variable and destroyed. Will "all players of control/matching condition/etc" have the same issue?

Is this causing an infinite loop?
  • Morale AttackerDefender
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Unit-type of (Triggering unit)) is Mechanical) Equal to False
    • Actions
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing ((Mana of (Attacking unit)) / 2.00) damage of attack type Normal and damage type Normal
      • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 1.00)
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 2.00)
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
Doing a heavy check on my triggers and tutorials and I'm coming across some questions:

On two periodic triggers running every 60 seconds (or any two or more triggers that happen to run the same time) will using the same variable name cause a problem?

Will a player variable (not player group) leak? If so what command destroys it?

Also I've read that "All players" can cause problems when set into a variable and destroyed. Will "all players of control/matching condition/etc" have the same issue?

Maybe.. because your using the same variable.. remember that 1 variable can only be used by a trigger at a time.. try to seperate it with Arrays..

No if you store it on a variable.. but if you dont it will cause an error..

I think the best way is use Player - Add to Player group.. or

If condition Player control is a (Ex. Computer Player) then add Player to Player Group X.. in this way you dont need to use All Players matching/controll.. but its harsh.. maybe just use it just remember not to abuse it..
 
Level 7
Joined
Apr 5, 2013
Messages
243
Maybe.. because your using the same variable.. remember that 1 variable can only be used by a trigger at a time.. try to seperate it with Arrays..

No if you store it on a variable.. but if you dont it will cause an error..

I think the best way is use Player - Add to Player group.. or

If condition Player control is a (Ex. Computer Player) then add Player to Player Group X.. in this way you dont need to use All Players matching/controll.. but its harsh.. maybe just use it just remember not to abuse it..

-Seems a bit strange. So if two triggers happen to fire at the same time for any reason, which should be pretty common, this brings up issues? Should I have for example 10 different player group variables (or do 10 arrays make it work like it's 10 variables?). To get it better, is there a need to change it for the following 2 triggers?

  • Coinage
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set PlayerGroup = (All players matching ((Current research level of Coinage for (Matching player)) Equal to 1))
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Player - Add (((Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of (Picked player)) Equal to True)))) + 0) x 100) to (Picked player) Current gold
      • Custom script: call DestroyForce(udg_PlayerGroup)
  • Market and colony income WIP
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Set PlayerGroup = (All players matching (((Matching player) slot status) Equal to Is playing))
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Player - Add ((Number of living Elephants units owned by (Picked player)) x 50) to (Picked player) Current gold
          • Player - Add ((Number of living Iron units owned by (Picked player)) x 50) to (Picked player) Current gold
          • Player - Add ((Number of living Horses units owned by (Picked player)) x 50) to (Picked player) Current gold
          • Player - Add ((Number of living Sea Trade Route units owned by (Picked player)) x 50) to (Picked player) Current gold
      • Custom script: call DestroyForce(udg_PlayerGroup)
-not sure what you mean here. using players as variables is ok and needs no leak fix, but not using them as variables causes errors?

-what do you mean by harsh? Resource heavy for the computer?

-What about my loop question (probably added it while you where posting:p
 
2 triggers can never fire at the same time in wc3.

wc3 runs one trigger then the next and so on.

if u use temp variables that u create and destroy or set to null at the end of triggers they will be fine.

no u dont have to change anything. although u should learn to make things more efficient.

for instance every 30 seconds ur counting the units the player has then multiplying the number and changing gold.
This is a bad way to do it.
instead have a trigger that fires when u create those units. then use a counter and do counter = counter + 1
now have a trigger that reduces the counter when a unit dies or is killed.
for ur money income just do counter * 50 and add that to the players gold. this way u could get rid of the player group.
 
Level 7
Joined
Apr 5, 2013
Messages
243
Thanks for clearing some things up:)

Still more questions:
1) Is this an infinite loop like the one in chapter 3 of your tutorial?
  • Morale AttackerDefender
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Unit-type of (Triggering unit)) is Mechanical) Equal to False
    • Actions
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing ((Mana of (Attacking unit)) / 2.00) damage of attack type Normal and damage type Normal
      • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 1.00)
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 2.00)
2) some things still seem too hard for me. For example couldn't figure out how to make the big trigger more efficient with a loop, or the last one with a counter. Something to do with arrays (which I'm not really into yet)?
3) Those things on the last trigger are pre-existing special resources (capturable structures). Usually they are lost to other players so that's why the count is needed.
4) Player (not player group) variebles. Are they efficient and do they need destruction, if so, how (can't seem to find a function) If not, will next trigger using the same "player" variable work ok?
5) Destroying point = start location, will it cause problems?
 
1) I think it might be easiest way to find out is test it and see if it crashes the game.
2) lets start with the counter u need an integer array for this. Ill call it counter (change name). For the index the thing in this [] use player number of triggering player. Here is what it should look like.
  • Set tempInt = (player number of (triggering player))
  • Set counter[tempInt] = counter[tempInt] + 1
that is how u add things then do minus for subtracting things.
3) that will work u just need different events. Basically trigger it when it is captured by a new person and subtract from the old person.
4) they are efficient and u don't destroy them u can null them however.
5) if u it again I believe it will cause a crash not really sure about that tho.
 
Status
Not open for further replies.
Top