Sign in to follow this  
Followers 0
atrX

Scripting Basics: "Self"

1 post in this topic

What is "self"?

The "self" you keep seeing in scripts refers to the entity the function is called on, let's have a look at an example:

Please login or register to see this code.

 

And how is this utilised for "level"?

I've gotten a question about what calling a function on "level" does, well, it does the exact same as it does with any other entity you call a function on:

Please login or register to see this code.

 

What is the difference between "self" and "player"?

There's actually an extremely big difference between them, "self" is used to refer to the entity a function is called on. "Player", however, is a variable defined in your script:

Please login or register to see this code.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0