Page 1 of 1

Unit is gone, but still able to see enemies

Posted: 16 Jul 2012, 16:53
by jamesbigmac
I'm trying to make a unit invisible to the player controlling it for a certain amount of time, but no matter what I turn off or change, the unit is still capable of "seeing" everything except for ground units that are not buildings.

There is still this radar type radius around the unit that is capable of viewing enemy units. Although the unit is deactivated, has its line of sight, radar, and air line of sight at 0, it can see buildings and air units as well as shields. An image is attached of exactly what I mean. In the image, my allied color is blue and the enemy is yellow. Even though there are no blue units capable of seeing the enemy air units, they are still visible.

Here's a snippet of the code I'm using (There originally was much less, but I was hoping some of the extras would turn off whatever I'm combating):

Code: Select all

   Spring.SetUnitSensorRadius(unitID, "los", 0)
	Spring.SetUnitSensorRadius(unitID, "airlos", 0)
	Spring.SetUnitSensorRadius(unitID, "radar", 0)
	Spring.SetUnitSensorRadius(unitID, "radarJammer", 0)
	Spring.SetUnitLosState(unitID, Spring.GetUnitAllyTeam(unitID), {los = false, radar = false, prevLos = false, contRader = false})
	Spring.SetUnitNoSelect(unitID, true)

Re: Unit is gone, but still able to see enemies

Posted: 16 Jul 2012, 17:35
by Google_Frog
Have you tried setting LOS in the unit def to see if that changes anything?

Re: Unit is gone, but still able to see enemies

Posted: 16 Jul 2012, 18:35
by knorke
I'm trying to make a unit invisible to the player controlling
http://springrts.com/wiki/Lua_UnsyncedC ... CNoMinimap

as for making a unit blind, there is this map which is so dark no unit can see: :shock:
http://springrts.com/phpbb/viewtopic.ph ... t=darkroom
But I think it was done same way as you try..so not sure.
(might also be possible something changed with new engine?)

Re: Unit is gone, but still able to see enemies

Posted: 16 Jul 2012, 21:07
by Pressure Line
jamesbigmac wrote:Spring.SetUnitLosState(unitID, Spring.GetUnitAllyTeam(unitID), {los = false, radar = false, prevLos = false, contRader = false})
Have you tried spelling 'radar' correctly? It may do the trick.

Re: Unit is gone, but still able to see enemies

Posted: 17 Jul 2012, 08:50
by KingRaptor
More like
jamesbigmac wrote:Spring.SetUnitSensorRadius(unitID, "airlos", 0)
airLos, camelCase it!

Re: Unit is gone, but still able to see enemies

Posted: 17 Jul 2012, 14:33
by jamesbigmac
Good spot KingRaptor!
Totally missed that and I was pulling out my hair trying to get that thing to behave the way I wanted. I had no idea I didn't camelCase it.