Is there any way to force a unit to uncloak?

Is there any way to force a unit to uncloak?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
smartie
NOTA Developer
Posts: 146
Joined: 23 Jun 2005, 19:29

Is there any way to force a unit to uncloak?

Post by smartie »

I've been trying to figure this out and I can't seem to get it to work. It seems that SetUnitCloak(unitID, false, true) should force the unit to decloak but that's not the case. Setting the decloakDistance is what we used to use previously (this is for the decloak shield gadget on radars in nota). For some reason the decloakDistance only checks up to about 550-600 range. You can set it higher, and it will show up as such, but it won't actually check beyond the 550-600 range or so.

Code: Select all

Spring.SetUnitCloak
 ( number unitID,
   boolean cloaked | number scriptCloak,
   [ number decloakDistance | boolean decloakAbs ] ) -> nil
 
 If the 2nd argument is a number, the value works like this:
  1:=normal cloak
  2:=for free cloak (cost no E)
  3:=for free + no decloaking (except the unit is stunned)
  4>=ultimative cloak (no ecost, no decloaking, no stunned decloak)
  The decloak distance is only changed if the 3th argument is a number or a boolean.
  If the boolean is false it takes the default decloak distance for that unitdef,
  if the boolean is true it takes the absolute value of it.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Is there any way to force a unit to uncloak?

Post by zwzsg »

Try doing it the bos/cob way.

#define CLOAKED 76
#define WANT_CLOAK 77

set WANT_CLOAK to FALSE;
set CLOAKED to FALSE;
User avatar
smartie
NOTA Developer
Posts: 146
Joined: 23 Jun 2005, 19:29

Re: Is there any way to force a unit to uncloak?

Post by smartie »

dang, that's pretty messy.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Is there any way to force a unit to uncloak?

Post by lurker »

I would expect the cloak-related call to work, but if you need to use the cob call then Spring.SetUnitCOBValue and Spring.GetUnitCOBValue are your friends.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Is there any way to force a unit to uncloak?

Post by KDR_11k »

The limit to decloak range effects is the decloaker's sight range, no unit can decloak what it's too far to see (helps against blind units decloaking stuff)
User avatar
smartie
NOTA Developer
Posts: 146
Joined: 23 Jun 2005, 19:29

Re: Is there any way to force a unit to uncloak?

Post by smartie »

Thats good to know. If thats the case then there really isn't any reason to change anythign :)
Post Reply

Return to “Lua Scripts”