Author Topic: I Need Coding Help  (Read 3099 times)

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« on: July 19, 2009, 09:00:05 AM »
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
« Last Edit: July 23, 2009, 08:41:05 PM by angellus »

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
I Need Coding Help
« Reply #1 on: July 19, 2009, 10:30:51 AM »
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

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
I Need Coding Help
« Reply #2 on: July 19, 2009, 11:02:28 AM »
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.

 
« Last Edit: July 19, 2009, 11:04:25 AM by Hooman »

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #3 on: July 19, 2009, 11:28:55 AM »
Thanks, anyway Hooman. Sirbomber is helping me. I got it now.

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #4 on: July 19, 2009, 02:54:41 PM »
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.
 

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #5 on: July 19, 2009, 03:05:23 PM »
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.

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #6 on: July 20, 2009, 04:47:33 PM »
I got a reply that on Hard you do not have enough people. I added some more. New file:

Offline Kayedon

  • Sr. Member
  • ****
  • Posts: 378
I Need Coding Help
« Reply #7 on: July 21, 2009, 11:02:56 PM »
Use. The. Bloody. Edit. Button.
"Trust me, I'm crazy."

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #8 on: July 23, 2009, 04:54:03 PM »
Quote
Use. The. Bloody. Edit. Button.
Some people might like less people to start off with, so I did not

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
I Need Coding Help
« Reply #9 on: July 23, 2009, 08:38:28 PM »
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

Offline Kayedon

  • Sr. Member
  • ****
  • Posts: 378
I Need Coding Help
« Reply #10 on: July 23, 2009, 09:02:22 PM »
Quote
Quote
Use. 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."

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #11 on: July 28, 2009, 06:16:50 PM »
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?
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
I Need Coding Help
« Reply #12 on: July 28, 2009, 06:46:19 PM »
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

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #13 on: July 28, 2009, 06:46:52 PM »
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.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
I Need Coding Help
« Reply #14 on: July 28, 2009, 06:57:57 PM »
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

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
I Need Coding Help
« Reply #15 on: July 29, 2009, 06:57:28 AM »
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.
« Last Edit: July 29, 2009, 06:57:54 AM by Hidiot »
"Nothing from nowhere, I'm no one at all"

Offline Angellus Mortis

  • Full Member
  • ***
  • Posts: 138
I Need Coding Help
« Reply #16 on: July 29, 2009, 12:19:56 PM »
Thanks, everything works now.