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
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 06:51 AM.


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