Data Realms Fan Forums
http://45.55.195.193/

Getting the height of the terrain
http://45.55.195.193/viewtopic.php?f=73&t=21558
Page 1 of 2

Author:  Asklar [ Mon Feb 21, 2011 10:52 pm ]
Post subject:  Getting the height of the terrain

I was doing a landmine, and realized that it sometimes becomes terrain.
To solve it, I set in the .lua file self.ToSettle = false and self.Age = 0, and still, sometimes it still turns into terrain.
To prevent this, I thought that if I could make it float like 2 or 3 pixels above the terrain, it wouldn't become it.
First, would that help?
And second, how could I get the height it has from the ground and make the gib float over it?

Author:  CaveCricket48 [ Mon Feb 21, 2011 10:57 pm ]
Post subject:  Re: Getting the height of the terrain

Lizard found that if set something to MissionCritical = 1, you keep it from becoming terrain. For your mine, set it to MissionCritical = 1 in function Update(), but turn it to MissionCritical = 0 right before detonating it.

Pinning something, combined with "ToSettle = false" also keeps it from turning to terrain.

Author:  Asklar [ Mon Feb 21, 2011 11:00 pm ]
Post subject:  Re: Getting the height of the terrain

Nice.
So, in the update self I set self.MissionCritical = 1, and in the detonation if I set self.MissionCritical = 0 and then Self.GibThis(), right?

Author:  CaveCricket48 [ Mon Feb 21, 2011 11:02 pm ]
Post subject:  Re: Getting the height of the terrain

Yes.

Author:  Asklar [ Mon Feb 21, 2011 11:03 pm ]
Post subject:  Re: Getting the height of the terrain

Now that was quick.
Wait, if I set in the lua, the booleans are true/false or 1/0?

Author:  CaveCricket48 [ Mon Feb 21, 2011 11:08 pm ]
Post subject:  Re: Getting the height of the terrain

true/false

Author:  Asklar [ Mon Feb 21, 2011 11:37 pm ]
Post subject:  Re: Getting the height of the terrain

Ok.

Author:  blargiefarg [ Thu Mar 03, 2011 12:11 pm ]
Post subject:  Re: Getting the height of the terrain

Just wondering, what else can this be applied to?

Author:  Grif [ Fri Mar 04, 2011 1:01 am ]
Post subject:  Re: Getting the height of the terrain

The MissionCritical flag? Most likely, it's set up as a general property for all MOs, meaning that any actor, item, particle, or, really, anything that isn't terrain could use it. The only dubious one in that list is, maybe, mopixels, but they're often included in general MO properties.

Author:  Asklar [ Sun Mar 06, 2011 5:26 am ]
Post subject:  Re: Getting the height of the terrain

Wait, now I want to get the height of the terrain for another thing.


How can I get it?

Author:  411570N3 [ Sun Mar 06, 2011 5:29 am ]
Post subject:  Re: Getting the height of the terrain

Self.Altitude is what you want.

Author:  Asklar [ Sun Mar 06, 2011 5:33 am ]
Post subject:  Re: Getting the height of the terrain

Altitude works with the height of the terrain?
I mean, if I have a hill, and I want an object to get pinned when it's 5 pixels above ground, it would work in any part of the scene?

Author:  411570N3 [ Sun Mar 06, 2011 5:51 am ]
Post subject:  Re: Getting the height of the terrain

That's what it's for.

Author:  Asklar [ Sun Mar 06, 2011 6:00 am ]
Post subject:  Re: Getting the height of the terrain

self.Altitude doesn't seem to work.

I used a code that went like this:

Code:
function Update(self)
   if self.Altitude <= 5 then
      self.PinStrength = 9999;
   end
end


And the lua console says "attempt to compare nil with a number".

Author:  411570N3 [ Sun Mar 06, 2011 6:12 am ]
Post subject:  Re: Getting the height of the terrain

Ah, I've given you the wrong syntax.
Try
self:GetAltitude(0,7)

Page 1 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/