Spring.SetUnitStealth and .fbi vs .lua
Moderator: Moderators
Spring.SetUnitStealth and .fbi vs .lua
Hey! just some question on SetUnitStealth and .fbi vs .lua.
I understand that the following can be use to set stealth true/false in a unit.
Spring.SetUnitSonarStealth
( number unitID, boolean sonarStealth ) -> nil
Is it able to be use with a unitdef that is written in .fbi?
If I would like to convert .fbi to .lua how should I go about it?
Is there a wiki or guide on this?
What are the main difference of .fbi and .lua?
Thanks!
I understand that the following can be use to set stealth true/false in a unit.
Spring.SetUnitSonarStealth
( number unitID, boolean sonarStealth ) -> nil
Is it able to be use with a unitdef that is written in .fbi?
If I would like to convert .fbi to .lua how should I go about it?
Is there a wiki or guide on this?
What are the main difference of .fbi and .lua?
Thanks!
-
- MC: Legacy & Spring 1944 Developer
- Posts: 1948
- Joined: 21 Sep 2004, 08:25
Re: Spring.SetUnitStealth and .fbi vs .lua
Yes it can as it is an engine function that doesn't care what language your unitdefs or scripts are written in.Von66341 wrote: I understand that the following can be use to set stealth true/false in a unit.
Spring.SetUnitSonarStealth
( number unitID, boolean sonarStealth ) -> nil
Is it able to be use with a unitdef that is written in .fbi?
Looking at existing Lua scripts from ZK or Gundam or etc will help you a lot with familiarizing, I'd start there.If I would like to convert .fbi to .lua how should I go about it?
Is there a wiki or guide on this?
What are the main difference of .fbi and .lua?
Re: Spring.SetUnitStealth and .fbi vs .lua
BA recently made the jump to lua. maybe open a side by side of a 7.20 and a 7.31 unit.
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: Spring.SetUnitStealth and .fbi vs .lua
Isn't there an fbi > lua conversion script around somewhere?
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Spring.SetUnitStealth and .fbi vs .lua
stealth = true, (lua unitdef)
stealth = 1; (fbi unitdef)
stealth = 1; (fbi unitdef)
Re: Spring.SetUnitStealth and .fbi vs .lua
Hey! my unitdef are in .fbi
I created a gadget, to turn on/off stealth.
Part of the code as following:
When i run in it the game,
The line,Spring.Echo(ud.stealth) will still print out false, after the line, Spring.SetUnitStealth(unitID,true) is run.
Did I use Spring.SetUnitStealth wrongly?
I created a gadget, to turn on/off stealth.
Part of the code as following:
Code: Select all
if cmdID = CMD_STEALTH then
local ud = UnitDefs[Spring.GetUnitDefID(unitID)]
if(ud.stealth ==false) then
Spring.SetUnitStealth(unitID,true)
Spring.Echo("Stealth is on")
Spring.Echo(ud.stealth) --line that print false
else
Spring.SetUnitStealth(unitID,false)
Spring.Echo("Stealth is off")
Spring.Echo(ud.stealth)
The line,Spring.Echo(ud.stealth) will still print out false, after the line, Spring.SetUnitStealth(unitID,true) is run.
Did I use Spring.SetUnitStealth wrongly?
Re: Spring.SetUnitStealth and .fbi vs .lua
unitDef ~= unit
Want you want is the GetUnitStealth() function, which does not exist.
Want you want is the GetUnitStealth() function, which does not exist.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Spring.SetUnitStealth and .fbi vs .lua
OOOOOOOOOOOOOOHHHHHHHHHHHH!
I'm sorry I totally misunderstood. You were wanting something so that stealth could be turned on and off. Well you can still do that using radarjamming. It's not as elegant as a stealth on/off switch, but what would be the advantage of having stealth be off?
I'm sorry I totally misunderstood. You were wanting something so that stealth could be turned on and off. Well you can still do that using radarjamming. It's not as elegant as a stealth on/off switch, but what would be the advantage of having stealth be off?
Re: Spring.SetUnitStealth and .fbi vs .lua
I would imagine some other game mechanic would be tied to the state (for example increased power consumption or slower movement when stealth is turned on... similar to cloaking)Forboding Angel wrote:OOOOOOOOOOOOOOHHHHHHHHHHHH!
I'm sorry I totally misunderstood. You were wanting something so that stealth could be turned on and off. Well you can still do that using radarjamming. It's not as elegant as a stealth on/off switch, but what would be the advantage of having stealth be off?
Re: Spring.SetUnitStealth and .fbi vs .lua
radarjamming?
Hmm...how should I look into it?
Hmm...how should I look into it?
-
- MC: Legacy & Spring 1944 Developer
- Posts: 1948
- Joined: 21 Sep 2004, 08:25
Re: Spring.SetUnitStealth and .fbi vs .lua
we use set stealth on/off using on/off button (activation):
function script.Activate()
Spring.SetUnitStealth(unitID, false)
end
function script.Deactivate()
Spring.SetUnitStealth(unitID, true)
end
function script.Activate()
Spring.SetUnitStealth(unitID, false)
end
function script.Deactivate()
Spring.SetUnitStealth(unitID, true)
end
Re: Spring.SetUnitStealth and .fbi vs .lua
Thanks SpikedHelmet!