Adding Units

Adding Units

Classic game design, maintained to please you...

Moderator: Content Developer

Post Reply
Foolsbry
Posts: 3
Joined: 08 Aug 2016, 09:30

Adding Units

Post by Foolsbry »

Hey there, I just recently got into Balanced Annihilation and the Spring Engine in general, and I'm wondering if it's possible to add units to BA. Right now I'm trying to create a super builder plane which is just a copy of the Arm tech 1 Air Constructor.

I copied the armca.lua file and made a duplicate called armcacheat.lua, and changed any references to armca to armcacheat in the file. I then added armcacheat to the build options of the Arm tech 1 Air Factory but it's not showing up in game. What else do I have to do to make a new unit appear in game?

Thanks in advance!
User avatar
MasterBel2
Posts: 347
Joined: 11 Apr 2016, 12:03

Re: Adding Units

Post by MasterBel2 »

So I'm assuming:
You have copied the source code for the latest balanced annihilation version
The code has been placed in the spring/games directory in the correct structure (aka as downloaded) and the folder enclosing everything is named <gamename>.sdd
You're sure that you're running your game and not BA proper

I haven't done too much dev'ment myself, but it's fun and rewarding. So keep on. I've given you all I've got, apart from one reccomendation:
Join the #badev and #moddev channels on the spring server. For Spring Lobby it should be as easy as typing /join <channame> to the official server. There will be devs there that can help you out.

Welcome to the Spring community! Have fun!
Foolsbry
Posts: 3
Joined: 08 Aug 2016, 09:30

Re: Adding Units

Post by Foolsbry »

Hey thanks for the welcome and the pointers! I appreciate it. I have been modifying the files within the SDZ file, rather than have the whole thing extracted in the game folder, will that affect how it works? The changes I made definitely had impact, as at times neither the original constructor or the modded one showed up in the build menu or the game.

Thanks again!
User avatar
MasterBel2
Posts: 347
Joined: 11 Apr 2016, 12:03

Re: Adding Units

Post by MasterBel2 »

Devs use the SDD format beccause it's a lot easier to browse the source, and to edit etc. All I can think of is that you might have not put a reference into the file for the airlab - as in the buildlist. Did you change the numbers etc? Probably have if it sometimes shows up. I'm not sure how else to help.
Foolsbry
Posts: 3
Joined: 08 Aug 2016, 09:30

Re: Adding Units

Post by Foolsbry »

I did add the cheat unit to the build menu as well, looks something like this;

buildoptions = {
[1] = "armca",
[2] = "armpeep",
[3] = "armfig",
[4] = "armthund",
[5] = "armatlas",
[6] = "armkam",
[7] = "armcacheat",

},

All other units still show up fine, just not this one. the lua file is definitely named "armcacheat" and all references inside the file are named the same.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Adding Units

Post by zwzsg »

Check infolog.txt for any related error.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Adding Units

Post by Silentwings »

What else do I have to do to make a new unit appear in game?
You'll also need to tell your lua unitdef file where to find a model and a script for the unit (it typically doesn't appear as a tag in the unitdef file because BA relies on common filenames within different dirs to associate them - this link breaks silently when you copy/paste/rename a unitdef file).

https://springrts.com/wiki/Gamedev:UnitDefs#General, objectName and script.

There may be other errors too - attaching an infolog is basically a must have if you want others to help you debug. https://springrts.com/wiki/Infolog.txt

If all you want to do is cheat and make it quick/easy to build stuff, just type '/cheat' and then '/nocost'.
Post Reply

Return to “Balanced Annihilation”