Giving units the ability to call in Airstrikes/Paratroopers/Magnyfying glass

Have modding questions or discovered something new? Post here.
Post Reply
User avatar
Arisen
Mortar Man
Mortar Man
Posts: 33
Joined: Fri Feb 17, 2017 6:16 am
American Samoa

Giving units the ability to call in Airstrikes/Paratroopers/Magnyfying glass

Post by Arisen »

I had too much fun with this one.


Again, another idea I got from Company of heroes, I was trying to give infantry the ability to build barricades, but just as i test I used the bombing run first.

So, to do this you have to go into the config file of the bombing run obj.army.bombingrun

go to the entry that says "unit constructor" and change it from the radio operator to sarge


Constructor("army.unit.sarge");



then go to sarges config and add this underneath the create unit entry

GameObj()
{
ThinkInterval(1);
IdleTask("Tasks::UnitConstructor");
Properties()
{



it should look like this


// UNIT
CreateObjectType("army.unit.sarge", "Unit")
{
GameObj()
{
ThinkInterval(1);
IdleTask("Tasks::UnitConstructor");
Properties()
{

if you add this to the "Add" section then sarges icon will appear always next to the bulldozer.
Add("Client::FacilityBar");



I tried to give sarge the ability to build units, but when I try to build the unit i get an error that says memory access violation. So I will have to do some more poking around before Sarge can start magically poofing grunts! But, it's a start :D




Image
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Giving units the ability to call in Airstrikes/Paratroopers/Magnyfying glass

Post by TommyCD1 »

Yes, while this idea is fun to play with, it's very dangerous in practice. The reason that the radio operator, or any unit that builds, does not attack is because the game's idle process for Tasks::UnitConstructor does to take weapons into account. Which sound fine, but Sarge will only attack if told to or while moving. Also if Sarge dies while constructing, the game crashes.

And units cannot build other units. This is because their models (.god files) do not contain the correct hard points for units. These hard points are used to tell the newly built unit where to spawn, where to walk, and where to exit the building. The points are called OP-EXIT-POST, OP-EXIT1, and OP-EXIT2.

Also, you can post code with the correct formatting using the code button when writing a post as such.
code.png
code.png (3.31 KiB) Viewed 946 times
code.png
code.png (3.31 KiB) Viewed 946 times

Code: Select all

  GameObj()
  {
    ThinkInterval(1);
    IdleTask("Tasks::UnitConstructor");
    Properties()
    {
      Add("Filter::Army");
      Add("Filter::Biological");
      Add("Filter::Unit");
      Add("Filter::Weapon");
      Add("Filter::Heroes");
      Add("Filter::Transportable");
      Add("Client::FacilityBar");
      Add("Client::ForceNameDisplay");
    }
  }
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
Arisen
Mortar Man
Mortar Man
Posts: 33
Joined: Fri Feb 17, 2017 6:16 am
American Samoa

Re: Giving units the ability to call in Airstrikes/Paratroopers/Magnyfying glass

Post by Arisen »

TommyCD1 wrote: Sun Mar 12, 2017 12:59 am Yes, while this idea is fun to play with, it's very dangerous in practice. The reason that the radio operator, or any unit that builds, does not attack is because the game's idle process for Tasks::UnitConstructor does to take weapons into account. Which sound fine, but Sarge will only attack if told to or while moving. Also if Sarge dies while constructing, the game crashes.

And units cannot build other units. This is because their models (.god files) do not contain the correct hard points for units. These hard points are used to tell the newly built unit where to spawn, where to walk, and where to exit the building. The points are called OP-EXIT-POST, OP-EXIT1, and OP-EXIT2.

Also, you can post code with the correct formatting using the code button when writing a post as such.
code.png

Code: Select all

  GameObj()
  {
    ThinkInterval(1);
    IdleTask("Tasks::UnitConstructor");
    Properties()
    {
      Add("Filter::Army");
      Add("Filter::Biological");
      Add("Filter::Unit");
      Add("Filter::Weapon");
      Add("Filter::Heroes");
      Add("Filter::Transportable");
      Add("Client::FacilityBar");
      Add("Client::ForceNameDisplay");
    }
  }
Cool, could I make sarge build other buildings? :COFE:
User avatar
TommyCD1
Moderator
Moderator
Posts: 1143
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: Giving units the ability to call in Airstrikes/Paratroopers/Magnyfying glass

Post by TommyCD1 »

Yes, but you face the same problems as explained previously, where as sarge has a problem shooting and crashes the game.
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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests