News:

We've upgraded the forum software.
You may need to log in again or reset your password!

Main Menu

I Need Coding Help

Started by Angellus Mortis, July 19, 2009, 09:00:05 AM

Angellus Mortis

I no longer need any help. I am trying to make Colony Games. I posted what I have so far in another post: New Colony Games

Sirbomber

If you're doing a Land Rush game, don't use Hooville/BaseData.h.  You have to use the "skeleton" project file.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Hooman

#2
I'm not sure why things like mapCommandCenter don't work. Check for the "enum map_id" declaration in the SDK headers to see what the exact names should be. This header needs to be included in the file using these names.


For the base layout, you can't just remove stuff without adding a placeholder for what should go there. If you just delete some field in the middle, it will try to shift everything over to fill in the gap, but each field has a different meaning and the compiler won't know what to do with fields in the wrong place. The autosize macro basically outputs an array address and an array size. If you want to replace such a macro, just replace it with two zeros: 0, 0


But yeah, if you're doing landrush, you could just create the units directly with TethysGame::CreateUnit. Well, you can always do that, but it's usually a bit more typing.



Edit: Btw, you probably want to use Unit::SetTruckCargo for things like food. Don't try to use mapFood as the "cargo" when creating the unit, since you need to set the amount as well. The amount can only be set with SetTruckCargo.


Angellus Mortis

Thanks, anyway Hooman. Sirbomber is helping me. I got it now.

Angellus Mortis

Hey, I would anyone to try my colony game. Tell me if you like it. It is on a demo map (demo01.map) and the goal is to get a population of 2000. It is a long game if you like them kind.

Easy: Start with units to make three bases and be able to build Medical Centers, VFs, Universities, and Nursery. Also Metallogeny is researched, too. 70 Children, 50 workers, 30 scientist. 5000 food.

Normal: Start with units to make two bases and be able to build Medical Centers, Universities, and Nursery. 50 Children, 30 workers, 20 scientist. 3000 food.

Hard: Start with units for one base. 30 Children, 15 workers, and 5 scientist. 1000 food.

Angellus Mortis

I know it is a relatively simple game (espcially on easy). I just want feedback on it. It is the first mission I have made. Thanks to Sirbomber for teaching me how to code.

Angellus Mortis

I got a reply that on Hard you do not have enough people. I added some more. New file:

Kayedon

Use. The. Bloody. Edit. Button.
"Trust me, I'm crazy."

Angellus Mortis

QuoteUse. The. Bloody. Edit. Button.
Some people might like less people to start off with, so I did not

Sirbomber

Unfortunately, double-posting is a no-no.  Quintuple-posting is even worse.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Kayedon

Quote
QuoteUse. The. Bloody. Edit. Button.
Some people might like less people to start off with, so I did not
I must still be hungover. Can you rephrase that in logical English?
"Trust me, I'm crazy."

Angellus Mortis

Okay, I got a new problem. I compile my Mission DLL and run it.  I get the following messages:

"Coundn't resolve data reference BulidStandardLab in mission script"
"Coundn't resolve data reference BulidStandardLab in mission script"

Here is the related code:

   scriptGlobal.StanLab = CreateResearchTrigger(1 , 1, 2708, 1, "BuildStandardLab");
   scriptGlobal.Garage = CreateResearchTrigger(1 , 1, 5202, 1, "BuildGarage");

SCRIPT_API void BulidStandardLab()
{
   scriptGlobal.Build1.RecordBuilding(LOCATION(12-1, 39-1), mapStandardLab, mapNone);
   scriptGlobal.Tuber1.RecordTube(LOCATION(15-1, 39-1));
   scriptGlobal.StanLab.Destroy();
}

SCRIPT_API void BulidGarage()
{
   scriptGlobal.Build1.RecordBuilding(LOCATION(12-1, 52-1), mapGarage, mapNone);
   scriptGlobal.Garage.Destroy();
}

There are no compile errors (duh) and the research triggers are in the InitProc function and the two SCRIPT_APIs are there own. What is wrong?

Sirbomber

You mispelled "Build".
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Angellus Mortis

Also one other problem. I cannot get the lava to flow or appear on the mp6_01.map (Axen's Home) or axenvolcanoes.map. I had them working on the cm02.map. Here is the lava passible code:

void SetAllLava()
{
   LOCATION size(1024,1024);
   int x,y,tile;

   size.Clip();
   for (y=0; y<size.y; ++y)
   {
      for (x=31; x<size.x; ++x)
      {
         tile=GameMap::GetTile(LOCATION(x,y));
         if (((tile>=0x1B7) && (tile<=0x1F8)) || ((tile>=0x22F) && (tile<=0x25E)) || ((tile>=0x1F9) && (tile<=0x218)) || ((tile>=0x311) && (tile<=0x318)) || ((tile>=0x311) && (tile<=0x318)))
            GameMap::SetLavaPossible(LOCATION(x,y),true);
      }
   }
}

The eruption happens so it is nothing with it. Could it be because I changed to a world map? I have not tried to set lava passible by cell type. I cannot remember how.

Sirbomber

If the lava actually appears but doesn't move, make it a bit faster.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Hidiot

#15
Since the game takes a random tile, checks to see if it's Lava possible and next to an already lava-occupied tile and THEN expands the lava to that tile, it may take a very long time for lava to start flowing from a freshly erupted volcano, as opposed to how long it takes for the lava to expand when it's already present on an extended surface.

Similar to how the Blight works, except all tiles not lava are blight-passable.
"Nothing from nowhere, I'm no one at all"

Angellus Mortis

Thanks, everything works now.