Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-10-2007, 09:21 PM
Arch_Angel Arch_Angel is offline
Registered User
Join Date: Apr 2007
Posts: 482
Arch_Angel is on a distinguished road
Send a message via AIM to Arch_Angel
How to learn GS2

Hey, I came here for a little help. I've learned basically all Dev positions for Graal besides NAT. I came here in hope to find people who would be willing to find me a guide/tutorial on how to start GSCRIPT. I have the basic little Level scripts down, and can read/find things in scripts and maybe do small edits. But I need to learn what is what, and how the whole scripting concept works. So If anybody could be so kind to maybe find a guide/tutorial for me to start on that would help me get the basic knowledge to start scripting GS2. Also list some things that are good to do when trying to learn (such as what to first script, what to look at, compare scripts and edit/play (yes or no), or anything else) GS2. Any help is much appreciated!
Reply With Quote
  #2  
Old 10-11-2007, 12:45 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
http://wiki.graal.net/index.php/Creation/Dev/GScript

The best source of information. Contains a few tutorials as well. You could also use http://resource.nukedstudios.com
Reply With Quote
  #3  
Old 10-11-2007, 12:48 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
use the wiki for a reference. learn scripting from viewing how other people code.

the wiki with the images looks odd- looks out of place; other than that its good
__________________
Reply With Quote
  #4  
Old 10-11-2007, 01:47 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
If you have no knowledge of programming, first read a PHP tutorial (or tutorial for some other language, PHP just seems to "tutorialize" better than other languages). Then read a GS2 tutorial. The available GS2 tutorials aren't really good for people who know nothing about programming.
__________________
Reply With Quote
  #5  
Old 10-11-2007, 02:01 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Could probably also update the old npcprogramming.doc to use GS2, it was using images and stuff.
Reply With Quote
  #6  
Old 10-11-2007, 02:05 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
why not just refer to the wiki? It's all there.
If anything, post scripts on how you'd do things. [put a classic bomb on the overworld, shoot an arrow using the shoot command]
Get the people involved with fun things then move on to the boring things such as loops/arrays so that they can make pointless systems that'll never be used.
__________________
Reply With Quote
  #7  
Old 10-11-2007, 02:13 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Hmmm will try to reorganize some stuff in the wiki, right now it's a little bit confusing to start scripting even if you already know programming. Also the function lists are not helping a lot, there should be some pages explaining the commands and also giving example scripts.
Reply With Quote
  #8  
Old 10-11-2007, 02:15 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
hmm, would be good yes

Skylds wiki does that, but not much in detail. need more free lance coders to post things
__________________
Reply With Quote
  #9  
Old 10-11-2007, 03:48 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
The code gallery is wonderful guys. ;]
__________________
Deep into the Darkness peering...
Reply With Quote
  #10  
Old 10-11-2007, 03:51 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by xAndrewx View Post
why not just refer to the wiki? It's all there.
If anything, post scripts on how you'd do things. [put a classic bomb on the overworld, shoot an arrow using the shoot command]
Get the people involved with fun things then move on to the boring things such as loops/arrays so that they can make pointless systems that'll never be used.
Right now the only thing I can think of that I don't know is how to use the shoot command and make projectiles do certain damage. That's all I can THINK of.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #11  
Old 10-11-2007, 04:14 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
PHP Code:
shootxyzanglezanglepowerganisgani params...); 
x,y and z - specify the starting position

angle - shoot angle (when looking from the top): east is 0,
north 3.14/2, west is 3.14, south 3.14*3/2)

zangle - the angle in vertical direction, 0 means the
projectile is shoot horizontal, 3.14/2 means straight to the
sun

power - the shoot power which is used to shoot the projectile;
if it's 0 then the projectile is shoot like an old arrow
(doesn't fall down, moves 20 tiles each second)

gani - the animation that is used for the projectile; the
animation can be multidirectional, the engine automatically
selects the best direction for the flying direction; the
animation can have 1 step (not animated) or 7 steps, then the
engine is automatically choosing the good animation step for
the projectile flying angle - when its raising then step 1 is
taken, when flying horizontal it is step 4, when it is short before
the impact then the engine displays step 7

When the projectile is landing or hitting an object then some actions
are triggered. With the command 'setshootparams <params>;' you can set
the parameters that the called scripts get, call 'setshootparams' before
shooting the projectile.

Client-side events:

* actionprojectile2:
is triggered when a projectile lands on the player/npc,
in params[0], params[1] etc. you have the parameters set with the
command setshootparams()

Server-side events:
* actionprojectile:
is triggered when a client has used the 'shoot' command to shoot a
projectile and the projectile is landed; in params[0] and params[1] you have
the x and y position of the impact in case you want to place an explosion
or similar things on the ground (the control-npc is automatically warped
to the level where the impact happened); params[2], params[3] etc. contain the
params set with 'setshootparams()' (before shooting the projectile)

* actionsprojectile:
is triggered when a server-side script has shot a projectile and the projectile
is landed; in params[0] and params[1] you have the x and y position of the impact
(the control-npc is automatically warped to the level where the impact
happened); params[2], params[3] etc. contain the params set with 'setshootparams()'
(before shooting the projectile)

Projectiles are easy to use and don't take a lot of bandwidth because only
the shooting of the projectile needs to be sent, the movement is calculated on
the different computers. The projectile is flying like a heavy object thrown
through the air: the horizontal movement speed keeps the same (moves
horzspeed=cos(zangle)*speed tiles all 0.05 seconds), the vertical speed is
initialized as vertspeed=sin(zangle)*speed and is decreased by 0.1 all 0.05 seconds;
then the new position (calculated all 0.05 seconds) is
newx = x + cos(angle)*horzspeed, newy = y - sin(angle)*horzspeed,
newz = z + vertspeed

Example :

PHP Code:
function onKeyPressedcodechar
{

  if ( 
char == "d") {
    
setShootParamsthis.xthis.y);
 
    
this.pangle getanglevecxplayer.dir), vecyplayer.y));
    
shootplayer.xplayer.yplayer.zthis.pangle00"idle"NULL);
  }
}

function 
onActionProjectile2lxly
{

  
putExplosion1lxly);

__________________
Deep into the Darkness peering...

Last edited by Angel_Light; 10-11-2007 at 04:27 AM..
Reply With Quote
  #12  
Old 10-11-2007, 04:51 AM
Zanzel Zanzel is offline
<insert title here>
Zanzel's Avatar
Join Date: Dec 2006
Posts: 35
Zanzel is on a distinguished road
I just learned from practice
__________________
  • N-Pulse / N-Pulse Reborn Scripter
  • Graal Kingdoms Player
  • N-Pulse Player
Reply With Quote
  #13  
Old 10-11-2007, 09:43 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Angel_Light View Post
[PHP]Example :
PHP Code:
function onKeyPressed() {
  if (
params[1] == "d") {
    
setShootParams(1this.xthis.y); //[1] being the unique ID to the projectile
    
shootplayer.xplayer.yplayer.zgetangle(vecxplayer.dir), vecyplayer.y)), 00"idle"null); //you only used the angle once, no need for the var
  
}
}

function 
onActionProjectile2(idhitxhity) {
  
//Upon adding the ID, you can do things like
  
switch(temp.id) {
    case 
1this.dropExplosion(2, {temp.hitxtemp.hity}); break;
    case 
2
      for (
temp.0temp.10temp.i++) {
        
this.dropExplosion(2, {random(temp.hitx 5temp.hitx 5random(temp.hity 5temp.hity 5});
      }
    break;
  }
}
  
//Could also make it dropExplosion(explosion type, bomb type, pos) [to support the other putexplosion]
function dropExplosion(typepos) {
  
putexplosion(temp.typetemp.pos[0], temp.pos[1]);

edit
__________________
Reply With Quote
  #14  
Old 10-11-2007, 11:07 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
And you can change "gravity" before shooting
Reply With Quote
  #15  
Old 10-11-2007, 12:35 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Stefan View Post
Hmmm will try to reorganize some stuff in the wiki, right now it's a little bit confusing to start scripting even if you already know programming. Also the function lists are not helping a lot, there should be some pages explaining the commands and also giving example scripts.
I would be doing that but I don't really know where to start. I'll probably just start helping on documenting the 3D stuff for now since it's new and not to overwhelming.
__________________
Do it with a DON!
Reply With Quote
  #16  
Old 10-11-2007, 01:41 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by Stefan View Post
And you can change "gravity" before shooting
correct. gravity = 0 means normal, gravity = -1 means objects are lighter and possess anti-gravity. gravity = 1 means objects are heavier as if they where on a bigger planet
__________________
Deep into the Darkness peering...
Reply With Quote
  #17  
Old 10-11-2007, 02:11 PM
foxboi foxboi is offline
zzzzz
foxboi's Avatar
Join Date: Aug 2005
Posts: 101
foxboi is on a distinguished road
I say we make the Graal Editor GS2 enabled. *if it isn't already.
Reply With Quote
  #18  
Old 10-11-2007, 02:36 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Angel_Light View Post
correct. gravity = 0 means normal, gravity = -1 means objects are lighter and possess anti-gravity. gravity = 1 means objects are heavier as if they where on a bigger planet
Well I don't think you have to tell Stefan that :P
Though, actually, I believe gravity is a modifier. Which means 1=normal x 1, 0=normal x 0, and 1.5=normal x 1.5, and so on. So 0 would mean no gravity, 1 would mean default, and 2 would mean gravity is twice as strong. Not sure about this though.
Reply With Quote
  #19  
Old 10-11-2007, 03:04 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by DustyPorViva View Post
Well I don't think you have to tell Stefan that :P
Though, actually, I believe gravity is a modifier. Which means 1=normal x 1, 0=normal x 0, and 1.5=normal x 1.5, and so on. So 0 would mean no gravity, 1 would mean default, and 2 would mean gravity is twice as strong. Not sure about this though.
This is correct but gravity is also global meaning it effects all projectiles.
__________________
Do it with a DON!
Reply With Quote
  #20  
Old 10-12-2007, 12:40 AM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
Quote:
Originally Posted by foxboi View Post
I say we make the Graal Editor GS2 enabled. *if it isn't already.
There's no longer even a point to respond to this statement.
__________________
Stan.
Reply With Quote
  #21  
Old 10-12-2007, 02:33 AM
pooper200000 pooper200000 is offline
The Blackswan
Join Date: May 2006
Location: Asylum
Posts: 5,060
pooper200000 will become famous soon enough
Send a message via AIM to pooper200000
Hehe. You should make a tutorial so easy even the mentally challenged and stupid can remember and learn from it. Yes I am challenging you to make something so even I could learn the basics and Stan will tell you it is arduous task. Right stan? XD
__________________
Always Watching!
Reply With Quote
  #22  
Old 10-12-2007, 04:50 AM
BonzaiXxXSRStudios BonzaiXxXSRStudios is offline
Since 2001
BonzaiXxXSRStudios's Avatar
Join Date: Jul 2007
Location: Atlanta, Georgia USA
Posts: 108
BonzaiXxXSRStudios is on a distinguished road
Send a message via MSN to BonzaiXxXSRStudios
I just learned the basics of scripting GS2 today. Though, ya just cant fit in with the rest of the crowd with just the basics..believe me i tried and yet i still felt foolish. =( Uhh, but if your still intrested, find twinny and check out his signature links for GS2 basics.
__________________


Nutos (Jasler) and Yoke (lDarkDragonl) at Bonzai and Storm Reach Studios
Reply With Quote
  #23  
Old 10-12-2007, 03:23 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
I'm one of few who's completely self taught, except for a few minor things like Skyld teaching me basics of GS2 (I was late with that, used to go with 'GS1 ftw').
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #24  
Old 10-12-2007, 05:28 PM
Arch_Angel Arch_Angel is offline
Registered User
Join Date: Apr 2007
Posts: 482
Arch_Angel is on a distinguished road
Send a message via AIM to Arch_Angel
Well thank you all for some of the links you've left and some ideas to try to learn GS2. I will try my best to start picking it up.
Reply With Quote
  #25  
Old 10-12-2007, 06:41 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by BonzaiXxXSRStudios View Post
I just learned the basics of scripting GS2 today. Though, ya just cant fit in with the rest of the crowd with just the basics..believe me i tried and yet i still felt foolish. =( Uhh, but if your still intrested, find twinny and check out his signature links for GS2 basics.
why be bothered on how other people view you? you get better from learning. my view on scripting is that everyone on Graal that scripts won't be as equally good as Novo.
__________________
Reply With Quote
  #26  
Old 10-12-2007, 11:12 PM
BonzaiXxXSRStudios BonzaiXxXSRStudios is offline
Since 2001
BonzaiXxXSRStudios's Avatar
Join Date: Jul 2007
Location: Atlanta, Georgia USA
Posts: 108
BonzaiXxXSRStudios is on a distinguished road
Send a message via MSN to BonzaiXxXSRStudios
Does anyone have a link after twinny's basic tutorial i could follow? Ive recently been looking at people's recent problems in the GS2 portion of the NPC topic trying to see if i can figure it out and i cant just quite yet. (I hate to bring this back up but it would really nice if you could somehow possibly practice on editor or something. I cant get on my playerworld because of my college gaming network restrictions, unfortantely. )

Quote:
Originally Posted by xAndrewx View Post
why be bothered on how other people view you? you get better from learning. my view on scripting is that everyone on Graal that scripts won't be as equally good as Novo.
True, everyone has their own scripting methods so noone will really be on same level, but sometimes, i wouldnt mind being on the same level as Stefan one day.
__________________


Nutos (Jasler) and Yoke (lDarkDragonl) at Bonzai and Storm Reach Studios
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:14 PM.


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