| 07-31-2002, 09:47 AM | #1 |
Guest | I want to make a trigger that gives a unit to the player with the most units in a certain region. It seems like this shouldn't be very hard but so far I haven't figured out a way to do it. Any help is appreciated... thx! -John |
| 07-31-2002, 09:06 PM | #2 |
Guest | by the way.. by this i mean to give CONTROL of a specific unit to a player not create a unit for a player. thx |
| 08-01-2002, 06:46 AM | #3 |
uh, how about making an integer array and every whatever seconds set variables unitcount[Player Number of Player(x)] = to the number of units in the region matching codition units owned by (player x). then do a series of if statements to say if unitcount[1] > unitcount[2] then if unitcount[1] > unitcount[3] then change ownership of unit to player 1. else do nothing, else do nothing. then do another if statement with 2 > 1, 2 > 3, etc for all the players. im pretty sure theres an ezier way to do it, but this works. |
| 08-01-2002, 08:20 AM | #4 |
Guest | to tell you the truth I'm not really sure what exactly arrays are and how they work... is there a simple explanation? |
| 08-01-2002, 01:05 PM | #5 |
Well, ive made a trigger that looks at how many units 2 player groups have there, the problem is, that you probably have more then 2 players/player groups? THen indeed the only solution it so use an array. Ok you asked what an array is: An array is an matrix, a bit like a variable, but has multiple variables stored in one, for example an array starts at Playername[1], and goes to playername[4], now if you read the data from the array, playername[1] will be Wiebbe, playername[2] will be Data, playername[3] will be Stonedog , and so on, so in stead of using 4 diffrent variables you can use one array, and store data in all the diffrent numbers. In theory it should be infinite, but i guess waredit doesnt go that far :P I use it to store players name, players colors, players kills, and alot more like that :) example for player names: Here, this works perefctly, just create a string array, named playername :) |
| 08-01-2002, 10:44 PM | #6 |
Guest | Ok... so how would I use an array to check what player has the most units in a region... this map is a 4 player map... really appreciate the help. Thx! |
