Author Topic: Deleting self rather then other person  (Read 1825 times)

When I use this code.

Code: [Select]


%target = fireRaycastFromEye(%client,20,$Typemasks::playerObjectType);

if(isObject(%target))
{
%target.delete();


All that happens is I delete myself, no matter where I look. I am not sure where I am messing up.

To be honest, this looks like really shady code. I personally don't want to help with it.

To be honest, this looks like really shady code. I personally don't want to help with it.
If that's the case, he'll never get it released.

Does it delete you if you are looking at another player?

Find the source code of "fireRaycastFromEye" and it may be possible to help.

What are you trying to do?

Code: [Select]


%target = fireRaycastFromEye(%client,20,$Typemasks::playerObjectType);

if(isObject(%target))
{
%target.delete();


This part was made by By Club559

Code: [Select]

function fireRaycastFromEye(%client,%trange,%typemask)
{
%cp=%client.player;
return containerRayCast(%cp.getEyePoint(),vectorAdd(%cp.getEyePoint(),vectorScale(%cp.getEyeVector(),%trange)),%typemask);
}





Also it deletes me no matter where or what I am loooking at.
« Last Edit: May 20, 2010, 06:19:57 PM by Human Reaper »

Probably hitting your own player's bounding box.

well when I used it with a brick to kill it worked fine.

well when I used it with a brick to kill it worked fine.
Yes, because it's searching for a brick, not a player. You're a player last time I checked.

Good point, but I thought it would only be the play I am looking at not like a radius. Even if I do look at a player I am deleted.

Code: [Select]
function fireRaycastFromEye(%client,%trange,%typemask)
{
%cp=%client.player;
return containerRayCast(%cp.getEyePoint(),vectorAdd(%cp.getEyePoint(),vectorScale(%cp.getEyeVector(),%trange)),%typemask, %cp);
}
That should fix it.



Right I saw that later, I meant to ask why that would work.

Also it works great thank you. I would just like to know why.


Edit:: nvm I think I got it.
« Last Edit: May 20, 2010, 07:12:01 PM by Human Reaper »

The last argument is a 'skip' field so it doesn't detect one object listed. In this case it's the player who is firing the raycast.