Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: spirit1flyer on September 25, 2005, 09:16:05 PM

Title: Placing Bases?
Post by: spirit1flyer on September 25, 2005, 09:16:05 PM
I have the code to place four bases on the map but I don't know how to make them farther apart. this is my code that I am using, How do I make it so I can place the bases were I want them or place them farther apart?

int InitProc()
{
   int i;

   // Randomize starting locations
   RandomizeStartingLocations(autosize(startLocation));

   // Place all bases on the map
   for (i = 0; i < TethysGame::NoPlayers(); i++)
   {
      InitPlayerResources(i);

      StartLocation &sLoc = startLocation;
      CreateBase(i, sLoc.x, sLoc.y, *sLoc.baseInfo);
      Player.CenterViewOn(sLoc.x, sLoc.y);
   }


Spirit
Title: Placing Bases?
Post by: Hooman on September 25, 2005, 09:46:30 PM
Well, I assume you mean you'd like to keep the layouts of the bases the same, but change where they are created. To do that, just change the base coordinates in the startLocation array. It was placed at the end of BaseData.h.

 
Title: Placing Bases?
Post by: spirit1flyer on September 25, 2005, 10:21:17 PM
I don't realy care how the bases are laid out I am just learning how to do things. Like placing bases, adding units and setting mission goals


I think you have straightened out this for me but if not I will be back  :P

spirit
Title: Placing Bases?
Post by: Leviathan on September 26, 2005, 05:43:54 AM
Look at the BaseData.h file. The whole bases r moved around on the map with the start location cord. You change this and the whole base moves. The cords in the base sections, buildings, units etc are cords which are on top of the start location cords in the base data. So if a star location is 10,10 and a unit's cords say 10,5 then it will end up at 20,15 on the map. If you change the start location to 50,50 then the unit will be at 60,55.
Title: Placing Bases?
Post by: spirit1flyer on September 26, 2005, 10:06:06 AM
Quote
BaseData.h

Who! I guess I know why all the changes I did were not working  :P  I missed that file name the other day. I was trying to do it in OP2Script  :lol:



so all I have to do is change *49, 14,* to anything else to move a base?


struct StartLocation startLocation[] =
{
   { 49,  14, &base[0]},
   {142,  14, &base[1]},
   { 49, 112, &base[2]},
   {142, 112, &base[3]}
};


And what do the numbers at the end of this code right after mapNone, control?

                {  4,  10, mapConVec,      mapNone, 3},
   {  7,  10, mapConVec,      mapNone, 1},
   { 10,  -6, mapCargoTruck,      mapNone, 0},
   { 10,  -4, mapCargoTruck,      mapNone, 1},
   {  8,  -4, mapCargoTruck,      mapNone, 2},
   { 12,  -6, mapRoboSurveyor,      mapNone, 7},
   { 12,  -4, mapRoboMiner,      mapNone, 7},
   {  3,   1, mapEarthworker,      mapNone, 1},
   {  3,  -1, mapRoboDozer,      mapNone, 7}
   {  6,  -2, mapRepairVehicle,                        mapNone,


Spirit
Title: Placing Bases?
Post by: Eddy-B on September 26, 2005, 12:02:32 PM
This is the section you need to change
Quote
struct StartLocation startLocation[] =
{
  { 49, 14, &base[0]},
  {142, 14, &base[1]},
  { 49, 112, &base[2]},
  {142, 112, &base[3]}
};
it determines where the bases are built. They are now at change those coordinates to set new base positions. Bear in mind that a (31,-1) offset is to be used when converting actual coordinates into the ones used in the c++ code; so 49,14 translates to 18,15 in-game and so on.
Title: Placing Bases?
Post by: BlackBox on September 26, 2005, 02:09:11 PM
Those numbers after mapNone, etc in the vehicle data controls the rotation of the unit. 0 = pointing toward the right.

There are definitions for each direction in one of the .h files somewhere. (Open the Include\ folder that came with the SDK and take a look)

BTW: When you post code in a forum post, enclose it in [ code ][ /code ] tags (without the extra spaces).. It's a lot easier to read.
Title: Placing Bases?
Post by: spirit1flyer on September 26, 2005, 03:31:43 PM
Thanks for all the help  :)  
Title: Placing Bases?
Post by: spirit1flyer on September 26, 2005, 05:59:03 PM
I tried adding a panther but it jammed on me. What do I need to do to have a Microwave Panther?
Here is the code I first used:

Code: [Select]
{  3,  -8, mapMicroPanther,          mapNone, 0},



spirit
Title: Placing Bases?
Post by: Leviathan on September 26, 2005, 07:07:32 PM
add mapPanther, mapMicrowave for that.

open MapIdEnum.h and you will find the unit and wep list etc.

hf
Title: Placing Bases?
Post by: spirit1flyer on September 26, 2005, 07:20:46 PM
okay thanks. Now I have ran into another problem, I loaded the file and tried firing the panther. It fired two times and then I tried to move the unit and Outpost 2 jammed?


spirit
Title: Placing Bases?
Post by: Eddy-B on September 27, 2005, 11:51:15 AM
please post the whole cpp file > these are just bits and pieces, which makes it hard to determine what goes wrong. For one thing: make sure the units are ON the map. The 3,  -8 on the panther uses the offset from the struct StartLocation, and it needs the x to be >31 (as i've mentioned - the 31,-1 offset)
Title: Placing Bases?
Post by: spirit1flyer on September 27, 2005, 09:57:41 PM
I got it solved, It was just the map that was the problem. and Lev helped me with it in another post but thanks anyway


spirit