Page 1 of 1

Is there any way to force a unit to uncloak?

Posted: 09 Apr 2009, 03:20
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.

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

Posted: 09 Apr 2009, 04:00
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;

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

Posted: 10 Apr 2009, 04:28
by smartie
dang, that's pretty messy.

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

Posted: 10 Apr 2009, 07:31
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.

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

Posted: 13 Apr 2009, 17:11
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)

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

Posted: 15 Apr 2009, 04:53
by smartie
Thats good to know. If thats the case then there really isn't any reason to change anythign :)