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 01-20-2002, 04:46 PM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Custom NPC

Alright I need someone fairly good at scripting. I am trying to learn and I need a kinda mini tutorial here. Can someone take me through a short step by step process for scripting things like animals, baddies or anything with custom sprites. I kinda know something about u gotta make variables that deal with how many hearts and speed and such but thats about it. If someone is willing to help I would gladly appreciate it.
Reply With Quote
  #2  
Old 01-20-2002, 04:47 PM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
just for an example lets use this...
Attached Thumbnails
Click image for larger version

Name:	bogo_dog0.gif
Views:	328
Size:	9.3 KB
ID:	10552  
Reply With Quote
  #3  
Old 01-20-2002, 05:10 PM
royce royce is offline
Banned
royce's Avatar
Join Date: Sep 2001
Location: Yakitinzen, China
Posts: 2,271
royce is on a distinguished road
Send a message via AIM to royce
Quote:
Originally posted by lordhelmut
just for an example lets use this...
#1. Do you want to use showimg or use gani?
Reply With Quote
  #4  
Old 01-20-2002, 05:35 PM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
im trying to learn for free so showimg i guess
Reply With Quote
  #5  
Old 01-20-2002, 06:38 PM
Mrmicro Mrmicro is offline
Registered User
Join Date: Mar 2001
Posts: 128
Mrmicro is on a distinguished road
Send a message via AIM to Mrmicro
*setcharani GANINAME,; - Sets a NPCs Gani

*setani GANINAME,; -Sets players Gani
__________________
Reply With Quote
  #6  
Old 01-20-2002, 11:22 PM
Shard_IceFire Shard_IceFire is offline
Registered User
Shard_IceFire's Avatar
Join Date: Jun 2001
Location: Eastern Harkoonia
Posts: 861
Shard_IceFire is on a distinguished road
Mrmicro did you read his message??
Quote:
Originally posted by lordhelmut
im trying to learn for free so showimg i guess
__________________

-=Shard IceFire=-
Reply With Quote
  #7  
Old 01-20-2002, 11:59 PM
Sennema Sennema is offline
Registered User
Join Date: Nov 2001
Location: Ontario, Canada
Posts: 132
Sennema is on a distinguished road
Send a message via ICQ to Sennema Send a message via AIM to Sennema
Re: Custom NPC

Quote:
Originally posted by lordhelmut
Alright I need someone fairly good at scripting. I am trying to learn and I need a kinda mini tutorial here. Can someone take me through a short step by step process for scripting things like animals, baddies or anything with custom sprites. I kinda know something about u gotta make variables that deal with how many hearts and speed and such but thats about it. If someone is willing to help I would gladly appreciate it.
I'll help you out as much as I can. First, you'll need to either know the dimensions of the image (like the width/height of each sprite, and the starting x/y of each sprite so that they're the same size). Then, you'd need to set variables like:
this.hearts=heartcount;
this.speed=speed; (normal speed is about 0.2 or 0.3, can't remember which one).
Then, you'd need to do an if (created){} stuff, which sets the variables, and the image and junk. You'd use showimg, for showing it. Then, you'd need to use a changeimgvis index,3; (3 is the same level as the player on the board). Then you'd need changeimgpart index,x,y,width,height; (x and y are the starting x/y of the current sprite, and width and height are how many pixels to display following the starting x/y).

That's all jumbled together, I know, so if you have problems understanding it (I have a lot of trouble understanding some of the things I write sometimes), let me know, and I'll spend a little more time on this sort of thing. Or just ask someone else. Either one works.
__________________
~Draemus Windblade


Just over 90% of all messages have no point or meaning.

"In order to preserve ourselves we seek out and eliminate anything that may do use harm. In doing so, we destroy things that, though possibly hazzardous, may be important to survival. So you see, in trying to save ourselves, we ultimately bring about our own destruction"


Luminar
Reply With Quote
  #8  
Old 01-21-2002, 12:18 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
Re: Re: Custom NPC

Quote:
Originally posted by Sennema


I'll help you out as much as I can. First, you'll need to either know the dimensions of the image (like the width/height of each sprite, and the starting x/y of each sprite so that they're the same size). Then, you'd need to set variables like:
this.hearts=heartcount;
this.speed=speed; (normal speed is about 0.2 or 0.3, can't remember which one).
Then, you'd need to do an if (created){} stuff, which sets the variables, and the image and junk. You'd use showimg, for showing it. Then, you'd need to use a changeimgvis index,3; (3 is the same level as the player on the board). Then you'd need changeimgpart index,x,y,width,height; (x and y are the starting x/y of the current sprite, and width and height are how many pixels to display following the starting x/y).

That's all jumbled together, I know, so if you have problems understanding it (I have a lot of trouble understanding some of the things I write sometimes), let me know, and I'll spend a little more time on this sort of thing. Or just ask someone else. Either one works.
Thank you, the main part I need to focus on is the sprites changing part. Like how to make the sprites change or something. The script I have seen before were like dog.gif*64 bla bla and I need to figure that part out most =D
Reply With Quote
  #9  
Old 01-21-2002, 12:56 AM
Sennema Sennema is offline
Registered User
Join Date: Nov 2001
Location: Ontario, Canada
Posts: 132
Sennema is on a distinguished road
Send a message via ICQ to Sennema Send a message via AIM to Sennema
Hmm... it might work that way, but I haven't seen anything like that. Say each sprite was a square that was 50*50 pixels each.

To get the first image you'd use something like
NPC Code:

showimg 101,bogo_dog0.gif,x,y;
changeimgpart 101,0,0,50,50;
changeimgvis 101,3;



That would show the first sprite, the still dog from behind. Now, say you wanted the image of the dog sitting down while facing toward the player. You'd just do something like:

NPC Code:

if(dir=2&&stuff){
changeimgpart 101,100,250,50,50;
}



That would take the image and edit the part that's showing, giving you the dog sitting down. The actual dimensions are a little different that a 200*300 pixel image, but that's the general idea. Hope that helped.
__________________
~Draemus Windblade


Just over 90% of all messages have no point or meaning.

"In order to preserve ourselves we seek out and eliminate anything that may do use harm. In doing so, we destroy things that, though possibly hazzardous, may be important to survival. So you see, in trying to save ourselves, we ultimately bring about our own destruction"


Luminar
Reply With Quote
  #10  
Old 01-21-2002, 02:13 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
I think there is some kinda formula that people use that changes the sprites
Reply With Quote
  #11  
Old 01-21-2002, 02:35 AM
Sennema Sennema is offline
Registered User
Join Date: Nov 2001
Location: Ontario, Canada
Posts: 132
Sennema is on a distinguished road
Send a message via ICQ to Sennema Send a message via AIM to Sennema
Yeah, your probably right. But I don't know what it is... sorry.
__________________
~Draemus Windblade


Just over 90% of all messages have no point or meaning.

"In order to preserve ourselves we seek out and eliminate anything that may do use harm. In doing so, we destroy things that, though possibly hazzardous, may be important to survival. So you see, in trying to save ourselves, we ultimately bring about our own destruction"


Luminar
Reply With Quote
  #12  
Old 01-21-2002, 03:41 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
If I take it out of one of the NPC's on Babylon think you could figure it out?
Reply With Quote
  #13  
Old 01-21-2002, 03:48 AM
Sennema Sennema is offline
Registered User
Join Date: Nov 2001
Location: Ontario, Canada
Posts: 132
Sennema is on a distinguished road
Send a message via ICQ to Sennema Send a message via AIM to Sennema
Quote:
Originally posted by lordhelmut
If I take it out of one of the NPC's on Babylon think you could figure it out?
Yeah, I could probably figure it out then. All I'd need would be the images and the parts of the script that do the showing (Don't worry I won't steal or anything, I'm not into that type of thing).
__________________
~Draemus Windblade


Just over 90% of all messages have no point or meaning.

"In order to preserve ourselves we seek out and eliminate anything that may do use harm. In doing so, we destroy things that, though possibly hazzardous, may be important to survival. So you see, in trying to save ourselves, we ultimately bring about our own destruction"


Luminar
Reply With Quote
  #14  
Old 01-23-2002, 09:06 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
found it!

if (this.dir==3) setgifpart b_greenbird.png,192,this.sprite*32,64,32;

its the last part of that...
Reply With Quote
  #15  
Old 01-23-2002, 03:42 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
Quote:
Originally posted by Shard_IceFire
Mrmicro did you read his message??
mrmicro: no i was too busy picking my nose.
__________________

!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
  #16  
Old 01-23-2002, 03:46 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
actually what i suggest is a simple code that is like x=dir*50 and than it places the cursor there, its very useful, does anyone know where i could get some idea of what all the drawingheights for changeimgvis are? cause i am in the dark on that one thing.
__________________

!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
  #17  
Old 01-23-2002, 08:24 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
"npcprogramming.doc" in graal folder
Reply With Quote
  #18  
Old 01-24-2002, 05:40 AM
Sennema Sennema is offline
Registered User
Join Date: Nov 2001
Location: Ontario, Canada
Posts: 132
Sennema is on a distinguished road
Send a message via ICQ to Sennema Send a message via AIM to Sennema
Quote:
Originally posted by Saga2001
actually what i suggest is a simple code that is like x=dir*50 and than it places the cursor there, its very useful, does anyone know where i could get some idea of what all the drawingheights for changeimgvis are? cause i am in the dark on that one thing.
Yeah, you should check the npcprogramming.doc, but basically it's like this:

1- below player
2- same level as player
3- above player
4- on the screen
and I heard that 5-10 draw overtop of 4, on the screen. I never read anything about that though...
__________________
~Draemus Windblade


Just over 90% of all messages have no point or meaning.

"In order to preserve ourselves we seek out and eliminate anything that may do use harm. In doing so, we destroy things that, though possibly hazzardous, may be important to survival. So you see, in trying to save ourselves, we ultimately bring about our own destruction"


Luminar
Reply With Quote
  #19  
Old 01-25-2002, 11:10 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
what is this? I saw it in one of Xaviars scripts its like dirgo = {-1,0,1,2,3} blah blah or something. I also saw it in a tutorial by Ace
Reply With Quote
  #20  
Old 01-26-2002, 12:14 AM
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
bogo_dog.png...lol

lol

npcserver.doc in the your mom folder.
__________________

!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
  #21  
Old 01-26-2002, 01:42 AM
OutlawP2P OutlawP2P is offline
Registered User
Join Date: Dec 2001
Posts: 439
OutlawP2P is on a distinguished road
Send a message via AIM to OutlawP2P
Quote:
Originally posted by Saga2001
bogo_dog.png...lol

lol

npcserver.doc in the your mom folder.

wtfs you dont make any sense stop it!
__________________

Pandah Baerh
Reply With Quote
  #22  
Old 01-26-2002, 02:42 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
what would have to be added to a baddy to make it work for many players? I have had bad experiences with the bats and stuff on babylon and if 2 or more people come in they freeze
Reply With Quote
  #23  
Old 01-26-2002, 03:46 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
// NPC made by Lord Helmut
//widthofsprites=91
//heightofsprites=105
if(created){
this.xpos=x;
this.ypos=y;
this.hearts=20;
this.speed=1;
this.dir=0;
this.sprite=0;
setimgpart #f,91*2,0,91,105;
}
if(playersays(hi)){
timeout=.05;
}
if (timeout){
if (this.xpos>playerx){this.xpos-=this.speed};
if (this.ypos<playery){this.ypos+=this.speed};
if (this.xpos<playerx){this.xpos+=this.speed};
if (this.ypos>playery){this.ypos-=this.speed};
timeout=.05;
}

I did this so far but the character wont move =(
Reply With Quote
  #24  
Old 01-26-2002, 10:52 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
please help?
Reply With Quote
  #25  
Old 01-26-2002, 11:19 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
add this in your timeout sequence:
NPC Code:

x = this.xpos;
y = this.ypos;



and you for the setimg part try this: (based off your second post's image;
NPC Code:

setimgpart #f,91*16,0,45.5,52.5;



and when that dog gets moving, it's super fast...
NPC Code:

this.speed=.3 // or .4 which is graalian speed(about)



G'luck mate,
Gohan

Last edited by Gohan43331; 01-26-2002 at 11:31 AM..
Reply With Quote
  #26  
Old 01-26-2002, 11:20 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
Quote:
Originally posted by lordhelmut
I did this so far but the character wont move =(
Character moving? Is the character supposed to move towards the dog or vica versa?
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 07:15 PM.


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