Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Is it posable to have an object following an object?

XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
01-11-2007 18:49
I wana create a board game but first i must learn some scriptings. Most of the scripting iv used/learned so far iv stole from frieebie items and moded or mixed with with other scripts.
But I dont have any (that can be freely moded) that rez an object then moves it based on the direction the "main" object is facing. Rezing on object out of an object is simple.

So 'Object A' Rezes 'Object B'. then 'Object B' follows 'Object A' with the offset of X,X,X.
If i move 'Object A' then 'Object B' stays right in step with it as if it was linked, but its not.

Nope my explination is not too confusing.


I have two freebie, non-mod, objects that do this. Ones is a Rusty Cannon, and the other is a demo of some House in a box thing.
Soen Eber
Registered User
Join date: 3 Aug 2006
Posts: 428
01-11-2007 19:55
Look at the llMoveToTarget (llMove2Target??) function for the following part. To have it face the "mother" prim there were a couple discussions earlier with code examples to look at, making use of llAngleBetween.

Also, if the rezzed object is more than a single prim, llRezAtRoot will save some headaches.
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
01-11-2007 23:07
this sounds like 'builders buddy'
is that what your looking for?
its in the script libaray
-LW
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
01-12-2007 07:49
The builders buddy is what i am looking for. just its on a larger scale then I expected.

That is one complicated script that makes my head hurt just trying to read it.
But it works!

~Thanks
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-12-2007 09:07
I think the basic pet/follower script would probably suit your purpose.
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
01-12-2007 19:22
I was going to use the pet follow script but I could not figure out how to make the 'pet' follow an object instead of the owner.
I think all I need for that is a way to detect an objects id key... from what little I understand.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-13-2007 06:13
Well since you would have rezzed Object B from Object A you can have Object A tell Object B 'Follow Me' and pass it the offset etc. Use the integer passed as part of the rez call to set a comms channel and away you go.

The other way would be to make Object B an invisible part of Object A and jsut make it visible when required.
XelNaga Gamba
Amateur Master Scripter
Join date: 12 Dec 2006
Posts: 20
01-13-2007 13:17
I plan on having replaceable parts. So Object B can be changed out with another Object B
I'll need Object B to follow A for sure.

Your overestimating my ability to understand scripting.
So... I have the script that rezzes Object B also contain the code for having it follow.
How do I pass the offset to the Object B.

"Use the integer passed as part of the rez call to set a comms channel and away you go."
Few things Im not clear on.
such as Comms Channel What is that? and how exacly do I use it?

Keep in mind i have no expriance in coding what so ever.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-13-2007 14:41
From: XelNaga Gamba
I plan on having replaceable parts. So Object B can be changed out with another Object B
I'll need Object B to follow A for sure.

Your overestimating my ability to understand scripting.
So... I have the script that rezzes Object B also contain the code for having it follow.
How do I pass the offset to the Object B.

"Use the integer passed as part of the rez call to set a comms channel and away you go."
Few things Im not clear on.
such as Comms Channel What is that? and how exacly do I use it?

Keep in mind i have no expriance in coding what so ever.


Have a quick look at this thread for an example of what I mean.

To talk you throught it.
Object A rez's Obejct B passing it the Value 9999. It also opens a listen on 9999
Obejct B as part of its on_rez checks this value and if its non zero performs a llListen on 9999
It then sends a "TALK TO ME" request on that channel.
Object A hears "TALK TO ME" and sends back a reply containing its key and the offset.
At this point You can either close the channel if its no longer needed, or keep it open if you need to send further updates.


Hope some of that is useful.