Author Topic: Initial Units  (Read 1535 times)

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Initial Units
« on: September 08, 2005, 06:11:39 AM »
How do you setup initial units for your multi map??

I know ZigHooVille has it done but I'd like it to be explaned so I know how to add them, and info should be put on the wiki on a coding page.

Quote
[ 21:55:10 ]  [ wizisi2k ] LEV
[ 21:55:20 ]  [ wizisi2k ] there's a bug with the greenville maps
[ 21:55:32 ]  [ wizisi2k ] instgator clicked 12 start lynx AND WE HAVE NONE
[ 21:56:45 ]  [ +Instigator2 ] hmm
[ 21:56:51 ]  [ @OPU|Leviathan ] what
[ 21:56:51 ]  [ +Instigator2 ] yyeah i dont know why
[ 21:56:56 ]  [ @OPU|Leviathan ] yes
[ 21:56:59 ]  [ wizisi2k ] read what I wrote
[ 21:57:01 ]  [ @OPU|Leviathan ] thats cuz
[ 21:57:08 ]  [ @OPU|Leviathan ] i coded 0 united at the start
[ 21:57:14 ]  [ @OPU|Leviathan ] unnnits *
[ 21:57:18 ]  [ wizisi2k ] NOW u tell us
[ 21:57:23 ]  [ +Instigator2 ] LOL
[ 21:57:25 ]  [ @OPU|Leviathan ] its not a bug
[ 21:57:29 ]  [ @OPU|Leviathan ] just a missing feature
[ 21:57:41 ]  [ wizisi2k ] ah
« Last Edit: September 08, 2005, 04:03:41 PM by Leviathan »

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
Initial Units
« Reply #1 on: September 10, 2005, 03:11:51 PM »
This should create 12 lynx, nicely lined up.
(x,y) is the player starting location:
Code: [Select]
int i;
Unit u;

for (i=0; i<12; ++i)
{
  TethysGame::CreateUnit(u,mapLynx,LOCATION(x+i,y),playernum,mapMicrowave,0);
}
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Initial Units
« Reply #2 on: September 10, 2005, 03:29:37 PM »
Oh hey, I misread this the first time I saw it. Use TethysGame::InititalUnits() to find out how many you should create.

Stealing Eddy's code example above, you can try something like this:
Code: [Select]
int i;
Unit u;

for (i=0; i<TethysGame::InitialUnits(); ++i)
{
 TethysGame::CreateUnit(u,mapLynx,LOCATION(x+i,y),playernum,mapMicrowave,0);
}