Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-25-2003, 05:33 PM
FreezeBurnX FreezeBurnX is offline
Registered User
FreezeBurnX's Avatar
Join Date: Jul 2003
Location: Belo Horizonte - Brasil
Posts: 296
FreezeBurnX is on a distinguished road
Send a message via AIM to FreezeBurnX Send a message via Yahoo to FreezeBurnX
Question 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
Reply With Quote
  #2  
Old 09-25-2003, 05:44 PM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to 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.
__________________


Help me keep scripting
Reply With Quote
  #3  
Old 09-25-2003, 05:51 PM
FreezeBurnX FreezeBurnX is offline
Registered User
FreezeBurnX's Avatar
Join Date: Jul 2003
Location: Belo Horizonte - Brasil
Posts: 296
FreezeBurnX is on a distinguished road
Send a message via AIM to FreezeBurnX Send a message via Yahoo to FreezeBurnX
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.
Reply With Quote
  #4  
Old 09-25-2003, 05:58 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________
Reply With Quote
  #5  
Old 09-26-2003, 06:51 AM
Kadar Kadar is offline
Registered User
Join Date: Jan 2002
Posts: 636
Kadar is on a distinguished road
isnt the exact playerx and playery near the left hand corner of the players head?
__________________
Reply With Quote
  #6  
Old 09-26-2003, 07:08 AM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to TribulationStaff
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.
__________________


Help me keep scripting
Reply With Quote
  #7  
Old 09-26-2003, 07:51 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by TribulationStaff
that would make it rectangular.
Yes. NPCs are rectangular.
__________________
Reply With Quote
  #8  
Old 09-26-2003, 10:14 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
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:
Attached Images
File Type: bmp npc.bmp (636.1 KB, 156 views)
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #9  
Old 09-27-2003, 04:04 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Ain't gonna download a bitmap, dawg.
__________________
Reply With Quote
  #10  
Old 09-27-2003, 04:46 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
Quote:
Originally posted by Kaimetsu
Ain't gonna download a bitmap, dawg.
Here is a PNG, Homie G.
Attached Thumbnails
Click image for larger version

Name:	npc.png
Views:	160
Size:	7.2 KB
ID:	25697  
__________________
Reply With Quote
  #11  
Old 09-27-2003, 04:49 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________
Reply With Quote
  #12  
Old 09-27-2003, 05:10 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
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.
__________________
Reply With Quote
  #13  
Old 09-27-2003, 08:19 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
I have no idea what is in that picture, but I'm going to print it and post it on my brothers wall
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #14  
Old 09-27-2003, 12:05 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
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".
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #15  
Old 09-27-2003, 12:09 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
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.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:23 PM.


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