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 12-05-2001, 03:05 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Asteroids.

Well... I made this asteroidsish game script a while ago.
It's hardly done, but i haven't had time to work on it for a long time. So I'll just see what ya think as it is.

NPC Code:

// NPC made by Rogue Shadow -TT-*C* (TCN)
if (playerenters&&isleader) {
lives=10;
playerx=0;
playery=0;
hideplayer 10000;
disabledefmovement;
setvars();
}
function setvars(){
rocks=0;
maxshots=50;
maxrocks=15;
setarray shots,4*maxshots;
setarray ship,5;
ship[0] = (screenwidth/16)/2;
ship[1] = (screenheight/16)/2;
ship[2] = 0;
ship[3] = 0;
showship();
timeout=.05;
}
if (timeout){
if (keydown(1))ship[4]+=.314;
if (keydown(3))ship[4]-=.314;
if (keydown(5)&&!warped==1)warpship();
if (keydown(4))shoot();
move();
showship();
drawshots();
timeout=.05;
}

function showship(){
this.tx=ship[0]+sin(ship[4])*2;
this.ty=ship[1]+cos(ship[4])*2;
this.dx=(this.tx-ship[0]);
this.dy=(this.ty-ship[1]);
this.dist = (this.dx^2+this.dy^2)^0.5;
addx=(this.dx/this.dist);
addy=(this.dy/this.dist);
for (this.b=0;this.b<npcscount;this.b++){
if (testnpc(ship[0],ship[1])==this.b){
putexplosion 0,ship[0],ship[1];
gamepoints-=50;
setvars();
if (lives<=0){
set gaveover;
}else lives--;
}
}
showimg 200,icemateria.gif,ship[0],ship[1];
showimg 201,watermateria.gif,ship[0]+addx,ship[1]+addy;
}
function warpship(){
this.warped=1;
ship[0]=random(0,screenwidth/16);
ship[1]=random(0,screenheight/16);
ship[2]=0;
ship[3]=0;
}
function move(){
if (keydown(0)){
if (!warped==0)warped=0;
ship[2]+=addx*.1;
ship[3]+=addy*.1;
}
ship[0]+=ship[2];
ship[1]+=ship[3];
if (ship[0]<0)ship[0]=screenwidth/16;
if (ship[0]>screenwidth/16)ship[0]=0;
if (ship[1]<0)ship[1]=screenheight/16;
if (ship[1]>screenheight/16)ship[1]=0;
}

function shoot(){
shots[bllt]=ship[0]+addx;
shots[bllt+1]=ship[1]+addy;
shots[bllt+2]=addx;
shots[bllt+3]=addy;
if (bllt<maxshots*4){bllt+=4}else{ bllt=0;}
}

function drawshots(){
for (this.i=0;this.i<maxshots*4;this.i+=4){
showimg this.i,kstar.gif,shots[this.i],shots[this.i+1];
shots[this.i]+=shots[this.i+2];
shots[this.i+1]+=shots[this.i+3];
if (shots[this.i]<0)shots[this.i]=screenwidth/16;
if (shots[this.i]>screenwidth/16)shots[this.i]=0;
if (shots[this.i+1]<0)shots[this.i+1]=screenheight/16;
if (shots[this.i+1]>screenheight/16)shots[this.i+1]=0;
for (this.b=0;this.b<npcscount;this.b++){
if (testnpc(shots[this.i],shots[this.i+1])==this.b){
putexplosion 0,shots[this.i]-.5,shots[this.i+1]-.5;
hideimg this.i;
}
}
}
}



If this is totally confusing to you. aw well.
If this looks too easy. aw well.
Fact is I scripted this a while ago and If I put some real work into it I could do it a lot better im sure.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #2  
Old 12-05-2001, 05:33 AM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
very nice, i like it
Reply With Quote
  #3  
Old 12-05-2001, 05:35 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
*cough* i think this is from http://zorgonline.cjb.net *cough*
*cough* could be wrong though *cough*
Reply With Quote
  #4  
Old 12-05-2001, 08:14 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by nyghtGT
*cough* i think this is from http://zorgonline.cjb.net *cough*
*cough* could be wrong though *cough*

I assure you that you are totally wrong.
But I'll go check it out and see if I find it... if I do... I know how it got there. (posted this script somewhere a few days ago).
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #5  
Old 12-05-2001, 01:34 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
sorry about my accusation i have just seen an asteroid script similar to that, that i found on a graal site but yours is far different from it ... yours is very neat though ...
Reply With Quote
  #6  
Old 12-05-2001, 01:36 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Yah it's ok.
Just remember. I don't post stuff that isn't mine
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #7  
Old 12-05-2001, 02:38 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
:-)

yeah i always have known rogue to own at arrays.
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #8  
Old 12-05-2001, 10:05 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
And they used to say Arrays aren't useful for hardly anything
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #9  
Old 12-05-2001, 11:41 PM
btedji btedji is offline
bryan986
btedji's Avatar
Join Date: Apr 2001
Location: Force 10
Posts: 1,153
btedji is on a distinguished road
Send a message via ICQ to btedji Send a message via AIM to btedji Send a message via Yahoo to btedji
just because zorg has it doesnt mean they made it
Reply With Quote
  #10  
Old 12-06-2001, 12:00 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
zorg doesn't have it.

they do have a space-ship though

it's nothing like mine but it is really cool.

it says delphi inc made it.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #11  
Old 01-30-2002, 04:21 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
la la la la la la la!

hey hey ! woo



I like my Asteroids script it's just not working perfectly
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #12  
Old 01-31-2002, 08:18 AM
Gohan43331 Gohan43331 is offline
Registered User
Join Date: Jan 2002
Posts: 87
Gohan43331 is on a distinguished road
Send a message via AIM to Gohan43331
one thing i noticed:
NPC Code:
if (keydown(5)&&!warped==1)warpship();


i've had problems before with !(var)==(var)... :P so i just use (var)!=(var)
Reply With Quote
  #13  
Old 01-31-2002, 11:59 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
hmm... well it doesn't hurt it. haha
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #14  
Old 02-01-2002, 04:23 AM
entravial entravial is offline
Registered User
entravial's Avatar
Join Date: Mar 2001
Posts: 825
entravial is on a distinguished road
Send a message via ICQ to entravial Send a message via AIM to entravial Send a message via Yahoo to entravial
~AlphaFlame~

I'd say it's about average-nice scripting... at least it isn't 9kb like mine... x.x;

*trots off with an axe*
__________________


If the post says ~AlphaFlame~, that's who's posting. If not, it's Entravial (owner)
Reply With Quote
  #15  
Old 02-01-2002, 07:04 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
Quote:
Originally posted by adam
And they used to say Arrays aren't useful for hardly anything
They did? LOL.
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
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 05:20 AM.


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