Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   PlayerTouchingMe? (https://forums.graalonline.com/forums/showthread.php?t=48235)

FreezeBurnX 09-25-2003 05:33 PM

PlayerTouchingMe?
 
Hello! I need a little help with this.
It should be like...
NPC Code:

if(created){
dontblock;
drawaslight;
setimgpart greek.gif,32,0,32,32;
}
if (playertouchsme) {
setcoloreffect 1,1,1,.3;
setimgpart greek.gif,32,0,32,32;
x+=2;
}
but then when you stop touching it should go like...
setcoloreffect 1,1,1,1;
setimgpart greek.gif,0,0,96,32;
x-=2;


Nappa Helped me and it turned too:
NPC Code:

//NPC made by FreezeBurnX
//Edited by Nappa
//#CLIENTSIDE
if(created){
dontblock;
drawaslight;
setimgpart greek.gif,32,0,32,32;
}
if(playertouchsme){
setcoloreffect 1,1,1,.3;
timeout=.5;
}

if(timeout){
if(playerx!=x){
setcoloreffect 1,1,1,1;
timeout=.5;
}
}


But I want that if you are touching/under it still will
NPC Code:

setcoloreffect 1,1,1,.3;


But it return too
NPC Code:

setcoloreffect 1,1,1,1;


With the timeout :(

TribulationStaff 09-25-2003 05:44 PM

instead of playerx!=x I would use a distance checker.

In case you don't know:
distance=sqrt((change in x)^2+(change in y)^2);

I would make sure to deal with the change in coordinates from the center of the image and the center of the player.

FreezeBurnX 09-25-2003 05:51 PM

Quote:

Originally posted by TribulationStaff
instead of playerx!=x I would use a distance checker.

In case you don't know:
distance=sqrt((change in x)^2+(change in y)^2);

I would make sure to deal with the change in coordinates from the center of the image and the center of the player.

But playerx!=x is inside of a flag and distance=sqrt((change in x)^2+(change in y)^2); is suppose to be beetween {} since you put a ";" at the final, right? It accused an error.

Kaimetsu 09-25-2003 05:58 PM

Quote:

Originally posted by TribulationStaff
instead of playerx!=x I would use a distance checker.
I disagree. Would be simpler and more accurate to use extent collision detection.

Kadar 09-26-2003 06:51 AM

isnt the exact playerx and playery near the left hand corner of the players head?

TribulationStaff 09-26-2003 07:08 AM

Quote:

I disagree. Would be simpler and more accurate to use extent collision detection.
YOu mean a couple in()'s? But that would make it rectangular.

Kaimetsu 09-26-2003 07:51 AM

Quote:

Originally posted by TribulationStaff
that would make it rectangular.
Yes. NPCs are rectangular.

GoZelda 09-26-2003 10:14 PM

1 Attachment(s)
But, if it would be a rectangle, wouldn't it be a bit weird how we look in real life? I mean, look at this:

Kaimetsu 09-27-2003 04:04 AM

Ain't gonna download a bitmap, dawg.

Goboom 09-27-2003 04:46 AM

1 Attachment(s)
Quote:

Originally posted by Kaimetsu
Ain't gonna download a bitmap, dawg.
Here is a PNG, Homie G.

Kaimetsu 09-27-2003 04:49 AM

Thanks, dope G-Dawg

What in the heck. Did you even read the thread, Cyrin? The objective from the beginning was to make an algorithm to test if the player is touching the NPC.

Goboom 09-27-2003 05:10 AM

Quote:

Originally posted by Kaimetsu
Thanks, dope G-Dawg

What in the heck. Did you even read the thread, Cyrin? The objective from the beginning was to make an algorithm to test if the player is touching the NPC.

Yup, any time K-Shizzle Dizzle Wizzle.

Dach 09-27-2003 08:19 AM

I have no idea what is in that picture, but I'm going to print it and post it on my brothers wall :megaeek:

GoZelda 09-27-2003 12:05 PM

Quote:

Originally posted by Kaimetsu
Thanks, dope G-Dawg

What in the heck. Did you even read the thread, Cyrin? The objective from the beginning was to make an algorithm to test if the player is touching the NPC.

What i ment, was, that if you use a in(), what the NPC "sees", is rectangular, but what normal people see, is in the second picture...

Oh and Kai, if you start downloading an .BMP, you can click on "Open".

Kaimetsu 09-27-2003 12:09 PM

Quote:

Originally posted by GoZelda
What i ment, was, that if you use a in(), what the NPC "sees", is rectangular, but what normal people see, is in the second picture...
You're not listening. Sight is irrelevant here; it's a matter of touch.

Quote:

Oh and Kai, if you start downloading an .BMP, you can click on "Open".
I can indeed, but it takes longer and is much less convenient. You should simply learn to use the correct file formats.

Python523 09-27-2003 07:55 PM

Quote:

Originally posted by GoZelda

What i ment, was, that if you use a in(), what the NPC "sees", is rectangular, but what normal people see, is in the second picture...

Oh and Kai, if you start downloading an .BMP, you can click on "Open".

it's. not. in().

In-Range a in <b,c>, a in |b,c>, a in <b,c|, a in |b,c|
In-Array a in {b,c,...}, {a,b,...} in {c,d,...} a in c (assuming c in this example is an array (c = {0,1,...etc})


All times are GMT +2. The time now is 02:22 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.