Trigger inconsistencies?

Dr Super Good

Spell Reviewer
Level 62
Joined
Jan 18, 2005
Messages
27,048
The problem is you try removing the creep before removing
Environment - Remove Normal creep at (Center of (Entire map)), with radius 999999995904.0
Player Group - Pick each player in (All players) and do (Actions)
Actions
General - For each integer ForEachCount[6] from 1 to 88 with increment 1, do (Actions)
Actions
Tech Tree - Set AllUpgrades[ForEachCount[6]] upgrade level to 0 for player (Picked player)
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Remove (Picked unit) from the game


The problem is you try and remove the creep before removing all the buildings. Creep with no buildings or from overlords should be getting removed, but around living zerg buildings the creep should be remaining. Swap the order to fix (I hope).

Change Neutralize Map to a function, as it does not have any events.

General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Picked unit)) == Destructible Rocks - 2x6 Vertical
Then
Variable - Set ResourceCount[13] = (ResourceCount[13] + 1)
Variable - Set DestructibleRocks2x6VPoint[ResourceCount[13]] = (Position of (Picked unit))
Break this into a function and then call it repetitivly passing it the variables that change. This would reduce procedural coupling and make editing the code easier.

General - For each integer ResourceCount[12] from 1 to ResourceCount[12] with increment 1, do (Actions)
Actions
Unit - Create 1 Destructible Rocks - 2x6 Horizontal for player 0 at DestructibleRocks2x6HPoint[ResourceCount[12]] using default facing (Ignore Placement)
Unit Group - Add (Last created unit) to NeutralUnits
Like the above, you could reduce procedural coupling my outsourcing this to a function and just changing the arguments.

Setup Teams can be made a function as it does not take advantage of the observer functionality triggers provide.

You also heavilly abuse arrays where array functionality is not required. Rather make a struct (database or something in GUI) and make them all separate entries. Arrays are slower than normal variables do to the extra complexity they have. An example which would most benifit from this is ActivePlayers as I see a lot of static references to a particualr index.

Arrays run from 0 to arraysize-1 so an array of size 10 has indexes 0...9.

For your creep removal, consider a smaller radius as it might not be able to handle that complexity. 200 should suffice as each square is 1 unit in SC2.
 
Level 4
Joined
Aug 14, 2007
Messages
66
Thanks for the input, I moved the creep removal down below the remove all units action and it definitely worked better but it still left patches behind for some reason. I simply put the creep removal action into my countdown trigger so that it performed several times between matches and that fixed it.

However I am still having some trouble with my game selecting neutral as one of the players which is very frustrating because it isnt entered anywhere that 0 should be one of the chosen players. Its like the game is just doing its own thing despite my code.

I changed activeplayers[] to activeplayer1 and activeplayer2 and made ForEachCount no longer an array. I am not familiar with using functions so I think im going to hold off on attempting that until I get these triggers to work as intended.

I have edited my above post to display my current triggers.
 
The only thing I can think of..

<Setup Teams>
**Creates starting units for selected players and launches the match**



Player Group - Reset PlayerBatch to have no players

You're telling the group to have no players, so when you run the trigger random integer between 1 and PlayerBatch its doing between Player 1 and 0.

It may appear that your code is working if you're testing by yourself and thus there is only player 1.
If you test the game with other players you may notice (if I'm correct) that only you and neutral will ever get selected.

Hope that helps.
 
Level 4
Joined
Aug 14, 2007
Messages
66
Alright I seem to have solved the problem with neutral being selected and now all that remains is giving priority to the player who had won the most recent match if they are opted in for the next match.

If anyone could help me out with that it'd be greatly appreciated. I have updated my triggers and weeded out some of the actions that aren't necessary to lessen the length.

Thanks again for your time.
 
Well you set your triggers up differently than I do in many ways, so in a sense I won't even start to read your triggers.
However, if you want to create a priority system, just make a trigger that only randomizes the second player number, should the first player active = true.
So.. create an integer variable.. name it P1 Active - True (I always use integers, not true/false, so I can go in and create more options later on). Have it initially set to 1 (or 0, if you want to have some other event in the game trigger it to 1 *true*), and if the player leaves, set it to 0.

If
P1 Active = 1
Then
Randomize P2

If
P1 Active = 0
Then
Randomize P1 & P2
 
Level 4
Joined
Aug 14, 2007
Messages
66
Well I actually do that in my countdown trigger, but it doesnt seem to work.

  • General - If (Conditions) then do (Actions) else do (Actions)
    • If
      • (ActivePlayer1 is in PlayerBatch) == true
    • Then
      • Player Group - Remove player ActivePlayer1 from PlayerBatch
      • Variable - Set ActivePlayer2 = (Player (Random integer between 1 and (Number of players in PlayerBatch)) from PlayerBatch)
      • Player Group - Remove player ActivePlayer2 from PlayerBatch
    • Else
      • Variable - Set ActivePlayer1 = (Player (Random integer between 1 and (Number of players in PlayerBatch)) from PlayerBatch)
      • Player Group - Remove player ActivePlayer1 from PlayerBatch
      • Variable - Set ActivePlayer2 = (Player (Random integer between 1 and (Number of players in PlayerBatch)) from PlayerBatch)
      • Player Group - Remove player ActivePlayer2 from PlayerBatch
 
Top