The builder will show highlight for structure but not build.

The builder will show highlight for structure but not build.

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
The_Igishly_Co
Posts: 34
Joined: 10 Oct 2013, 01:56

The builder will show highlight for structure but not build.

Post by The_Igishly_Co »

My basic builder unit (CUBL) a moving builder of structures will not construct structures that are programmed into the game. It will show the blueprint but not actually begin construction.
Attachments
buildervehicle(script).lua
The script... For you
(1.49 KiB) Downloaded 7 times
buildervehicle.lua
NOTE: I used the same script with a different model and it worked fine
(1010 Bytes) Downloaded 20 times
Last edited by The_Igishly_Co on 18 Oct 2013, 15:51, edited 2 times in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Builder not buildin' unites mate... Halp meh

Post by smoth »

We cannot always spoon feed you, what will happen when you get to the actual hard part?

Your post is not cute, or funny, it is insultingly lazy. Please make a real post detailing what part is failing.

Here is an example for the future:

"my build is not building a unit, it has a build tree, the unit is with in it, but it doesn't build the unit when I click the button" This at least tells us that your builder is an immobile builder which would give us an idea of what could be a potential issue.

what did you put in the script?
"here is my script: LINK TO YOUR SCRIPT ON PASTEBIN"

If you want help, make the effort to post a real thread, there is barely a post here. You essentially said "my stuff is broke, why"
User avatar
The_Igishly_Co
Posts: 34
Joined: 10 Oct 2013, 01:56

Re: Builder not buildin' unites mate... Halp meh

Post by The_Igishly_Co »

You are correct, I most humbly apologise for my crude and unacceptable post, I was in a hurry and needed to try to get some kind of answer before I left for school, and because it was via mobile I had no access to my files, however I will make an edit to this post with more detailed explanations into my issue

With sincerest apologies: The Igishly Company
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: The builder will show highlight for structure but not bu

Post by knorke »

First guess is, does your model have a piece called "nano"?
(Assuming you use SpringTutorialGame) The builderscript will try to emit a nanoparticle-builder-blablub effect from this piece. If such does piece does not exist errors should appear in chat console whenenver the unit tries to build.
So either add a piece with such name to the model or adjust the script.

http://springrts.com/wiki/Infolog.txt
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: The builder will show highlight for structure but not bu

Post by yuritch »

Do you have a unit script for that builder? The file in the first post is only unitdef, no script in there. Such a unit will be able to move around, but won't be able to attack or build, those need a script with proper callins implemented.

I'm talking about that line:
script = "buildervehicle.lua"
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: The builder will show highlight for structure but not bu

Post by smoth »

The_Igishly_Co wrote:My basic builder unit (CUBL) a moving builder of structures will not construct structures that are programmed into the game. It will show the blueprint but not actually begin construction.
well first, this is a unit DEFinition file. The script dictates behaviors like where the nanopieces spray from. When you say that "it will show the blueprint" are you saying the picture shows in the menu or that it has a little wireframe sitting there indefinitely?
User avatar
The_Igishly_Co
Posts: 34
Joined: 10 Oct 2013, 01:56

Re: The builder will show highlight for structure but not bu

Post by The_Igishly_Co »

smoth wrote:
The_Igishly_Co wrote:My basic builder unit (CUBL) a moving builder of structures will not construct structures that are programmed into the game. It will show the blueprint but not actually begin construction.
well first, this is a unit DEFinition file. The script dictates behaviors like where the nanopieces spray from. When you say that "it will show the blueprint" are you saying the picture shows in the menu or that it has a little wireframe sitting there indefinitely?
It's the wireframe
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: The builder will show highlight for structure but not bu

Post by knorke »

not enough money?
type
/cheat
/atm
to get more resources.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: The builder will show highlight for structure but not bu

Post by Silentwings »

not enough money?
or you could use the "/nocost" gadget; http://pastebin.com/j6HWayAz. Put that into a file called cmd_nocost.lua in /spring/luarules/gadgets and then after typing
/cheat
/nocost
ingame everything will build for no cost
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: The builder will show highlight for structure but not bu

Post by Forboding Angel »

This is far too vague.

We need the unitdef of the builder, the script of the builder, the unitdef of the unit being built, and the script of the unit being built and your infolog.txt

Most importantly is the script of the builder. Smoth was a bit harsh, but he was also right. We can't just divine what is going on in your game from a unitdef. That tells us basically nothing.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: The builder will show highlight for structure but not bu

Post by Forboding Angel »

Code: Select all

buildCostMetal = 0,
buildCostEnergy = 0,
My guess is that this may be the issue. 20 bucks says that his unit he is trying to build has 0 costs associated and spring is choking on it (I haven't tested, but sounds legit).
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: The builder will show highlight for structure but not bu

Post by smoth »

Forboding Angel wrote:Smoth was a bit harsh, but he was also right. We can't just divine what is going on in your game from a unitdef. That tells us basically nothing.
I wasn't harsh. He edited his post, which originally was just a sentence about how his unit wasn't building.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: The builder will show highlight for structure but not bu

Post by FLOZi »

Forboding Angel wrote:

Code: Select all

buildCostMetal = 0,
buildCostEnergy = 0,
My guess is that this may be the issue. 20 bucks says that his unit he is trying to build has 0 costs associated and spring is choking on it (I haven't tested, but sounds legit).
Not an issue.

It will most likely be the script.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: The builder will show highlight for structure but not bu

Post by smoth »

I have not done a lua based builder script so I did:

http://springrts.com/phpbb/search.php?k ... mit=Search

http://springrts.com/phpbb/viewtopic.ph ... E&start=20
SpikedHelmet wrote:or y'know just use lua

Code: Select all

--piece defines
local hull, pad, beam = piece ("hull", "pad", "beam")

function script.Activate()
	SetUnitValue(COB.YARD_OPEN, 1)
	SetUnitValue(COB.INBUILDSTANCE, 1)
	SetUnitValue(COB.BUGGER_OFF, 1)
	return 1
end

function script.Deactivate()
	SetUnitValue(COB.YARD_OPEN, 0)
	SetUnitValue(COB.INBUILDSTANCE, 0)
	SetUnitValue(COB.BUGGER_OFF, 0)
	return 0
end

function QueryBuildInfo() 
	return pad
end

function QueryNanopiece() 
	return beam 
end

function script.Killed(recentDamage, maxHealth)
	--boom
end
spiked was using activate and deactivate instead of stop building/start building. I am not sure if it is relevant..

Anyway, maybe try commenting out all of your animation code and just leaving set unit value stuff? Also Spring.Echos are SUPER HANDY... so for example:

Code: Select all

function script.StopBuilding()
	Spring.Echo("stop building call")
	--Turn (crane1, y_axis, 0, math.rad(100))
	--StopSpin (nano, z_axis)
	--Turn (nano, z_axis, 0, math.rad(200))
	--moveCrane (0)
	SetUnitValue(COB.INBUILDSTANCE, 0)
end

function script.StartBuilding(heading, pitch)
	Spring.Echo("start building call")	
	--Turn (crane1, y_axis, heading+math.rad(180), math.rad(100))
	--moveCrane (75)
	--waitForCrane ()
	--Spin (nano, z_axis, math.rad (200))
	SetUnitValue(COB.INBUILDSTANCE, 1)
end

function script.QueryNanoPiece()
	Spring.Echo(nano, "nanopiece")
	return nano
end
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: The builder will show highlight for structure but not bu

Post by KDR_11k »

The most common cause is not setting the build stance in the unit script (which indicates to the engine that the builder is done unfolding and can now spray nano).
User avatar
The_Igishly_Co
Posts: 34
Joined: 10 Oct 2013, 01:56

Re: The builder will show highlight for structure but not bu

Post by The_Igishly_Co »

Okay... ALL of the pieces in the script are not in my model, because I was using Knorkes Spring Tutorial game as a base... So... How would I code a model to build without using an animation? Maybe some particle effects
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: The builder will show highlight for structure but not bu

Post by smoth »

re-read my post. Start there.
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

Re: The builder will show highlight for structure but not bu

Post by FireStorm_ »

The_Igishly_Co wrote:How would I code a unit-script to build without using an animation? Maybe some particle effects
If I remember correctly, I think that is "impossible." (But because of semantics.) I usually call everything in a unit-script part of the animation. :-)

One could say Spring's history starts with OTA (the original Total Annihilation) As I suspect you know, in OTA stuff is build with a nano-spray from some nozzle.

So you could say that when Spring was developed, they didn't really imagine any other way of building. You could say it is the standard, or build-in-way, to show units building stuff.

In the end you can make building stuff look like whatever you want, but in the beginning nano-spray is how Spring kinda assumes you will do it. "Oh, you made a builder? Then I'm sure you can tell me where your nozzle is, can't you?"

You can and did. Info like that goes in the unit script:

Code: Select all

local nano = piece "nano"

Code: Select all

function script.QueryNanoPiece()
     return nano
end
So even if you don't want any visible spray, but i.e. some medieval orc with a wrench or something, Spring still asks you where the nozzle is, because of its history.

Whether the spray is visible or not, is defined in the Unit definitions file:
springrts.com/wiki/Units-UnitDefs wrote: bool showNanoSpray Default: true
Does the builder emit OTA-style nanospray whilst constructing?

float[3] nanoColor Default: {0.2, 0.7, 0.2} aka green
The RGB colour of a builders' emitted nano particles if showNanoSpray = true. Also controls the RBG colour of a unit's own nanoframe if showNanoFrame = true.
I hope that helps.
(I assume knowledgeable Spring Elders will correct me if I made any mistakes :-) )
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: The builder will show highlight for structure but not bu

Post by jK »

FireStorm_ wrote:You can and did. Info like that goes in the unit script:

Code: Select all

local nano = piece "nano"

Code: Select all

function script.QueryNanoPiece()
     return nano
end
https://github.com/spring/spring/blob/d ... g.txt#L391 :
! LUS/COB: deprecate QueryNanoPiece() makes SimCode ~10% faster use the new Spring.SetUnitNanoPieces instead
Note, once set the engine won't call `QueryNanoPiece` anymore and instead randomly toggles between the set nanopieces,
saving a lot time-consuming COB/LUS calls.
User avatar
The_Igishly_Co
Posts: 34
Joined: 10 Oct 2013, 01:56

Re: The builder will show highlight for structure but not bu

Post by The_Igishly_Co »

... I feel stupid...


After all this time... I just needed to rename a piece of the model: Nano... Thank you for your help, now... BACK TO MY GAME!
Post Reply

Return to “Game Development”