Display Unit as build command
Moderator: Moderators
Display Unit as build command
Two units to be displayed as when you choose "build".
Example of the picture.
needed:
- Simultaneously display two units
- Display the grid
- Align to grid
- Display the availability of construction for each cell
Looking for code samples, commands, lua, widgets or other assistance ...Please help.
P.S.
Sorry for my english.
Example of the picture.
needed:
- Simultaneously display two units
- Display the grid
- Align to grid
- Display the availability of construction for each cell
Looking for code samples, commands, lua, widgets or other assistance ...Please help.
P.S.
Sorry for my english.
- Attachments
-
- Sample
- Build.png (656.84 KiB) Viewed 1622 times
Re: Display Unit as build command
Thank you for your help!
Unfortunately I have not found answers to their questions. In the subject being discussed tech tree, but I'm only interested in place to build. I need to display identical image, but so that I could manage it himself. Maybe I did not understand your example? If so tell me where to find the flow.
how to check whether it is possible to construct an arbitrary unit (UnitID) at an arbitrary position (x, y, z) (with details like the image)?
Unfortunately I have not found answers to their questions. In the subject being discussed tech tree, but I'm only interested in place to build. I need to display identical image, but so that I could manage it himself. Maybe I did not understand your example? If so tell me where to find the flow.
how to check whether it is possible to construct an arbitrary unit (UnitID) at an arbitrary position (x, y, z) (with details like the image)?
Re: Display Unit as build command
Partly found the answer!
I am looking for how to display the grid and get more detailed information about the availability of construction
Code: Select all
-- get the coordinates of gridded
local bx, by, bz = Spring.Pos2BuildPos (UnitDefID, x, y, z)
-- check the availability of construction
local CheckResult = Spring.TestBuildOrder (UnitDefID, bx, by, bz, h)
Re: Display Unit as build command
what excactly?get more detailed information about the availability of construction
The red/yellow/green/ is drawn by the engine.
drawing something yourself: http://answers.springlobby.info/questio ... game-world
Re: Display Unit as build command
I have no problem with how to draw.
Problems with the lack of data! How to get the details about what a square is not available for place building?
Problems with the lack of data! How to get the details about what a square is not available for place building?
- Attachments
-
- Grid Detail Info
- Build.png (598.08 KiB) Viewed 1591 times
Re: Display Unit as build command
this function "ClosestBuildSite" not accesible from Lua Widget?
Where can I find a complete list of features available in LUA?
Here "http://springrts.com/wiki/Lua_Scripting" does not list all the functions ... For example there is no "Pos2BuildPos"
Where can I find a complete list of features available in LUA?
Here "http://springrts.com/wiki/Lua_Scripting" does not list all the functions ... For example there is no "Pos2BuildPos"
Re: Display Unit as build command
ah i understand.
You want something like "can not build here because at 500:450 the terrain slope is too steep and there is a tree at 510:455"
There are 4 things that can block building:
1) features (rocks, trees) -> you can test for those yourself
2) other units -> you can test for those yourself, too
3) water is too deep or too shallow -> possible to read terrain height
4) terrain is too steep -> possible to read terrain slope, too
5) is there a geovent? (for geo powerplant) -> can that for that too
(maybe forgott something)
So you could test everything yourself using GetFeatures and GetUnits functions. If there is something easier, I dont know.
You want something like "can not build here because at 500:450 the terrain slope is too steep and there is a tree at 510:455"
There are 4 things that can block building:
1) features (rocks, trees) -> you can test for those yourself
2) other units -> you can test for those yourself, too
3) water is too deep or too shallow -> possible to read terrain height
4) terrain is too steep -> possible to read terrain slope, too
5) is there a geovent? (for geo powerplant) -> can that for that too
(maybe forgott something)
So you could test everything yourself using GetFeatures and GetUnits functions. If there is something easier, I dont know.
Re: Display Unit as build command
use `text search`/`find` functionality of your browserTanatos wrote:Here "http://springrts.com/wiki/Lua_Scripting" does not list all the functions ... For example there is no "Pos2BuildPos"
Re: Display Unit as build command
already use and Spring.TestBuildOrder Spring.Pos2BuildPos, see post number 4.
Thanks anyway!
Thanks anyway!
Re: Display Unit as build command
knorke, thank you very much for your patience and responsiveness!
Otherwise, the result is achieved.
Added
In the picture example of mode "ShowPathMap" (F2) and the team "build."
You can get similar data from Lua Widget?
I decided to do without until the detail - it is difficult and the result is not worth it. If I find an affordable solution append script.knorke wrote: 1) not interested
2) not interested
3) not interested
4) terrain is too steep -> possible to read terrain slope, too
How?
5) not interested
Otherwise, the result is achieved.
Added
In the picture example of mode "ShowPathMap" (F2) and the team "build."
You can get similar data from Lua Widget?
- Attachments
-
- F2(2).png (330.24 KiB) Viewed 1556 times
-
- F2.png
- F2 + Build Comand
- (508.1 KiB) Downloaded 2 times
Re: Display Unit as build command
Spring.GetGroundNormal ( number x, number z ) -> number x, number y, number zTanatos wrote:4) terrain is too steep -> possible to read terrain slope, too
How?
A groundnormal is a vector that sits orthogonal on the terrain.
(imagine the S shaped curve is terrain)
On flat ground it will point straight to the sky (0, 1, 0)
You have to compare it to the maxSlope of the unitDef you are trying to build. (needs some math to convert etc)
Yes, combining all this it would be possible to get something similiar like the F2 map.
Just wondering what you need it for?
Are you making a game or a widget or something else?
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
Re: Display Unit as build command
If you're aiming to add build options without having a build menu you could maybe do something clever with hidden build options and setactivecommand?
Re: Display Unit as build command
Thank you very much for your answers!
Special thanks for "maxSlope of the unitDef", sure it is key information for solving the problem.
I do not have a specific goal. Programming, a hobby of mine. Now I'm curious to deal with Lua scripts in the Spring. Learn what is already written. In the course of the study come to mind that can be done. I try to do it. Put questions and seeking answers. Something like this:)
P.S.
Sorry for my English.
Special thanks for "maxSlope of the unitDef", sure it is key information for solving the problem.
I do not have a specific goal. Programming, a hobby of mine. Now I'm curious to deal with Lua scripts in the Spring. Learn what is already written. In the course of the study come to mind that can be done. I try to do it. Put questions and seeking answers. Something like this:)
P.S.
Sorry for my English.