Hey! does any one know how do I get a ship to spawn in a map at the begining of the game?
My land units are able to spawn at the game, but not my ships.
Thanks.
Spawn Ship
Moderator: Moderators
Re: Spawn Ship
Set it as your starting unit.
http://code.google.com/p/conflictterra/ ... dedata.lua
Example ^^^^^^^^^
http://code.google.com/p/conflictterra/ ... dedata.lua
Example ^^^^^^^^^
Re: Spawn Ship
Do we need to change anything in spawn.lua?
Re: Spawn Ship
the file oksnoop2 posted is just a config file for a gadget that reads the config and then spawns those units.
spawner gadget would be this:
http://code.google.com/p/conflictterra/ ... _spawn.lua
gadget comes from this thread:
http://springrts.com/phpbb/viewtopic.php?f=67&t=21883
I dont see why ships should be any different than land units. Does your ship work when you do
/cheat
/give unitname
?
Maybe give infolog.txt or upload your game.
spawner gadget would be this:
http://code.google.com/p/conflictterra/ ... _spawn.lua
gadget comes from this thread:
http://springrts.com/phpbb/viewtopic.php?f=67&t=21883
I dont see why ships should be any different than land units. Does your ship work when you do
/cheat
/give unitname
?
Maybe give infolog.txt or upload your game.
Re: Spawn Ship
Make sure your ship is a valid unit by typing in the console:
/cheat
/give yourshipname
/cheat
/give yourshipname
Re: Spawn Ship
Sorry am little new to spring and lua.
what do you all meant by console?
cause in gameplay i couldn't type anything.
I did following to add a ship unit:
Under hq_spawn.lua, I added the ship I want to spawn.
For e.g part of the code:
ushq={
spread= 200,
units={
"ship1",
"ship2",
},
},
will this work?
In the gadget spawn.lua,
Part of the code is like this:
local function IsPositionValid(unitDefID, x, z)
-- Don't place units underwater. (this is also checked by TestBuildOrder
-- but that needs proper maxWaterDepth/floater/etc. in the UnitDef.)
local y = GetGroundHeight(x, z)
if (y <= 0) then
return false
end
-- Don't place units where it isn't be possible to build them normally.
local test = TestBuildOrder(unitDefID, x, y, z, 0)
if (test ~= 2) then
return false
end
-- Don't place units too close together.
local ud = UnitDefs[unitDefID]
local units = GetUnitsInCylinder(x, z, CLEARANCE)
if (units[1] ~= nil) then
return false
end
return true
end
Do i need to change anything?
Thanks lots for the help! =)
what do you all meant by console?
cause in gameplay i couldn't type anything.
I did following to add a ship unit:
Under hq_spawn.lua, I added the ship I want to spawn.
For e.g part of the code:
ushq={
spread= 200,
units={
"ship1",
"ship2",
},
},
will this work?
In the gadget spawn.lua,
Part of the code is like this:
local function IsPositionValid(unitDefID, x, z)
-- Don't place units underwater. (this is also checked by TestBuildOrder
-- but that needs proper maxWaterDepth/floater/etc. in the UnitDef.)
local y = GetGroundHeight(x, z)
if (y <= 0) then
return false
end
-- Don't place units where it isn't be possible to build them normally.
local test = TestBuildOrder(unitDefID, x, y, z, 0)
if (test ~= 2) then
return false
end
-- Don't place units too close together.
local ud = UnitDefs[unitDefID]
local units = GetUnitsInCylinder(x, z, CLEARANCE)
if (units[1] ~= nil) then
return false
end
return true
end
Do i need to change anything?
Thanks lots for the help! =)
Re: Spawn Ship
console = the chat 
http://answers.springlobby.info/questio ... est-my-mod
reading the comments, there seems to be some code that only spawns the unit if the position is a) on land and b) the position is not blocked.
Probally be best to start making your game from the example game:
http://springrts.com/wiki/The_Complete_ ... pring_Game
I think that is the "cleanest" example game there is.
if you start with modifying other games, you will always have left over things like this.

http://answers.springlobby.info/questio ... est-my-mod
reading the comments, there seems to be some code that only spawns the unit if the position is a) on land and b) the position is not blocked.
Probally be best to start making your game from the example game:
http://springrts.com/wiki/The_Complete_ ... pring_Game
I think that is the "cleanest" example game there is.
if you start with modifying other games, you will always have left over things like this.
Re: Spawn Ship
hey! i manage to test my units and they work when I key into the console.
When I key /give yourship name, the ship spawn on land, how can i let it spawn on water?
Any idea how I can edit the gadget: spawn.lua to allow my ship to spawn on water?
When I key /give yourship name, the ship spawn on land, how can i let it spawn on water?
Any idea how I can edit the gadget: spawn.lua to allow my ship to spawn on water?
Re: Spawn Ship
/give spawns the unit at your mouse pointer. so point it at water.When I key /give yourship name, the ship spawn on land, how can i let it spawn on water?
remove the part that checks for valid position or modify it. or use the gadget from the "complete guide to.." game that does not do such checks at all.Any idea how I can edit the gadget: spawn.lua to allow my ship to spawn on water?
where did you find this spawn.lua?
Re: Spawn Ship
Thanks all for the help! my ships are working! =)
knorke the spawn.lua found from spring1944.
Thanks alot for your help!
knorke the spawn.lua found from spring1944.
Thanks alot for your help!