New to Modding the game, really confused

Have modding questions or discovered something new? Post here.
Post Reply
User avatar
Templarfreak
Noob
Noob
Posts: 3
Joined: Sun Jun 04, 2017 8:25 am
United States of America

New to Modding the game, really confused

Post by Templarfreak »

So, I'm trying to add a new unit. Simply a generic flamethrower guy, based off of Scorch obviously, but when I add

Code: Select all

Constructor("army.building.barracks1");
To the unit it does not add them into the Barracks' build card. However, it seems like I can properly change what buildings an existing unit can be build at. I changed the Constructor line on the Bazooka soldier to be built at the Garage and that properly changed. Here is all of the code, in case someone wants to look at it:

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//

#include "fx_army_unit_scorch.cfg"
#includeonce "fx_grunt_damage.cfg"

// UNIT
CreateObjectType("army.unit.flame", "Unit")
{
  GameObj()
  {
    ThinkInterval(1);
    IdleTask("Tasks::UnitIdle");
    Properties()
    {
      Add("Filter::Army");
      Add("Filter::Biological");
      Add("Filter::Unit");
      Add("Filter::Weapon");
      Add("Filter::Transportable");
    }
  }

  MapObj()
  {
    GodFile("army_scorch.god");
    PhysicsModel("Walker");
    TractionType("ground");
    GrainSize(1);
	
    TypeDisplay()
    {
      Image()
      {
        Image("if_game_portraits.tga", 210, 210, 42, 42);
        Mode("Centre");
      }
    }

    ArmourClass("infantry");
    HitPoints(200);

    GenericFX()
    {
      Add("UnitObj::ActivelyOnTeam", "flameidle");
      Add("Weapon::Fire", "weapon.flame.fire");
      Add("MapObj::AddToMap", "damage.grunt");
      Add("MapObj::Death", "death.infantry");
      Add("Restore::Target::Process", "restore-small");
      Add("MapObj::AddToMap2", "restore-small-puff");
      Add("Wounded::Start", "herowound");
      // Add("UnitObj::Engine", "water.ripple");
    }
    ShadowFile("army_grunt-shadow.tga");
    RotateShadow(0); // default is 1

  }

  UnitObj()
  {
    TopSpeed(40);
    TurnSpeed(8640); // was1440);
    SeeingRange(65);
    ResponseEvents()
    {
      Add("Attack")
      {
        Add("army.unit.scorch_attack-0.wav");
        Add("army.unit.scorch_attack-1.wav");
      }
      Add("Attacked")
      {
        Add("army.unit.scorch_attacked-0.wav");
      }
      Add("Move")
      {
        Add("army.unit.scorch_move-0.wav");
        Add("army.unit.scorch_move-1.wav");
        Add("army.unit.scorch_move-2.wav");
      }
      Add("Select")
      {
        Add("army.unit.scorch_select-0.wav");
        Add("army.unit.scorch_select-1.wav");
        Add("army.unit.scorch_select-2.wav");
      }
      Add("Spotted")
      {
        Add("army.unit.scorch_spotted-0.wav");
      }
    }
    Constructor("army.building.barracks1");
    ConstructionTime(30);
    CreateSource("resource.blob.infantry1");
    CommandCost(1);
    ResourceCost()
    {
      Add("Plastic", 200);
      Add("Electricity", 25);
    }
    Prereqs()
    {
      Add("army.building.barracks2");
    }

    CommandCost(1);

    Weapon("army.weapon.flame");
  }
}

// WEAPON
CreateWeaponType("army.weapon.flame")
{
  Style("Instant");

  MaxRange(48);

  HorizAngle(90);
  HorizSeparation(5);
  VertAngle(90);
  VertSeparation(45);

  Delay(0.3);
  LeadAngle(1);
  Speed(200);


  Damage()
  {
    Amount(15);

    Effective("infantry", 100%);
    Effective("vehicle", 50%);
    Effective("structure", 50%);
    Effective("flyer", 0%);
    Effective("mine", 50%);
  }

  FirePoints()
  {
    Add("HP-fire");
  }
}
EDIT: There appears to have been some map-specific shenanigans going on. I had to modify the map in order to make the unit appear in the map I was using to test, which was one of the Great Battle maps. The Multiplayer Maps don't seem to have this same weird coding convention that the Gardens map does though, I think.
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: New to Modding the game, really confused

Post by TommyCD1 »

If you place a new unit into the barracks, remember that the barracks already has a full build menu. Try hovering over it and scrolling down on your mousewheel to reveal the new unit.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Templarfreak
Noob
Noob
Posts: 3
Joined: Sun Jun 04, 2017 8:25 am
United States of America

Re: New to Modding the game, really confused

Post by Templarfreak »

I've already messed with the UI a lot, expanded the build menu to be a 3x4 area. The only issue I have now is that English.dat file. Is there any documentation on how to edit it?

The only things I can figure out about it is that for most strings there is 2 bytes before the "Name" of the string. The first one determines how many bytes come after the name and the second determines how many bytes long the name is then it ends in a null. Then usually the byte after the null determines how long the string is, but that isn't always consistent. But knowing this still doesn't make it possible to edit or add strings unfortunately so something about the header must keep track of how many strings there are or the filesize or something but that's a bit too complicated for me to figure out on my own.
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: New to Modding the game, really confused

Post by TommyCD1 »

Anything that isn't compiled in an .x file or found in a .cfg file I'd have no idea how to work with. And as far as I know no one has ever edited the english.dat file.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Templarfreak
Noob
Noob
Posts: 3
Joined: Sun Jun 04, 2017 8:25 am
United States of America

Re: New to Modding the game, really confused

Post by Templarfreak »

It seems easy enough if you're an adept hacker, what I've managed to find out took like 30 minutes to an hour of browsing through the file with a Hex Editor and I only have the most rudimentary understanding of what I was actually doing Lol.

I'm like 99% certain that for the most part this is the pattern a lot of the strings follow:

04 06 66 6C 61 6D 65 00 0E 00 01 00 46 6C 61 6D 65 74 68 72 6F 77 65 72 04 07

04 06 means that the name of the string is 6 bytes long and the next 4 bytes are info on the string itself. The 6 bytes are 66, 6C, 61, 6D, 65, and 00 which converted from hex to text is "flame " with a null/space at the end. The next byte after the null/space contains the length of the string itself, which is 0E. 0E is 14, meaning the string itself is 14 bytes long. Those 14 bytes, 46, 6C, 61, 6D, 65, 74, 68, 72, 6F, 77, 65, 72, 04, and 07 correspond to the actual string itself which converts from hex to characters which becomes Flamethrower and 2 bytes after it which are apart of the next string name/string to determine its name length and how many bytes to read after it.
User avatar
unikc
Half Track
Half Track
Posts: 53
Joined: Tue Apr 16, 2019 11:56 am
Location: Indonesia
Contact:
Indonesia

Re: New to Modding the game, really confused

Post by unikc »

Just simply add your new unit example:
1.obj_unit_grunt2.cfg (your new unit cfg file)
2.open obj_army.cfg/types.cfg
3.add your obj_unit_grunt2.cfg by typing like this
(just copy include.....grunt...[in obj_army/types.cfg] and change ...... grunt to .....grunt2.cfg
Another day another idea 8) :C
BTW I Love Easy Modding.
User avatar
Magnos
Half Track
Half Track
Posts: 61
Joined: Sun Dec 16, 2018 1:27 pm
Egypt

Re: New to Modding the game, really confused

Post by Magnos »

u have to edit types.cfg
add #include filename.cfg
so amrts.exe will read it :)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests