Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   I need some help.... (https://forums.graalonline.com/forums/showthread.php?t=25020)

reywas86 03-04-2002 05:09 AM

I need some help....
 
I need someone to please tell me how to make a pong type game for graal. I don't know where to start on it....I want it to keep score and when points=10 to declare the winner.....Can someone please help me, I don't know where to start, I'm lost :(

screen_name 03-04-2002 05:20 AM

:P

start with learning how to script

Slaktmaster 03-04-2002 05:24 AM

1 Attachment(s)
Hi.

It's not done yet, as you might notice.

reywas86 03-04-2002 05:58 AM

:P I didn't ask you to tell me I need more help scripting.

WHIPENIE4 03-04-2002 06:32 AM

..... start by learning the basics... if (playerenters)message Hello;
for example... just learn to do those simple things first then slowly advance... look at scripts on this forum and try finding out what they mean.. look at the npcprogramming.doc in your graal folder... it helps a bit.

reywas86 03-04-2002 10:33 PM

lol, I know how to script. I'm just lost on this one!

screen_name 03-04-2002 10:41 PM

then u shouldn't be trying something like this yet

Saga2001 03-05-2002 12:03 AM

Well I won't go on the assumption that you are not a l33t script0r, so instead I will tell you what I did, your math kind of needs to be strong to do this, and I wish I had a scanner so I could upload me notes, I'll try to overview.
If you think about it, on pong, you have 360 degrees, right? Well you can just cut it in half, to 180 degrees and two modes for x and y, so xmode = (0 || 1); ymode = (0 || 1); and each mode has 180 degrees. So like this, you can, using triginometry (sp?) figure out the direction of any object:
NPC Code:

xincrement = (cos(angle/57.3)*speed)-cos(angle/57.3);
yincrement = (sin(angle/57.3)*speed)-sin(angle/57.3);

Because remember circles are also 360 degrees...
where speed it the amount of space you want it to move each increment.


Than to move the actual object (assuming ox, oy is the object's x and y) you could simply do this:
NPC Code:

if (xmode == 0) ox+=abs(xincrement);
else ox-=abs(xincrement);
if (ymode == 0) oy+=abs(yincrement);
else oy-=abs(yincrement);



Than assuming that mx and my is the max x and y, and lx and ly is the least x and y, we can reverse the mode on hits.
NPC Code:

if (ox>=mx) this.xmode=0;
if (ox<=lx) this.xmode=1;
if (oy>=my) this.ymode=0;
if (oy<=ly) this.ymode=1;


Hope that helps.

screen_name 03-05-2002 12:21 AM

Quote:

Originally posted by Saga2001
Well I won't go on the assumption that you are not a l33t script0r, so instead I will tell you what I did, your math kind of needs to be strong to do this, and I wish I had a scanner so I could upload me notes, I'll try to overview.
If you think about it, on pong, you have 360 degrees, right? Well you can just cut it in half, to 180 degrees and two modes for x and y, so xmode = (0 || 1); ymode = (0 || 1); and each mode has 180 degrees. So like this, you can, using triginometry (sp?) figure out the direction of any object:
NPC Code:

xincrement = (cos(angle/57.3)*speed)-cos(angle/57.3);
yincrement = (sin(angle/57.3)*speed)-sin(angle/57.3);

Because remember circles are also 360 degrees...
where speed it the amount of space you want it to move each increment.


Than to move the actual object (assuming ox, oy is the object's x and y) you could simply do this:
NPC Code:

if (xmode == 0) ox+=abs(xincrement);
else ox-=abs(xincrement);
if (ymode == 0) oy+=abs(yincrement);
else oy-=abs(yincrement);



Than assuming that mx and my is the max x and y, and lx and ly is the least x and y, we can reverse the mode on hits.
NPC Code:

if (ox>=mx) this.xmode=0;
if (ox<=lx) this.xmode=1;
if (oy>=my) this.ymode=0;
if (oy<=ly) this.ymode=1;


Hope that helps.

are you talking to me??

reywas86 03-05-2002 03:19 AM

yes thank you, it helped alot!:D

Saga2001 03-05-2002 09:25 AM

Quote:

Originally posted by screen_name


are you talking to me??

Nope, I was talking to reywas86.

screen_name 03-05-2002 09:43 AM

okay, i thought you thought that i wasn't smart

darkriders_p2p 03-05-2002 09:57 AM

Quote:

orignally posted by screen_name
okay, i thought you thought that i wasn't smart
I don't think your smart, lol, j/k your a genious wit 912075376 IQ

neomaximus2k 03-05-2002 02:48 PM

Quote:

Originally posted by darkriders_p2p


I don't think your smart, lol, j/k your a genious wit 912075376 IQ

Lol yay his ICQ number
[JK]

Saga2001 03-05-2002 10:44 PM

Quote:

Originally posted by Kaimetsu


Pff. If your maths is really strong, you'll use vectors instead of angles.

sush, i am getting there. ;)


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

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