View unanswered posts | View active topics It is currently Thu Jan 02, 2025 8:27 pm



Reply to topic  [ 8 posts ] 
 Need some guidance on a common bit of syntax 
Author Message
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Need some guidance on a common bit of syntax
Hello to all.

I need to know why there are numbers required in the parentheses of statements such as
-self:GetAltitude(x,y)
-SceneMan:FindAltitude(x,y,z)
-and other things like this.

Could some kind soul tell me what these numbers are/do/represent?

Thank you.


Fri May 28, 2010 1:36 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Need some guidance on a common bit of syntax
Those "statements" there are functions. Functions do stuff. But they need information on how to do it. Those numbers are the information. Check the wiki for what each number is defining.


Fri May 28, 2010 1:49 am
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: Need some guidance on a common bit of syntax
I checked the wiki, but everything except things pertaining to the vector() statements seemed very ambiguous. I also noticed there are no articles regarding the SceneMan. If I could have specific answers as to what the numbers in the parentheses of the statements above do, I would be very much obliged.


Fri May 28, 2010 2:17 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Need some guidance on a common bit of syntax
Tip: "SceneMan" is the shortened name of "SceneManager".

Also, I'm not completely sure how to use the FindAltitude function. You're better off casting a StrengthRay downwards.

wiki wrote:
CastStrengthRay
Traces along a vector and shows where along that ray there is an encounter with a pixel of a material with strength more than or equal to a specific value.

Arguments:

-The starting position.
-The vector to trace along.
-The strength value of screen any found to be equal or more than will terminate the ray.
-A reference to the vector screen will be filled out with the absolute location of the found terrain pixel of less than or equal to above strength.
-For every pixel checked along the line, how many to skip between them for optimization reasons. 0 = every pixel is checked.
-A material ID to ignore, IN ADDITION to Air.
-Whetehr the ray should wrap around the scene if it crosses a seam.

Return value:
Whether a material of equal or more strength was found along the ray. If not, the fourth parameter have been set to last position of the ray.



How to read the wiki:

Name of function
What this function does

Arguments - the things that go into the parantheses

Return Value - What the function spits back out at you. If you set a variable equal to a function, the variable will equal whatever the function spat out.


Specific break-down of CastStrengthRay arguments (ini modding knowledge required)
-Where this "ray" starts (Vector)
-What direction to draw the line and how long to draw it (Vector)
-The material with this strength value will stop this ray (number)
-How many pixels to skip scanning. If this is set to five, only the sixth pixel after will be checked (number)
-What material the ray should ignore. Materials are identified by their ID index number (number)
-If the map wraps, should the ray wrap across the map too? (boolean)


Fri May 28, 2010 8:40 pm
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: Need some guidance on a common bit of syntax
Alright. Thank you, but I'm afraid I'm still clueless.

Could you write a statement for a CastObstacleRay that starts at an actor and then points straight down at the ground (stopping at the terrain) and returns a value of how long the ray is?


Fri May 28, 2010 9:16 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Need some guidance on a common bit of syntax
The way CastStrengthRay works is that you set the ray length, and the return value is if the ray hit terrain. The position of the detected terrain pixel is dumped in a variable as a vector (woops forgot to describe this, but I just did). You're trying to figure out the altitude of the actor, right? You could do a distance check with the position of the detected pixel and the actor to get the altitude.


Fri May 28, 2010 11:19 pm
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: Need some guidance on a common bit of syntax
Sorry, could I have that in code please?


Fri May 28, 2010 11:20 pm
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: Need some guidance on a common bit of syntax
YYYYEEEEEEEEEEEEHHHHHHHAAAAAWWWWWW!!!!!!!!!!!

I got SceneMan:FindAltitude() to work!!!

Aparently, you say SceneMan:FindAltitude(self.Pos <to give it your current position>, <the max length of the ray>, <how many pixels the check skips (like you said, for optimization)>)

I stared at Abdul's SAM Drop Crate code for about half an hour, and using what you said, it all suddenly clicked!

Thank you very much Cricket, many mods shall benefit from your advice (or code :grin: )


Fri May 28, 2010 11:42 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

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.046s | 15 Queries | GZIP : Off ]