hi,
I'm doing a micro tournament map for 8 Players..
Round1 triggers
Camera - Pan the camera for player 1 to spieler1 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 2 to spieler2 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 3 to spieler3 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 4 to spieler4 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 5 to spieler5 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 6 to Spieler6 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 7 to Spieler7 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 8 to Spieler8 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Unit - Create 8 Zergling for player 1 at spieler1 using default facing (No Options)
Unit Group - Add (Last created unit) to EinheitenGruppeSpieler1
Unit - Create 8 Zergling for player 2 at spieler2 using default facing (No Options)
Unit Group - Add (Last created unit) to EinheitenGruppeSpieler2
Unit - Create 8 Zergling for player 3 at spieler3 using default facing (No Options)
Unit Group - Add (Last created unit) to EinheitenGruppeSpieler
It seems to me very bad way of working with triggers cause the whole code duplicated.
I mean in e.g. Java i make a function and call it if i need the code. I can't imagine that this solutions isnt implicated in the galaxy editor
Create a function (it's called: action) that does that for a given player (parameter) and execute everything for the player#.
Just like in Java...
Functions are your friends. Use and love them! I've like 25 triggers for 300 functions in my map.
Use a switch, if your actions differ for each player. But you can use an array and just read something out of the array based on the player#.
I'm using "p#-1" (player number - 1) in nearly every function I've created.
There seems to be some room to improvement. You could add stuff to variables and then use them from there...and I would use loops or action definitions to do most of the stuff.
you could do something like
Pick each integer from 1 to 14
modify tmpint +1
create unit for picked integer at (region[tmpint])
or something like that. I wouldnt say it would be more optimal, but easier to modify and read atleast. Dunno if I can give better advicement since there are so many actions there dont wana try to do them all. Loops and action definitions are your friends!
Create a function (it's called: action) that does that for a given player (parameter) and execute everything for the player#. Just like in Java...
Functions are your friends. Use and love them! I've like 25 triggers for 300 functions in my map. Use a switch, if your actions differ for each player. But you can use an array and just read something out of the array based on the player#. I'm using "p#-1" (player number - 1) in nearly every function I've created.
Store your cameras into an array at map initialization, then use a for loop to loop through each player.
Use arrays to map the player numbers a well, for example,
PlayerArray[8], has values 1 -> 8, whilst EnemyArray[8] has 0,9-15
So you can loop it later with an integer i.
For i = 0 to 7
Player - Make player PlayerArray[i] and EnemyArray[i] treat each other as Enemy With Shared Vision
Well basically.. Store all your stuff into arrays, its much easier to loop them that way.
The player array is pointless. The "player" is actually a player's index number, not the name or some other type of identifier. In the above code you posted this is what is going on in the array:
The player array is pointless. The "player" is actually a player's index number, not the name or some other type of identifier. In the above code you posted this is what is going on in the array:
hi,
I'm doing a micro tournament map for 8 Players..
Round1 triggers
Camera - Pan the camera for player 1 to spieler1 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 2 to spieler2 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 3 to spieler3 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 4 to spieler4 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 5 to spieler5 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 6 to Spieler6 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 7 to Spieler7 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Pan the camera for player 8 to Spieler8 over 0.3 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Unit - Create 8 Zergling for player 1 at spieler1 using default facing (No Options)
Unit Group - Add (Last created unit) to EinheitenGruppeSpieler1
Unit - Create 8 Zergling for player 2 at spieler2 using default facing (No Options)
Unit Group - Add (Last created unit) to EinheitenGruppeSpieler2
Unit - Create 8 Zergling for player 3 at spieler3 using default facing (No Options)
Unit Group - Add (Last created unit) to EinheitenGruppeSpieler
It seems to me very bad way of working with triggers cause the whole code duplicated.
I mean in e.g. Java i make a function and call it if i need the code. I can't imagine that this solutions isnt implicated in the galaxy editor
@bookerTier: Go
Create a function (it's called: action) that does that for a given player (parameter) and execute everything for the player#. Just like in Java...
Functions are your friends. Use and love them! I've like 25 triggers for 300 functions in my map. Use a switch, if your actions differ for each player. But you can use an array and just read something out of the array based on the player#. I'm using "p#-1" (player number - 1) in nearly every function I've created.
There seems to be some room to improvement. You could add stuff to variables and then use them from there...and I would use loops or action definitions to do most of the stuff.
you could do something like Pick each integer from 1 to 14 modify tmpint +1 create unit for picked integer at (region[tmpint])
or something like that. I wouldnt say it would be more optimal, but easier to modify and read atleast. Dunno if I can give better advicement since there are so many actions there dont wana try to do them all. Loops and action definitions are your friends!
Can you paste just an example code plz ?
Weird that no one has mentioned the most obvious ones yet.
Here's how to optimize the Pan Camera command
It's pretty messy and I can't read what you want to do with the create unit and add to unit group, but you can do this:
You would have to make EinhenteinGruppeSpieler an Array, and do the same for the other units.
@bookerTier: Go
Store your cameras into an array at map initialization, then use a for loop to loop through each player.
Use arrays to map the player numbers a well, for example, PlayerArray[8], has values 1 -> 8, whilst EnemyArray[8] has 0,9-15
So you can loop it later with an integer i.
For i = 0 to 7
Player - Make player PlayerArray[i] and EnemyArray[i] treat each other as Enemy With Shared Vision
Well basically.. Store all your stuff into arrays, its much easier to loop them that way.
@FuzzYD: Go
thanks i'll try
hm not working
The PlayerArray got size 5
Do i've to add more params?
I attached the map.
I pasted the pan camera code to the initialization. The other things are in the folder Round 1
@bookerTier: Go
The player array is pointless. The "player" is actually a player's index number, not the name or some other type of identifier. In the above code you posted this is what is going on in the array:
I hope you see the problem.
Try replacing the "PlayerArray" array with just numbers for starters.
Yea i already solved it but forgot to say so
anyways thanks!