Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (OptimusPrime, AndrewAMD), 14,580 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
check if a player is in range #263606
04/30/09 19:22
04/30/09 19:22
Joined: Apr 2009
Posts: 18
F
FlyingRaven Offline OP
Newbie
FlyingRaven  Offline OP
Newbie
F

Joined: Apr 2009
Posts: 18

I actualy asked this before but only just now noticed I posted it on the wrong part of the bord so I am now posting it here.



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.

Re: check if a player is in range [Re: FlyingRaven] #263619
04/30/09 20:42
04/30/09 20:42
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
mmm.. looking like, now you're at the wrong part of the board smile
Also, as i remember, you got some method to solve your problem


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: check if a player is in range [Re: VeT] #263622
04/30/09 20:48
04/30/09 20:48
Joined: Apr 2009
Posts: 18
F
FlyingRaven Offline OP
Newbie
FlyingRaven  Offline OP
Newbie
F

Joined: Apr 2009
Posts: 18
yes quite....

this is a .wdl question so pleas mods put me back where I were since this question really belongs there.


and I only go partialy what I needed.

I still need to know the real x,y,z cordinates of the player from the plBiped01 becouse it seams my.x etc aren't the ones I need and if so then I have a difrent question.

Re: check if a player is in range [Re: FlyingRaven] #263632
04/30/09 22:08
04/30/09 22:08
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
brrrr...

// this is a .wdl question
why its wdl question?

If you're using c-script(files, named *.wdl), then you may write it in the "Starting with Gamestudio", or "A7 Engine", or somewhere else in C-script part

If you're using lite-c(*.c files) and you want to use *.wdl files as "The predecessors to lite-C", then you may write in the "C-Script and WDL "

It you're question is about lite-c (as i can see), and not about using *.wdl with *.c, you may write in the "Lite-C Programming", so i moved your post there


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: check if a player is in range [Re: VeT] #263665
05/01/09 10:00
05/01/09 10:00
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
why not use vec_dist?

distance = vec_dist (my.x,you.x);


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1