Alright, my only hesitation is that I only need one ability per unit... with the switch effect, do I need to give each unit all of the abilities first? or does the switch effect actually grant a new ability to a unit so long as it doesn't exceed a cap?
You could also just have a value for each unit, and then divide say 10,000 by the total of those values and that gives you a breakdown of the chance to hit on each of those pieces.
It's not as elegant as specifying a specific odds value, but the higher the number value you give it, the better chance it will have.
What if there was a copy of the unit, and then split the amount of abilities up between them ensuring they are both under the limit, and then randomly choosing one of the units to disallow in the unit-train-ability of the production unit?
It fudges the odds a little bit, but maybe that's close enough? The unit will only ever use one ability per game, so to have an ability limit enforced based on abilities that he'll never use that game seems rough.
Is there a way to give a unit an ability through a behavior, without setting that ability up through the unit's data entry itself? I'm trying to give several units random abilities without repeats, across the whole unit type - with the ability limit being a problem.
Generally speaking, picking random numbers and then checking to see if it's already taken or not is bad practice, because hypothetically speaking, you could run into a really long search for a working number. It's not likely, but it's possible to guess all taken numbers for hours on end.
What I would suggest is to store the values into an array, shuffle them, and then draw from the array. That way, you're guaranteed to get a unique number every time you draw from it, and you only need to draw from it when you want to.
For example:
//this fills an array with the available values to choose fromGeneral-Pickeachintegerfrom1toMaxChoices,anddo(Actions)ActionsVariable-SetL_ChoicesArray[(Pickedinteger)]=(Pickedinteger)//this shuffles the values in the array by picking each field in the array and swapping it with a random field value throughout the entire arrayGeneral-Pickeachintegerfrom1toMaxChoices,anddo(Actions)ActionsVariable-SetL_RandomInteger=(Randomintegerbetween1andMaxChoices)-------CommentVariable-SetL_Freecell=L_ChoicesArray[L_RandomInteger]Variable-SetL_ChoicesArray[L_RandomInteger]=L_ChoicesArray[(Pickedinteger)]Variable-SetL_ChoicesArray[(Pickedinteger)]=L_Freecell
Now that the values in the array are shuffled, whenever you need a random unique number all you need to do is grab at the array. Depending on how you have your map set up there are a few different ways to do that. If everyone is going to have a randomized hero every single time then all you would need to do is loop through each player and use the value in the array that matches their player number (or number in player group (active players)). Pick each player and do:
I haven't mentioned player colors in triggers AT ALL, and all the player properties are set to default - yet in about 1 of every 12 games of my custom map that i play, one of the players ends up as the SAME color as a computer player. Has anyone else noticed this? I'm starting to think that it has something to do with my triggers being written for the patch (maybe they've added new features to how the player colors are chosen?). Any ideas? Or better yet, has this happened to anyone else?
So the "simple" version would actually be smaller than the "advanced" version; it's less information, but it takes up less screen space. As far as I know, you can't change the size of a dialog for a specific player only eh? So unless I'm mistaken, that would require 2 separate dialogs.
Secondly, since one shows information about all players, and the other shows things about just that one player, without too many duplicate lines of code, I would need two arrays of dialog items, one for each dialog, each containing the same information. Unless you can think of something more efficient. Sorry I wasn't more specific in my op.
EDIT
So I guess now that I think about it, I should be able to just have a single array of dialog items because all the information is exactly the same for all players, I'm just changing the visibility of it all? Hmm I've never tried to do that before.
So what you're saying is have a single dialog for the "simple" version, but keep an array of dialog items, one for each player, and then show each player their own item?
For my map, I'm trying to set up a better dialog to show game information. On the "advanced" dialog, i want to show the "bonus" value which is the same for all players, as well as each players current mineral count.
Bonus: 10
Player 1 Minerals: 1000
Player 2 Minerals: 948
Player 3 Minerals: 1100
...
On the "simple" dialog, I want to show the "bonus" number and JUST the specific player's mineral count.
Bonus: 10
Your Minerals: 1000
...
Since the "advanced" dialog is the same for all players, it can just be 1 that's shown to all players. And then the "simple" dialog would be an array of dialogs - one for each player (because each one shows specific player information to just that player). Does that sound like the best way to set that up?
This is my first map that I'm proud enough to post about!
Conquest is a game of strategy and timing. I describe it as a mix between Risk the board game and Risk the SC1 game. It's faster paced than the SC1 version as it's more "arena" like than the world map.
Each territory has a Warp Gate in it and killing an enemy Warp Gate gains control of it. It also awards you a random amount of Vespene Gas that you can spend on specials such as Calldown:Immortals or turn in a SET which allows you to spawn bonus troops at any of your Warp Gates.
And just like in the board game, the SET's get bigger every time any player uses it.
There are a limited amount of spells that will help you get back into the fight if you fall behind, but there's no substitute for well placed and faught armies.
Players win by controlling all 25 Warp Gates on the map.
Give it a try, and let me know what you think! Search the Arcade for "Conquest CTM" or...
Go into SC2, and open a chat, type this link in and it'll take you to the map description!
starcraft://map/1/201174
Correct :) It would depend on the amount of overlapped space compared to non-overlapped space. So let's say that you had 2 separate regions of the same size, and they were overlapping by half. If you're choosing to spawn a unit into just one of those regions, then the odds are 50/50 that it will be in the area that is overlapping, because half of the whole region is. If you're spawning a unit into one of the two regions randomly, you're still getting 50/50 odds, because that would imply 4 possible outcomes, 2 of which being in the overlapping section.
If it's a merged region, then it's being treated as one region and there is no overlapping area anymore.
I just thought I would post this in case anyone else needs something similar.
Basically what is happening here is I populate an array with random numbers within a range, without repeating any numbers.
I know it can be simplified (use less lines of code) but I broke it out to hopefully make it easier to understand and learn from. Enjoy, and feel free to comment.
CustomScriptCodeLocalVariablesL_ClearArray=0<Integer[10]>
L_ShuffledArray = 0 <Integer[10]>
L_TotalPicksAllowed = 0 <Integer>
L_TotalLeftToPick = 0 <Integer>
L_RandomInt = 0 <Integer>
Actions
------- This determines how many numbers you want to pick randomly
Variable - Set L_TotalPicksAllowed = 10
------- This will be used to keep track of how many more need to be picked
Variable - Set L_TotalLeftToPick = L_TotalPicksAllowed
------- This sets the ClearArray[] to 1[1], 2[2], 3[3]... 10[10]
General - Pick each integer from 1 to 10, and do (Actions)
Actions
Variable - Set L_ClearArray[(Pickedinteger)] = (Picked integer)
------- This chooses random values (quantity of random choices is determined by L_TotalPicksAllowed)
------- from the L_ClearArray and then removes them from being within range of being picked again
General - Pick each integer from 1 to L_TotalPicksAllowed, and do (Actions)
Actions
Variable - Set L_RandomInt = (Random integer between 1 and L_TotalLeftToPick)
Variable - Set L_ShuffledArray[(Pickedinteger)] = L_ClearArray[L_RandomInt]
Variable - Set L_ClearArray[L_RandomInt] = L_ClearArray[L_TotalLeftToPick]
Variable - Modify L_TotalLeftToPick: - 1
0
@DrSuperEvil: Go
Alright, my only hesitation is that I only need one ability per unit... with the switch effect, do I need to give each unit all of the abilities first? or does the switch effect actually grant a new ability to a unit so long as it doesn't exceed a cap?
0
You could also just have a value for each unit, and then divide say 10,000 by the total of those values and that gives you a breakdown of the chance to hit on each of those pieces.
It's not as elegant as specifying a specific odds value, but the higher the number value you give it, the better chance it will have.
0
What if there was a copy of the unit, and then split the amount of abilities up between them ensuring they are both under the limit, and then randomly choosing one of the units to disallow in the unit-train-ability of the production unit?
It fudges the odds a little bit, but maybe that's close enough? The unit will only ever use one ability per game, so to have an ability limit enforced based on abilities that he'll never use that game seems rough.
0
Is there a way to give a unit an ability through a behavior, without setting that ability up through the unit's data entry itself? I'm trying to give several units random abilities without repeats, across the whole unit type - with the ability limit being a problem.
0
Generally speaking, picking random numbers and then checking to see if it's already taken or not is bad practice, because hypothetically speaking, you could run into a really long search for a working number. It's not likely, but it's possible to guess all taken numbers for hours on end.
What I would suggest is to store the values into an array, shuffle them, and then draw from the array. That way, you're guaranteed to get a unique number every time you draw from it, and you only need to draw from it when you want to.
For example:
Now that the values in the array are shuffled, whenever you need a random unique number all you need to do is grab at the array. Depending on how you have your map set up there are a few different ways to do that. If everyone is going to have a randomized hero every single time then all you would need to do is loop through each player and use the value in the array that matches their player number (or number in player group (active players)). Pick each player and do:
0
I haven't mentioned player colors in triggers AT ALL, and all the player properties are set to default - yet in about 1 of every 12 games of my custom map that i play, one of the players ends up as the SAME color as a computer player. Has anyone else noticed this? I'm starting to think that it has something to do with my triggers being written for the patch (maybe they've added new features to how the player colors are chosen?). Any ideas? Or better yet, has this happened to anyone else?
0
@BasharTeg: Go
So the "simple" version would actually be smaller than the "advanced" version; it's less information, but it takes up less screen space. As far as I know, you can't change the size of a dialog for a specific player only eh? So unless I'm mistaken, that would require 2 separate dialogs.
Secondly, since one shows information about all players, and the other shows things about just that one player, without too many duplicate lines of code, I would need two arrays of dialog items, one for each dialog, each containing the same information. Unless you can think of something more efficient. Sorry I wasn't more specific in my op.
EDIT
So I guess now that I think about it, I should be able to just have a single array of dialog items because all the information is exactly the same for all players, I'm just changing the visibility of it all? Hmm I've never tried to do that before.
0
@BasharTeg: Go
So what you're saying is have a single dialog for the "simple" version, but keep an array of dialog items, one for each player, and then show each player their own item?
0
For my map, I'm trying to set up a better dialog to show game information. On the "advanced" dialog, i want to show the "bonus" value which is the same for all players, as well as each players current mineral count.
Bonus: 10 Player 1 Minerals: 1000 Player 2 Minerals: 948 Player 3 Minerals: 1100 ...
On the "simple" dialog, I want to show the "bonus" number and JUST the specific player's mineral count.
Bonus: 10 Your Minerals: 1000 ...
Since the "advanced" dialog is the same for all players, it can just be 1 that's shown to all players. And then the "simple" dialog would be an array of dialogs - one for each player (because each one shows specific player information to just that player). Does that sound like the best way to set that up?
0
This is my first map that I'm proud enough to post about!
Conquest is a game of strategy and timing. I describe it as a mix between Risk the board game and Risk the SC1 game. It's faster paced than the SC1 version as it's more "arena" like than the world map.
Each territory has a Warp Gate in it and killing an enemy Warp Gate gains control of it. It also awards you a random amount of Vespene Gas that you can spend on specials such as Calldown:Immortals or turn in a SET which allows you to spawn bonus troops at any of your Warp Gates.
And just like in the board game, the SET's get bigger every time any player uses it.
There are a limited amount of spells that will help you get back into the fight if you fall behind, but there's no substitute for well placed and faught armies.
Players win by controlling all 25 Warp Gates on the map.
Give it a try, and let me know what you think! Search the Arcade for "Conquest CTM" or...
Go into SC2, and open a chat, type this link in and it'll take you to the map description! starcraft://map/1/201174
0
@BasharTeg: Go
Correct :) It would depend on the amount of overlapped space compared to non-overlapped space. So let's say that you had 2 separate regions of the same size, and they were overlapping by half. If you're choosing to spawn a unit into just one of those regions, then the odds are 50/50 that it will be in the area that is overlapping, because half of the whole region is. If you're spawning a unit into one of the two regions randomly, you're still getting 50/50 odds, because that would imply 4 possible outcomes, 2 of which being in the overlapping section.
If it's a merged region, then it's being treated as one region and there is no overlapping area anymore.
0
I just thought I would post this in case anyone else needs something similar.
Basically what is happening here is I populate an array with random numbers within a range, without repeating any numbers.
I know it can be simplified (use less lines of code) but I broke it out to hopefully make it easier to understand and learn from. Enjoy, and feel free to comment.
0
I do not believe that Array[i] = RegionFromId(i) is possible. At some point you will have to physically set them to variables somewhere.
0
Since it's a dialog, and not an actual leaderboard element, you'll have to re-populate the dialog every time you want it updated.
So the loop that you use to fill out all the variable values, you'll want to run that again with the new order of players based on current kills.
That sounds like a lot of updating to me though.
0
@Bommes: Go
Awesome! Thanks, that did the trick perfectly. Now on to the next problem/thread! hehe