while converting one of my cob scripts to lua I ran into an issue. Where i would normally use get/set of some constants, I am wondering how I would do this with LUA. What are the LUA equivalents of GET/SET for some of the more essential cob constants such as:
PIECE_XZ 7
PIECE_Y 8
GROUND_HEIGHT 16
ARMORED 20
VETERAN_LEVEL 32
MAX_SPEED 75
CLOAKED 76
HEADING 82
CURRENT_FUEL 93
edit: found some examples
would you use all of them like this:
local cloaked = COB.CLOAKED
Spring.UnitScript.SetUnitValue( cloaked, 0 )
LUA equivlents to COB GET/SETs
Moderator: Moderators
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: LUA equivlents to COB GET/SETs
You shouldn't use any GET/SET functions in Lua.
Lua has its own API which is more powerful than the COB one.
The wiki will help you to find the functions you need:
http://springrts.com/wiki/Lua_Scripting
Lua has its own API which is more powerful than the COB one.
The wiki will help you to find the functions you need:
http://springrts.com/wiki/Lua_Scripting
Last edited by jK on 20 Jun 2010, 18:04, edited 1 time in total.
Re: LUA equivlents to COB GET/SETs
Lua doesn't have SetHeading without the use of MoveCtrl, for a start.
Re: LUA equivlents to COB GET/SETs
?Spring.SetUnitRotation
( number unitID, number rotx, number roty, number rotz ) -> nil
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: LUA equivlents to COB GET/SETs
I don't think that is the same thing as heading.
And yes I've read the wiki's, it just seems like not all of those translate to lua unit control.
And yes I've read the wiki's, it just seems like not all of those translate to lua unit control.
Re: LUA equivlents to COB GET/SETs
They are there and they even have equal function names, use ctrl+f it's a pretty nice function of your browser.
And sure SetUnitRotation contains the same functionally as HEADING in COB, you just need to use the more common euler system.
And sure SetUnitRotation contains the same functionally as HEADING in COB, you just need to use the more common euler system.
Re: LUA equivlents to COB GET/SETs
Why have GetUnitHeading and not SetUnitHeading, or why have it only as part of MoveCtrl?
The functions for getting piece position/direction are also dubious at best. (direction is based on angle of v1 - v0 instead of actual rotation around origin, unless you use Spring.UnitScript.GetPiece* functions).
The functions for getting piece position/direction are also dubious at best. (direction is based on angle of v1 - v0 instead of actual rotation around origin, unless you use Spring.UnitScript.GetPiece* functions).
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: LUA equivlents to COB GET/SETs
well if
is incorrect why is CA using it? I am just saying there is a lack of proper examples.
Code: Select all
local cloaked = COB.CLOAKED
Spring.UnitScript.SetUnitValue( cloaked, 0 )
is incorrect why is CA using it? I am just saying there is a lack of proper examples.