Frictional Games Forum (read-only)

Full Version: Error expected method or property
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(02-04-2015, 05:02 PM)Mudbill Wrote: [ -> ]The explanation below each of them should tell you roughly what it does. For example the first one:

PHP Code:
float RandFloat(float afMinfloat afMax); 

This function will return a random value between the specified minimum and maximum values. The data type will be a float. If you know C++, you know what a float is.

Let's say you have this:

PHP Code:
float f1 1.0f;

float f2 RandFloat(0.0f4.0f);

f2 f1) {
//execute script.

This example effectively returns a 20% chance of the if-statement being accepted. f1 is valued at 1, and f2 has a completely random value between 0 and 4 (inclusive). If f2 turns out to become 0, then the if-statement passes because f2 is less than f1. If f2 turns out to randomly become either 1, 2, 3 or 4, then it does not pass.

That's just one example of course. I can't explain all those in detail, but they are used in combination with other scripts on the page.

You should focus on the more action-like ones to get used to how they work. The ones like PlaySoundAtEntity or AddEntityCollideCallback or SetEntityActive should be interesting to check out.

If there's something you don't know what does, you can either try it or just not use it. There's nothing forcing you into using every script listed.

And more?
I can't spoonfeed you this information. What I just posted accounts for all of the scripts, even if they work differently. You just gotta read what they do, then use them for what you need, if you do.

If you wonder what the Math operations do, just google Sine, Cosine, Tangent, Square root etc.
(02-06-2015, 05:49 PM)Mudbill Wrote: [ -> ]If you wonder what the Math operations do, just google Sine, Cosine, Tangent, Square root etc.

Uh, what is the function of the Sine, Cosine, Tangent operations? I know a bit of Trigonometry and that they're used for angles in a right sided triangle, but what is their purpose here?
I haven't gone far enough myself to really see their practical use in the Amnesia world, but it surely only takes some imagination. If you're making a puzzle that relies on entities being located in relative positions to each other, perhaps these can come in handy. They just calculate the operation out of the values given. Math isn't exactly my fetish, so I don't see myself using these much. If I do come across a situation where it would be useful, perhaps I'll look into it.
Say for example you had a spooooky statue that turned to face the player, you might want to know what angle it needs to turn to. The x and z co-ords of the player and the x and z co-ords of the statue make up the adjacent and opposite sides of a right angled triangle. You could then use trig to work out the angle that the statue should be at.

Or maybe you want to know when the player is within a certain range of angles, e.g., in the statue's line of sight.

That sort of thing.

(You could also use square root and good old Pythagoras to work out the distance.)
Pages: 1 2 3