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 » 28 Mar 2011, 06:18

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!
0 x

SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1945
Joined: 21 Sep 2004, 08:25

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by SpikedHelmet » 28 Mar 2011, 11:39

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.
0 x

User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by oksnoop2 » 28 Mar 2011, 15:31

BA recently made the jump to lua. maybe open a side by side of a 7.20 and a 7.31 unit.
0 x

User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Guessmyname » 28 Mar 2011, 19:48

Isn't there an fbi > lua conversion script around somewhere?
0 x


User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14601
Joined: 17 Nov 2005, 02:43

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Forboding Angel » 29 Mar 2011, 00:36

stealth = true, (lua unitdef)
stealth = 1; (fbi unitdef)
0 x

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

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 » 29 Mar 2011, 02:55

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?
0 x

trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by trepan » 29 Mar 2011, 15:02

unitDef ~= unit

Want you want is the GetUnitStealth() function, which does not exist.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14601
Joined: 17 Nov 2005, 02:43

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Forboding Angel » 29 Mar 2011, 22:19

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?
0 x

User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by SinbadEV » 29 Mar 2011, 22:24

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)
0 x

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

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 » 30 Mar 2011, 11:15

radarjamming?
Hmm...how should I look into it?
0 x

SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1945
Joined: 21 Sep 2004, 08:25

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by SpikedHelmet » 30 Mar 2011, 18:35

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
0 x

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

Re: Spring.SetUnitStealth and .fbi vs .lua

Post by Von66341 » 31 Mar 2011, 08:57

Thanks SpikedHelmet!
0 x

Post Reply

Return to “Game Development”

cron