View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:27 pm



Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
 Getting the height of the terrain 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Getting the height of the terrain
Yes.


Mon Feb 21, 2011 11:02 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Getting the height of the terrain
true/false


Mon Feb 21, 2011 11:08 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Getting the height of the terrain
Ok.


Mon Feb 21, 2011 11:37 pm
Profile
User avatar

Joined: Mon Apr 05, 2010 8:04 am
Posts: 149
Location: Under your bed
Reply with quote
Post Re: Getting the height of the terrain
Just wondering, what else can this be applied to?


Thu Mar 03, 2011 12:11 pm
Profile YIM
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Getting the height of the terrain
Self.Altitude is what you want.


Sun Mar 06, 2011 5:29 am
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Getting the height of the terrain
That's what it's for.


Sun Mar 06, 2011 5:51 am
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 18 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.362s | 13 Queries | GZIP : Off ]