Can someone make the Units Cap infinite?

Have modding questions or discovered something new? Post here.
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Can someone make the Units Cap infinite?

Post by TommyCD1 »

Don't forget the Bulldozer and any other heroes also cost unit limit. Also to note is that this game's engine has a strange glitch where if you exceed the unit limit, for example by dropping paratroopers at the limit, then all construction gets blocked, regardless if it costs limit or not... this includes air strikes and things that cost 0 limit. It's pretty annoying and happens often if you using more than one facility at a time.
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
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Unit Limit Code & another way to have unlimited troops

Post by Secg »

I've tested the DR2 Unit Limit quote once again; & found out it actually works :ROCK: in Campaign, Multiplayer, & Instant Action:
However, to prevent online desyncing, all players involved must have their base.x modded to contain the same limit.cfg file with the exact same numerical value for Unit Limit.

Another way is simply change all units' & heroes' Command Cost to (0)

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Copyright 1997-2000 Pandemic Studios - Dark Reign II
//
// Unit Construction Limits
//

Limit(150);
ImageImage
User avatar
j3rry
Map Maker
Map Maker
Posts: 121
Joined: Thu Oct 11, 2018 5:43 am
Location: Central Russia
Russia

Re: Unit Limit Code & another way to have unlimited troops

Post by j3rry »

Secg wrote: Fri Jun 15, 2018 10:03 pm
Does not work for me. Are you sure that is the limit command is correct? I have created limit.cfg with Limit(1), but I can still produce units in Campaign, Great Battles and Multiplayer modes.
Last edited by j3rry on Thu Jan 06, 2022 6:22 am, edited 1 time in total.
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Re: Can someone make the Units Cap infinite?

Post by Secg »

You're right, j3rry!. The DR2 Limit function does not work! Or does it only work because I had a Trainer on last time :? ? Can't tell! idk

Still, I was wrong! :NOOB2:

To raise the unit limit cap, I have to code an individual objective for each Individual player in each individual map. Like this:

Code: Select all

CreateObject("obj_unitlimit_player_1", 3144)
{
  ObjectiveObj()
  {
    Condition();
  }
}

CreateObjectType("obj_unitlimit_player_1","Objective")
{
  Condition("TRUE");
  Action()
  {
    SetUnitLimit(100);
  }
}
Last edited by Secg on Thu Jul 18, 2019 2:01 pm, edited 1 time in total.
ImageImage
User avatar
j3rry
Map Maker
Map Maker
Posts: 121
Joined: Thu Oct 11, 2018 5:43 am
Location: Central Russia
Russia

Re: Can someone make the Units Cap infinite?

Post by j3rry »

Secg wrote: Wed Jul 17, 2019 4:26 pm
It is too bad, because in this case need to repack all maps.
Though I need only remove this limit, so I can use CommandCost(0) for that.
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Re: Can someone make the Units Cap infinite?

Post by Secg »

Well, the reason I prefer raising Individual Unit Limit Caps (to 140) (through Clunky coding for each Individual player in each map) is because I want to raise unit's CP & want players of my Heroic 1.1 mod to wisely manage their Unit Composition (e.g. a player can have four times(!) :o as many grunts as they can have tanks):
  • Buildings, Bulldozer, Dumptruck: 1 CP
    Minesweeper, Radio: 1 CP
    Grunt: 1CP (Let the Grunt Rush begin! 8) )
    All other Infantries: 2 CP
    Minelayer, Medic, Dumdum: 2 CP
    Halftrack, Chopper: 3 CP
    Tank: 4 CP (tank-spammers beware! >:) )
    Guardtower: 2 CP
    Pillbox: 3 CP
    AAgun, BWpost: 1 CP
    Sarge or any other Hero: 1CP
I don't feel like writing a code to either (a) allow the Barracks to mass-produce Heroes (though with absurdly high Plastic costs & 10 CP :o for balance's sake) or
(b) spawn another Hero when your current one is Wounded even though I think I can
Last edited by Secg on Thu Jul 18, 2019 2:04 pm, edited 3 times in total.
ImageImage
User avatar
j3rry
Map Maker
Map Maker
Posts: 121
Joined: Thu Oct 11, 2018 5:43 am
Location: Central Russia
Russia

Re: Can someone make the Units Cap infinite?

Post by j3rry »

Secg wrote: Thu Jul 18, 2019 7:22 am
Yes, that is pretty good idea. I was thinking to do it like that. But some of maps, especially large ones, have standart 70 unit limit, so I have to recompile them in that case which is not good idea by itself, because players must download recompiled maps.
Last edited by j3rry on Thu Jan 06, 2022 6:42 am, edited 1 time in total.
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Re: Can someone make the Units Cap infinite?

Post by Secg »

j3rry wrote: Thu Jul 18, 2019 8:02 am
Secg wrote: Thu Jul 18, 2019 7:22 am
But some maps (especially large ones) have standard 70 unit limit
So far, I have only successfully raised Unit Limit for Story & Campaign Missions, not Multiplayer ones :-w .
ImageImage
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

types_common.cfg and ruleset

Post by Secg »

I think I figure out another way to both increase the unit limit cap without the need to code it directly into the map as individual team's objective

Using NotepPad++ to convert base.x to base.zwp & extract files
Open base > misc > types_common.cfg
Create this objective

Code: Select all

CreateObjectType("common.unitlimit", "Objective")
{
  Condition("TRUE");
  Action()
  {
    SetUnitLimit(100);
  }
}
Open mods > ruleset

Using NotepPad++ to convert protect.x to protect.zwp & extract files
Open protect > mod.cfg

Add this code line

Code: Select all

  NewObjective("common.unitlimit");
Before

Code: Select all

StartActionAvailable()
{
  CreateVarFloat("@.timeleft", 180);
  NewObjective("protecthq.check");
  NewObjective("common.killallenemy");
  NewObjective("common.aivictory");
  NewObjective("common.eliminate");
}
After

Code: Select all

  NewObjective("common.unitlimit");

  CreateVarFloat("@.timeleft", 180);
  NewObjective("protecthq.check");
  NewObjective("common.killallenemy");
  NewObjective("common.aivictory");
  NewObjective("common.eliminate");
Repeat the same steps above for sarge.x's mod.cfg and 's mod.cfgkoth.x
Last edited by Secg on Thu Jul 18, 2019 1:46 pm, edited 1 time in total.
ImageImage
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Exceptions

Post by Secg »

However, instead of coding a ruleset, such as

Code: Select all

RuleSet("protect");
The mapmaker(s) choose(s) not to, as in s15.x

Code: Select all

RuleSet("none");
Then unit limits must be directly coded into the map
Last edited by Secg on Thu Aug 01, 2019 2:28 am, edited 1 time in total.
ImageImage
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests