Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help for a beginner anyone ?

Roland Gray
Registered User
Join date: 4 Oct 2006
Posts: 163
10-25-2009 04:41
Hi, I am trying to make a target for ranged weapons (a bow in this case) which will report the owner of the colliding object (i.e the arrow). All the ways of detecting a collision I’ve tried so far report the owner of the target rather than the owner of the arrow.
Can someone point me in the right direction before I run out of coffee please !!!
_____________________
TheMoreILearnTheLessIKnow
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-25-2009 05:28
I know nothing about weapons, so I don't understand exactly what you're doing, but have you taken a look at llGetOwnerKey (http://lslwiki.net/lslwiki/wakka.php?wakka=llGetOwnerKey)? If you can get the arrow's UUID (with llDetectedKey probably), and if you're in the same sim with it, you ought to be able to get its owner easily enough.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-25-2009 10:29
CODE

default{
collision_start(integer n) {
key colliderKey = llDetectedKey(0);
list colliderOwnerKey = llGetObjectDetails(colliderKey,[OBJECT_OWNER]);
list colliderOwnerName = llGetObjectDetails(llList2Key(colliderOwnerKey, 0),[OBJECT_NAME]);
llSay(0, "I was hit by " + (string)colliderOwnerName + "'s arrow");
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Roland Gray
Registered User
Join date: 4 Oct 2006
Posts: 163
10-25-2009 12:46
Ty Jesse, perfect. Now I just need to figure out how that works.......
_____________________
TheMoreILearnTheLessIKnow
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
10-25-2009 13:37
Good to see you, Jesse!
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-25-2009 15:29
From: Nika Talaj
Good to see you, Jesse!

Hugz!

I have successfully built my emotional safety net account at SLU and now feel reasonably safe to pop back in over here now.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-25-2009 15:41
From: Roland Gray
Ty Jesse, perfect. Now I just need to figure out how that works.......

Unfortunately there is no llGetNameOfTheOwnerOfTheObjectThatCollidedWithMe function. So you have to input the various parts to make your own.

Looking at my code you could still simplify it by using llDetectedOwner(0).

http://lslwiki.net/lslwiki/wakka.php?wakka=llDetectedOwner

Using that function and llKey2Name gives us this instead:

CODE

default {
collision_start(integer n) {
llSay(0, "I was hit by " + llKey2Name(llDetectedOwner(0)) + "'s arrow");
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
10-26-2009 02:43
throw the target at the arrow?

ok very silly but it would reverse the problem :)
Roland Gray
Registered User
Join date: 4 Oct 2006
Posts: 163
10-26-2009 03:02
Ty again Jesse, now that I can understand ! Very elegant :)

That is another solution Dekka, I did nearly reach the point of a once only keyboard - monitor collision !!!
_____________________
TheMoreILearnTheLessIKnow