View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:57 am



Reply to topic  [ 10 posts ] 
 teleportation = ? 
Author Message
User avatar

Joined: Mon Apr 05, 2010 8:04 am
Posts: 149
Location: Under your bed
Reply with quote
Post teleportation = ?
Lately I've been seeing lots of "just teleport an actor underground and pin it" type stuff, I understand how I'd pin it, but how would I go about teleporting it?


Sun Oct 24, 2010 10:09 pm
Profile YIM
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: teleportation = ?
To "teleport" something, simply change its position variable (Pos) to the desired position.


Sun Oct 24, 2010 10:11 pm
Profile
User avatar

Joined: Mon Apr 05, 2010 8:04 am
Posts: 149
Location: Under your bed
Reply with quote
Post Re: teleportation = ?
so would it be like

Code:
function Create(self)
   if parent.MovableObject:IsActor then
      Set pos.Y(123456)
   end
end


Sun Oct 24, 2010 10:13 pm
Profile YIM
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: teleportation = ?
What is Set? And remember, capitalization matters.


Sun Oct 24, 2010 10:17 pm
Profile
User avatar

Joined: Mon Apr 05, 2010 8:04 am
Posts: 149
Location: Under your bed
Reply with quote
Post Re: teleportation = ?
oops I was thinking in ini. so it would be Pos.Y(123)... right?


Sun Oct 24, 2010 10:19 pm
Profile YIM
User avatar

Joined: Tue Dec 12, 2006 3:10 pm
Posts: 495
Location: Uncertain quantum state
Reply with quote
Post Re: teleportation = ?
http://www.lua.org/manual/5.1/
http://forums.datarealms.com/viewtopic.php?f=1&t=16824



Read them.


Sun Oct 24, 2010 10:25 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: teleportation = ?
It would be "pointer.Pos = Vector(<x value>,<y value>)".

It's a vector. Not a single number.


Sun Oct 24, 2010 10:30 pm
Profile
User avatar

Joined: Tue Dec 12, 2006 3:10 pm
Posts: 495
Location: Uncertain quantum state
Reply with quote
Post Re: teleportation = ?
Furthermore, it's a value, and not a function like you are calling it with the brackets. Read the guides. Cricket made one too.


Sun Oct 24, 2010 10:31 pm
Profile
User avatar

Joined: Mon Apr 05, 2010 8:04 am
Posts: 149
Location: Under your bed
Reply with quote
Post Re: teleportation = ?
I'm already basing it off of stuff I've learned from what you've posted. I guess there are just some things I'm not getting


Sun Oct 24, 2010 10:34 pm
Profile YIM
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: teleportation = ?
Position is a property. In most scripts, "self" is a pointer to the object that the script is attached to. To call properties on objects, you do the following:
Code:
pointer.property

To change properties:
Code:
pointer.property = newValue


So,
Code:
self.Pos = Vector(0,0)


Sun Oct 24, 2010 10:39 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 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.057s | 15 Queries | GZIP : Off ]