Construction yard
Moderator: Moderators
Construction yard
So heres the deal:
I would like to have the construction yard building stuff inside a certain radius.
I would now need example codes for the actual builing process, the part of choosing a building and placing it.
What do i need?
I would like to have the construction yard building stuff inside a certain radius.
I would now need example codes for the actual builing process, the part of choosing a building and placing it.
What do i need?
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
Actually you just need to set up a standard construction unit that simply cannot move and and you give the buildrange via the "BuildDistance" tag in the unit definition...
This will start Spring's standard nanospraying building method. If you want anything unlike that you have to totally code it via Lua gadgets and unit script code...
This will start Spring's standard nanospraying building method. If you want anything unlike that you have to totally code it via Lua gadgets and unit script code...
Re: Construction yard
Well, Gundam has those but they're pretty much just nanotowers combined with a custom economy system.
Re: Construction yard
and how to get those little icons to click on in order to build?
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
If you write your unit definions in Lua you can simply add the desired obejctnames of the things you want to have it build like this in the unit definition file:
The units will then get listed in the respective order in the buildmenu that pops up when selecting the unit being represened by an icon you can give to them...
Code: Select all
buildoptions = {
[[armrectr]],
[[armflea]],
[[armpw]],
[[armrock]],
[[armtick]],
[[armham]],
[[armwar]],
[[armjeth]],
[[arm_marky]],
},
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
You actually assigned a buildpic to your units / buildings that should show up?
Re: Construction yard
Yes althou they all use the same one.
Edit: I remember having read something about a number that assigns a place in the UI to a butto. Is this needed? I cant find the reference page anymore.
Edit: I remember having read something about a number that assigns a place in the UI to a butto. Is this needed? I cant find the reference page anymore.
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
You also gave the needed tags like builder=1 and so on for the constructor?
Re: Construction yard
Code: Select all
unitDef = {
unitname = [[Construction yard]],
name = [[Construction yard]],
description = [[Builds stuff for mother Russia]],
buildCostEnergy = 0,
buildCostMetal = 800,
builder = true,
buildPic = [[Runner.png]],
buildTime = 1000,
builddistance = 500,
canAttack = false,
canGuard = false,
canMove = false,
canPatrol = false,
canstop = [[1]],
category = [[LAND]],
corpse = [[DEAD]],
-- customParams = {
-- helptext = [[ Runners can counter light vehicles but die fast to almost everything else. Remember their EMP!]],
-- },
defaultmissiontype = [[Standby]],
--explodeAs = [[SMALL_UNITEX]],
footprintX = 1,
footprintZ = 1,
--iconType = [[Tank]],
idleAutoHeal = 0,
idleTime = 300,
maneuverleashlength = [[640]],
mass = 32.5,
maxDamage = 800,
maxSlope = 36,
maxWaterDepth = 22,
noAutoFire = true,
objectName = [[Conyard.s3o]],
seismicSignature = 4,
--selfDestructAs = [[SMALL_UNITEX]],
sfxtypes = {
explosiongenerators = {
-- [[custom:emg_shells_l]],
-- [[custom:flashmuzzle1]],
},
},
side = [[RUSSIA]],
sightDistance = 425,
smoothAnim = true,
steeringmode = [[2]],
TEDClass = [[COMMANDER_CTRL_C]],
upright = false,
workerTime = 10,
buildoptions = {
[[Conyard]],
[[Runner]],
[[Bemoth]],
},
and so on...
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
In your gamedata folder do you have a "unidefs_post.lua". I'm not exactly sure but a part of that might read out what you wrote into your unit defs...
You still should have the "traditional" way of doing things via a sidedata.tdf you put in the gamedata folder. In other words it's a simple textfile with a .tdf ending which e.g. looks like this for a TA mod:
It's one more or less long file where you can write in all the factories or constructors in your game one after another. This then needs no entries in the unit definition files (kinda similar to then non-Lua way of creating weapons)...
You still should have the "traditional" way of doing things via a sidedata.tdf you put in the gamedata folder. In other words it's a simple textfile with a .tdf ending which e.g. looks like this for a TA mod:
Code: Select all
[SIDE0]
{
name=ARM;
commander=ARMCOM;
}
[SIDE1]
{
name=CORE;
commander=CORCOM;
}
[CANBUILD]
{
[ARMCOMBCOM]
{
canbuild1=armfus;
canbuild2=armckfus;
canbuild3=aafus;
canbuild4=armdf;
canbuild5=armmoho;
canbuild6=armmmkr;
canbuild7=armuwadves;
canbuild8=armuwadvms;
canbuild9=ARMSHLTX;
canbuild10=armavp;
canbuild11=armeap;
canbuild12=armesy;
canbuild13=armpb;
canbuild14=armanni;
canbuild15=armhys;
canbuild16=mercury;
canbuild17=armbertha;
canbuild18=armgate;
canbuild19=armsilo;
canbuild20=armamd;
canbuild21=armscab;
canbuild22=armvulc;
canbuild23=armtabi;
canbuild24=armarad;
canbuild25=armveil;
canbuild26=armuwfus;
canbuild27=armuwmme;
canbuild28=armuwmmm;
canbuild29=armadvesuw;
canbuild30=armadvmsuw;
canbuild31=armafrad;
canbuild32=armason;
}
Re: Construction yard
The following post is not really aimed at answering Erik's question:
fwiw, it's perfectly possible to do much the same thing in lua (a monolithic buildlist rather than in the individual unitdefs)
(see my butchered download_builds.lua here:
http://spring1944.svn.sourceforge.net/v ... iew=markup
and the builddefs.lua file here:
http://spring1944.svn.sourceforge.net/v ... iew=markup
Also has an example of how you can use it to make simple modoptions to exclude/change buildoptions)
fwiw, it's perfectly possible to do much the same thing in lua (a monolithic buildlist rather than in the individual unitdefs)
(see my butchered download_builds.lua here:
http://spring1944.svn.sourceforge.net/v ... iew=markup
and the builddefs.lua file here:
http://spring1944.svn.sourceforge.net/v ... iew=markup
Also has an example of how you can use it to make simple modoptions to exclude/change buildoptions)
Re: Construction yard
Tried both an neither has any effect.
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
Well I guess if it's not too much of a hassle you should provide your entire modfile as a remote maintenance is quite hard...
Re: Construction yard
ok here you go:
- Attachments
-
- New World Order.sd7
- (734.36 KiB) Downloaded 14 times
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
Well I could fix it only partially right now...
One thing was about you using "Construction Yard" as the unitname while you always tried to refer to it as "Conyard" in your buildlists. As you seem to want to take the Lua approach in general I now put a sidedata.lua into your gamedata folder simply telling Spring that when starting with your Russia faction the unit it should spawn at the beginning of the game is the conyard and made the respective lines in the conyard's unit definition active again...
I also managed to make the conyard appear in the buildlist - behmoth and runner both get taken out though. You can see that when going into Spring's folder and opening the infolog.txt after having run Spring. You'll find much info on what might go wrong - it e.g. moans about an error in that oilderric's definitions and tells you that both runner and behmoth got removed from the conyard's buildlist. I couldn't really figure out as to why the latter happens as when you cheat the units in they seem to work fine (type "/cheat" and then "/give runner" to cheat give them to you)...
You still have to do a bit work on the conyard's building abilities as currently all that happens when you try to build another one is that it spawns the standard nanoframe for it. It doesn't actually start building though. I didn't look into this yet but I guess it misses the needed commands for starting to build in the unit script. Or maybe you just start with no resources - well I didn't have a real look at this yet...
One thing was about you using "Construction Yard" as the unitname while you always tried to refer to it as "Conyard" in your buildlists. As you seem to want to take the Lua approach in general I now put a sidedata.lua into your gamedata folder simply telling Spring that when starting with your Russia faction the unit it should spawn at the beginning of the game is the conyard and made the respective lines in the conyard's unit definition active again...
I also managed to make the conyard appear in the buildlist - behmoth and runner both get taken out though. You can see that when going into Spring's folder and opening the infolog.txt after having run Spring. You'll find much info on what might go wrong - it e.g. moans about an error in that oilderric's definitions and tells you that both runner and behmoth got removed from the conyard's buildlist. I couldn't really figure out as to why the latter happens as when you cheat the units in they seem to work fine (type "/cheat" and then "/give runner" to cheat give them to you)...
You still have to do a bit work on the conyard's building abilities as currently all that happens when you try to build another one is that it spawns the standard nanoframe for it. It doesn't actually start building though. I didn't look into this yet but I guess it misses the needed commands for starting to build in the unit script. Or maybe you just start with no resources - well I didn't have a real look at this yet...
- Attachments
-
- NewWorldOrder.sd7
- Now with limited building abilities
- (966.82 KiB) Downloaded 15 times
Re: Construction yard
I fixed the money part, where to get codes for starting the build process?
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Construction yard
Use those. I guess I kept them understandable and e.g. commented out an example for a situation where you want something to turn or move in any way before the construction should start...
- Attachments
-
- Conyard Script.7z
- Conyard script
- (729 Bytes) Downloaded 15 times