Unit is gone, but still able to see enemies

Unit is gone, but still able to see enemies

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
jamesbigmac
Posts: 20
Joined: 14 Jun 2012, 15:33

Unit is gone, but still able to see enemies

Post 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)
Attachments
visiblebug.png
(2.81 MiB) Downloaded 4 times
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

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

Post by Google_Frog »

Have you tried setting LOS in the unit def to see if that changes anything?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

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

Post 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?)
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

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

Post 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.
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

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

Post by KingRaptor »

More like
jamesbigmac wrote:Spring.SetUnitSensorRadius(unitID, "airlos", 0)
airLos, camelCase it!
jamesbigmac
Posts: 20
Joined: 14 Jun 2012, 15:33

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

Post 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.
Post Reply

Return to “Game Development”