Spring.SetUnitStealth and .fbi vs .lua

Spring.SetUnitStealth and .fbi vs .lua

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
Von66341
Posts: 111
Joined: 10 Feb 2011, 03:00

Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 »

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!
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by SpikedHelmet »

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?
Yes it can as it is an engine function that doesn't care what language your unitdefs or scripts are written in.
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?
Looking at existing Lua scripts from ZK or Gundam or etc will help you a lot with familiarizing, I'd start there.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by oksnoop2 »

BA recently made the jump to lua. maybe open a side by side of a 7.20 and a 7.31 unit.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Guessmyname »

Isn't there an fbi > lua conversion script around somewhere?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Forboding Angel »

stealth = true, (lua unitdef)
stealth = 1; (fbi unitdef)
Von66341
Posts: 111
Joined: 10 Feb 2011, 03:00

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 »

Hey! my unitdef are in .fbi

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) 
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?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by trepan »

unitDef ~= unit

Want you want is the GetUnitStealth() function, which does not exist.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Forboding Angel »

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?
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by SinbadEV »

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?
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)
Von66341
Posts: 111
Joined: 10 Feb 2011, 03:00

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 »

radarjamming?
Hmm...how should I look into it?
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by SpikedHelmet »

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
Von66341
Posts: 111
Joined: 10 Feb 2011, 03:00

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 »

Thanks SpikedHelmet!
Post Reply

Return to “Game Development”