1 registered members (TipmyPip),
18,618
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
checking if the player is insed the correct radius
#262034
04/21/09 16:49
04/21/09 16:49
|
Joined: Apr 2009
Posts: 18
FlyingRaven
OP
Newbie
|
OP
Newbie
Joined: Apr 2009
Posts: 18
|
I have the code here and it should work. so the only reason why it isn't working is that I'm give the wrong position fore the player.
Just in case I also tryed the code in c++ in a test envirment that I made since I can't debug in lite-c becouse I have no debug window...
so if anyone can point me in the right way I thank you, and to further clarify I am using the plBiped01 that came along with lite-c.
function checkInTalkRange() { ...var talkEvents = 2; ...var radius2 = 100*100; ...var x0 = 0; ...var y0 = 0; ...x0 = my.x; ...y0 = my.y; ...var i = 0; ...while(i < talkEvents) ...{ ......var x1 = 0; ......var y1 = 0; ......x1 = npcX; ......y1 = npcY; ......var dx = 0; ......dx = x1 - x0; ......var dy = 0; ......dx = y1 - y0; ......var distance = 0; ......distance = (dx*dx) + (dy*dy); ......if(distance < radius2) ......{ .........talk(); ......} ...i += 1; ...} }
the problem is that the distance seams to get the wrong numbers and the my.x my.y should be from the plBiped01 altough they are called forth in a difrent file named talk so maybe thats the problem.
I used the ... to show the height in the code since it seams to delete my spaces when I past.
Last edited by FlyingRaven; 04/21/09 16:54.
|
|
|
Re: checking if the player is insed the correct radius
[Re: VeT]
#262070
04/21/09 19:16
04/21/09 19:16
|
Joined: Feb 2006
Posts: 385 Oldenburg,Germany
Ralph
Senior Member
|
Senior Member
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
|
It is the Aum54. But vec_dist is a good choice too.
if(vec_dist(player.x,you.x) < 40)//if the distanc between the player and the you entity is smaller then 40 quants talk
{
talk();
}
|
|
|
Re: checking if the player is insed the correct radius
[Re: VeT]
#262098
04/21/09 22:23
04/21/09 22:23
|
Joined: Apr 2009
Posts: 18
FlyingRaven
OP
Newbie
|
OP
Newbie
Joined: Apr 2009
Posts: 18
|
http://aum.conitec.net/aum54.zip Take this.. Its about c_scan cone thx
|
|
|
|