how to tell a builder to build a thing

how to tell a builder to build a thing

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
daryl
Posts: 200
Joined: 08 Oct 2006, 10:33

how to tell a builder to build a thing

Post by daryl »

Hola,
i'm creating a mission for fun.
NOw i need to know how a mechlab named "x" can build an unit named "y".
Is this possible???
thedude
Posts: 66
Joined: 21 Aug 2009, 12:47

Re: how to tell a builder to build a thing

Post by thedude »

After about two weeks :evil: of tinkering this worked for me:

Code: Select all

Spring.GiveOrderToUnit(builderID, -defID, {1060,0,300,0}, {})
builderID: unitID of the builder
-defID: negativ defID of the unit to be build
1060,0,300: position where to build
User avatar
daryl
Posts: 200
Joined: 08 Oct 2006, 10:33

Re: how to tell a builder to build a thing

Post by daryl »

thedude wrote:After about two weeks :evil: of tinkering this worked for me:

Code: Select all

Spring.GiveOrderToUnit(builderID, -defID, {1060,0,300,0}, {})
builderID: unitID of the builder
-defID: negativ defID of the unit to be build
1060,0,300: position where to build
ops sorry.. i wrong the subject of the topic.
i mean the lab, not builder.
it's the same code??
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: how to tell a builder to build a thing

Post by Beherith »

As far as I know its the same command (but i may be wrong on this one).

Also, if you would like a custom map for your mission, Ill gladly make you one if you sketch me a heightmap and indicate the passability you would like on it.
User avatar
daryl
Posts: 200
Joined: 08 Oct 2006, 10:33

Re: how to tell a builder to build a thing

Post by daryl »

Beherith wrote:As far as I know its the same command (but i may be wrong on this one).

Also, if you would like a custom map for your mission, Ill gladly make you one if you sketch me a heightmap and indicate the passability you would like on it.
sorry... can you read this code below?
now the unit "armcv001" receive the order to move.
how i can give the order to build "a" unit/object in x and y pos??

Code: Select all

[4] = {
			logic = {
				[1] = {
					logicType = [[CountdownEndedCondition]],
					args = {
						countdown = [[start prova]],
					},
					name = [[Countdown Ended]],
				},
				[2] = {
					logicType = [[GiveOrdersAction]],
					args = {
						orders = {
							[1] = {
								orderType = [[MOVE]],
								args = {
									[1] = 6504,
									[2] = 0,
									[3] = 7800,
								},
							},
						},
						groups = {
							[1] = [[armcv001]],
							[2] = [[armcv001]],
						},
					},
					name = [[Give Orders]],
				},
			},
			maxOccurences = 1,
			enabled = true,
			probability = 1,
		},
	},
what i need to write???
intresting... i need some help for my project ( maps included)... i make two map but i don't want to use them into the mission :) i need a good map...
how i can conctact you??
thedude
Posts: 66
Joined: 21 Aug 2009, 12:47

Re: how to tell a builder to build a thing

Post by thedude »

daryl wrote:
sorry... can you read this code below?
now the unit "armcv001" receive the order to move.
how i can give the order to build "a" unit/object in x and y pos??

Code: Select all

[4] = {
			logic = {
				[1] = {
					logicType = [[CountdownEndedCondition]],
					args = {
						countdown = [[start prova]],
					},
					name = [[Countdown Ended]],
				},
				[2] = {
					logicType = [[GiveOrdersAction]],
					args = {
						orders = {
							[1] = {
								orderType = [[MOVE]],
								args = {
									[1] = 6504,
									[2] = 0,
									[3] = 7800,
								},
							},
						},
						groups = {
							[1] = [[armcv001]],
							[2] = [[armcv001]],
						},
					},
					name = [[Give Orders]],
				},
			},
			maxOccurences = 1,
			enabled = true,
			probability = 1,
		},
	},
what i need to write???
intresting... i need some help for my project ( maps included)... i make two map but i don't want to use them into the mission :) i need a good map...
how i can conctact you??
Sorry dude I don't get what your problem is. If you try to do something with the table (your code) and the build command thats what I would try.
(don't know if thats what u want or if that will help you somehow)

Code: Select all

[4] = {
			logic = {
				[1] = {
					logicType = [[CountdownEndedCondition]],
					args = {
						countdown = [[start prova]],
					},
					name = [[Countdown Ended]],
				},
				[2] = {
					logicType = [[GiveOrdersAction]],
					args = {
						orders = {
							[1] = {
								orderType = [[MOVE]],
								args = {
									[1] = 6504,
									[2] = 0,
									[3] = 7800,
								},
							},
                                                       
							[2] = {
								orderType = [[-defID]],
								args = {
									[1] = 1060,
									[2] = 0,
									[3] = 300,
									[4] = 0,
								},
							},
						},
						groups = {
							[1] = [[armcv001]],
							[2] = [[armcv001]],
						},
					},
					name = [[Give Orders]],
				},
			},
			maxOccurences = 1,
			enabled = true,
			probability = 1,
		},
	},
-defID: negativ defID of the unit to be build
Post Reply

Return to “Lua Scripts”