Author |
Message |
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
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?
|
Mon Feb 21, 2011 10:52 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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.
|
Mon Feb 21, 2011 10:57 pm |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
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?
|
Mon Feb 21, 2011 11:00 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Getting the height of the terrain
Yes.
|
Mon Feb 21, 2011 11:02 pm |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
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?
|
Mon Feb 21, 2011 11:03 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Getting the height of the terrain
true/false
|
Mon Feb 21, 2011 11:08 pm |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
Re: Getting the height of the terrain
Ok.
|
Mon Feb 21, 2011 11:37 pm |
|
|
blargiefarg
Joined: Mon Apr 05, 2010 8:04 am Posts: 149 Location: Under your bed
|
Re: Getting the height of the terrain
Just wondering, what else can this be applied to?
|
Thu Mar 03, 2011 12:11 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
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.
|
Fri Mar 04, 2011 1:01 am |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
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?
|
Sun Mar 06, 2011 5:26 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Getting the height of the terrain
Self.Altitude is what you want.
|
Sun Mar 06, 2011 5:29 am |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
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?
|
Sun Mar 06, 2011 5:33 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Getting the height of the terrain
That's what it's for.
|
Sun Mar 06, 2011 5:51 am |
|
|
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
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".
|
Sun Mar 06, 2011 6:00 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Getting the height of the terrain
Ah, I've given you the wrong syntax. Try self:GetAltitude(0,7)
|
Sun Mar 06, 2011 6:12 am |
|
|
|