Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   Creative Corner (https://www.graalians.com/forums/forumdisplay.php?f=17)
-   -   Tutorial: Creating a character NPC (https://www.graalians.com/forums/showthread.php?t=5548)

Emera 04-14-2012 04:19 PM

Tutorial: Creating a character NPC
 
I've been receiving numerous messages asking how to create a character NPC in the Graal Editor or Gonstruct. It's been really hard to explain over iPhone PM's and I think it'll be easier to explain in a forum thread. I'll be showing you how to create a character NPC step-by-step in the Graal Editor and Gonstruct.

Graal Editor
Spoiler

After you've opened your editor, you'll need to click the baddies,npcs,chests radio button on the far right panel. This will bring you to the NPC menu. From there we can drag and drop NPC's from the pane to the level. We're not going to be using the "noob" looking NPC though. This is scripted in GS1, and Graal currently uses GS2. Drag the outlined NPC character to the left of the "noob" on to the level.


As soon as you've dragged the NPC, the script editor window will appear. You will need to remove everything in the text box so it's blank and copy in the code in the image. Now, after you've done that you can edit the code so the NPC will look how you would like it to look. Edit the lines that say this.<feature> so that the NPC will be wearing what you want it to wear. this.attr[1] is the hat image. The lines that say this.colors[0] for example are the sleeves, coat, belt, shoes and skin colour of your NPC. They use this format.

colors[0] = hands
colors[1] = body
colors[2] = sleeves
colors[3] = shoes
colors[4] = belt



Gonstruct
Spoiler

After you've opened Gonstruct, you'll need to click the Tools tab on the far right pane in the editor. This will bring you to the NPC's pane. From there, you'll need to click New NPC. This will create a new NPC in the level.


After that, you'll need to double click the NPC to open up the script editor. Copy the script in the image into the script editor and edit the lines so the NPC looks how you'd like it to look as you are told in the Graal Editor tutorial. Edit the lines that say this.<feature> so that the NPC will be wearing what you want it to wear. this.attr[1] is the hat image. The lines that say this.colors[0] for example are the sleeves, coat, belt, shoes and skin colour of your NPC. They use this format.

colors[0] = hands
colors[1] = body
colors[2] = sleeves
colors[3] = shoes
colors[4] = belt



NPC Code

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showCharacter();
  
  
this.body "body1.png";
  
this.head "head1.png";
  
this.shield "shield1.png":
  
this.attr[1] = "hat1.png";
  
this.colors[0] = "red";
  
this.colors[1] = "blue";
  
this.colors[2] = "green";
  
this.colors[3] = "purple";
  
this.colors[4] = "black";
  
this.ani "idle";
  
this.chat "Hello Graalians!";


That's it for the tutorial. If you have any questions to do with the tutorial or you need further information on creating NPC's, post here and I'll help you out. If you've enjoyed reading this tutorial or it's helped you out, a bit of green http://forums.graalonline.com/forums...reputation.gif is always welcome!

Cigam 04-14-2012 04:28 PM

Loved it! +Rep!

Emera 04-14-2012 04:29 PM

Thank you! Glad you liked it.

Cigam 04-14-2012 04:30 PM

Quote:

Posted by Emera (Post 95317)
Thank you! Glad you liked it.

Yes indeed. I'm 101% this helped me!

MattKan 04-14-2012 04:31 PM

Except you should never use this online as it is GS1, but okay...

Emera 04-14-2012 04:35 PM

Quote:

Posted by MattKan (Post 95324)
Except you should never use this online as it is GS1, but okay...

I mentioned that, but okay.
Quote:

Posted by Tutorial
We're not going to be using the "noob" looking NPC though. This is scripted in GS1, and Graal currently uses GS2.


callimuc 04-14-2012 04:36 PM

Quote:

Posted by MattKan (Post 95324)
Except you should never use this online as it is GS1, but okay...

For NPCs which are just idling around doing nothing special itīs ok to use GS1

Elusive 04-16-2012 02:03 PM

Good job. It will help those not in the know ;D! Any aspiring level artists/scripters need threads to come to, to answer their questions :) +rep when I can.

XENA* 04-16-2012 02:43 PM

Nice thread! :D

Dude1310 04-16-2012 10:59 PM

NPC Code

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showCharacter();
  
  
this.body "body1.png";
  
this.head "head1.png";
  
this.shield "shield1.png":
  
this.attr[1] = "hat1.png";
  
this.colors[0] = "red";
  
this.colors[1] = "blue";
  
this.colors[2] = "green";
  
this.colors[3] = "purple";
  
this.colors[4] = "black";
  
this.ani "idle";
  
this.chat "Hello Graalians!";


This code contains many errors. I do not know how to fix this in leveleditor, as of i am a new level creator. Please rewrite the code, make sure you fix all the errors, and repost it. THX(:

Twinny 04-17-2012 01:28 AM

Quote:

Posted by Dude1310 (Post 96886)
NPC Code

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
showCharacter();
  
  
this.body "body1.png";
  
this.head "head1.png";
  
this.shield "shield1.png":
  
this.attr[1] = "hat1.png";
  
this.colors[0] = "red";
  
this.colors[1] = "blue";
  
this.colors[2] = "green";
  
this.colors[3] = "purple";
  
this.colors[4] = "black";
  
this.ani "idle";
  
this.chat "Hello Graalians!";


This code contains many errors. I do not know how to fix this in leveleditor, as of i am a new level creator. Please rewrite the code, make sure you fix all the errors, and repost it. THX(:

Actually, this code is correct GS2. However, this will not run in level editor as previously stated above as level editor can only handle GS1, an archaic procedural language. In order to see the character NPC, you will need to upload this level to a Graal Server.

If you need to see the character offline, place a template character from the official Level Editor and simply modify the present values. Since this template is GS1, it will show.

Emera, I will add that you need to specify shieldpower otherwise it will not function properly.

Emera 04-17-2012 08:00 AM

Quote:

Posted by Twinny (Post 97008)
Actually, this code is correct GS2. However, this will not run in level editor as previously stated above as level editor can only handle GS1, an archaic procedural language. In order to see the character NPC, you will need to upload this level to a Graal Server.

If you need to see the character offline, place a template character from the official Level Editor and simply modify the present values. Since this template is GS1, it will show.

Emera, I will add that you need to specify shieldpower otherwise it will not function properly.

Thank you! I'll add that on later today when I've got the chance.

Revo* 04-17-2012 08:06 AM

Wish I had a computer :(

RenoDorvay 04-17-2012 08:18 AM

Awesome job :) I like it

Tricxta 04-17-2012 09:08 AM

how to count to 10 in gs1:
PHP Code:

for (this.i=0;this.i<10;this.i++){
  
message #v(this.i);
  
sleep 1;


K, I'll have my rep now thanks


All times are GMT. The time now is 02:35 PM.

Powered by vBulletin/Copyright ©2000 - 2026, vBulletin Solutions Inc.