Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-31-2006, 07:14 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Shoot to GS2?

Is there any specific method that shoot is to be done in GS2? I used the same shoot and setshootparams in GS1, but I'm unsure how to do it in GS2.

This is what I have.

NPC Code:
function shoot()
{
freezeplayer(0.65);
setani millenium_cx-fire,;
client.cxclip -= 1;
this.angle = getangle(vecx(playerdir),vecy(playerdir));
this.dx = playerx+vecx(playerdir)*2;
this.dy = (playery-.5)+vecy(playerdir)*2.5;
//Setting Shoot Params
setshootparams #w,this.gunpow;
//Shooting Bullets
shoot this.dx,this.dy,playerz,this.angle+random(this.max angle*-1,this.maxangle),0,0,"millenium_bullet",;
shoot this.dx,this.dy,playerz,this.angle+random(this.max angle*-1,this.maxangle),0,0,"millenium_bullet",;
shoot this.dx,this.dy,playerz,this.angle+random(this.max angle*-1,this.maxangle),0,0,"millenium_bullet",;
shoot this.dx,this.dy,playerz,this.angle+random(this.max angle*-1,this.maxangle),0,0,"millenium_bullet",;
shoot this.dx,this.dy,playerz,this.angle+random(this.max angle*-1,this.maxangle),0,0,"millenium_bullet",;
shoot this.dx,this.dy,playerz,this.angle+random(this.max angle*-1,this.maxangle),0,0,"millenium_bullet",;
}



I'm guessing there's a problem in there because it worked fine in GS1, and it's setting the players gani animation as well as taking the bullet away but the bullets arent shooting. Any helpful advice/tips (NB: Tryial and ApothiX - read bolded part twice to make sure you understand. That means don't ***** at each other in this thread.) are appreciated.



Edit:

Oh, I found it useful removing the quotations from the gani name, heh heh heh. On another note - is there a GS2 version of shoot? If so, what is it (If someone would be so kind as to tell me.)
__________________



Reply With Quote
  #2  
Old 05-31-2006, 07:22 AM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
x-x things like
shoot whateverwhateverwhatever will not work on GS2.. because its not GS2

its, shoot(param,param,param,etc)
setshootparams(params)

Do you understand?

setani aniname,param;
is now setani("aniname","param1");

also, shoot is a reserved function so do something like
function DoShoot()

in addition.. just a side note:

use player.x not playerx (playerx is GS1) etc that way you are accessing the player in object form not GS1 form.

i strongly suggest checking out the bible/wiki for more information.. go to the GScript section and look up starters guide (or on the wiki, just look at the main Gscript page) there are links to function lists.. the (2) next to the Clientside functions is a simple dump of all the functions.. no weirdness like the Bible used to have.. I like having just a big CTL+F searchable list of functions.. if i need something to do with files then I just search the document as i would on google.. with simple keywords.. ie: file would bring up like findfile() deletefile() etc...

anyways.. good luck.. dont be afraid to post even if people are jerks because its the best way to learn.. also check out the #gscript IRC chat: irc.freenode.net/#gscript
Reply With Quote
  #3  
Old 05-31-2006, 07:26 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Well it works

So would that said script become

NPC Code:
function shoot()

{

freezeplayer(0.65);

setani millenium_cx-fire,;

client.cxclip -= 1;

this.angle = getangle(vecx(player.dir),vecy(player.dir));

this.dx = player.x+vecx(player.dir)*2;

this.dy = (player.y-.5)+vecy(player.dir)*2.5;

//Setting Shoot Params

setshootparams(#w,this.gunpow);

//Shooting Bullets

shoot(this.dx,this.dy,player.z,this.angle+random(t his.maxangle*-1,this.maxangle),"0","0","millenium_bullet");



I'm still sort of converting from GS1 to GS2, heh.
__________________



Reply With Quote
  #4  
Old 05-31-2006, 07:27 AM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
Yes, but again dont forget that its setani("aniname","param1"); not setani ani,param;

mixing them causes lack of effeciency in scripts.. things streamline much better in GS2

also.. i saw in the other thread that you were having problems with the string being a variable

maybe put (just to make sure its always an integer)

client.whatever = int(client.whatever-1);
Reply With Quote
  #5  
Old 05-31-2006, 07:42 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Ooh so its setani("millenium_cx-fire","");

I'm assuming it's also replaceani("idle","millenium_cx-idle");

Oh, and that variable string problem in the other thread was sorted. It was a scripting error I had made earlier in the script, which checked

NPC Code:
if (client.cxammo == "on") { }



instead of

NPC Code:
if (client.cx == "on") { }

__________________



Reply With Quote
  #6  
Old 05-31-2006, 02:17 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Omini
(NB: Tryial and ApothiX - read bolded part twice to make sure you understand. That means don't ***** at each other in this thread.) are appreciated.
My original post in that thread WAS helpful advice. Seems like you were the one who didn't properly read it.

Quote:
Originally Posted by Warcaptain
also.. i saw in the other thread that you were having problems with the string being a variable
maybe put (just to make sure its always an integer)
client.whatever = int(client.whatever-1);
You shouldn't have to do that unless client.whatever contains decimals that you want truncated. client.whatever--; is perfectly fine.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #7  
Old 05-31-2006, 08:58 PM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
Quote:
Originally Posted by ApothiX
My original post in that thread WAS helpful advice. Seems like you were the one who didn't properly read it.


You shouldn't have to do that unless client.whatever contains decimals that you want truncated. client.whatever--; is perfectly fine.

It would make client.whatever into - 0 if.. lets say.. somehow it got turned into clientr.whatever == "foo";
Reply With Quote
  #8  
Old 06-01-2006, 01:33 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Warcaptain
It would make client.whatever into - 0 if.. lets say.. somehow it got turned into clientr.whatever == "foo";
client.whatever = "foo";
client.whatever++;

Would probably change client.whatever to 1, anyway.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #9  
Old 06-01-2006, 02:34 AM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
Quote:
Originally Posted by ApothiX
client.whatever = "foo";
client.whatever++;

Would probably change client.whatever to 1, anyway.

I am not sure about that.. but doing int() makes sure that it will not happen.
Reply With Quote
  #10  
Old 06-01-2006, 05:19 AM
Omini Omini is offline
Millenium Owner
Join Date: Feb 2006
Location: N.Ireland
Posts: 293
Omini is on a distinguished road
Send a message via AIM to Omini Send a message via MSN to Omini Send a message via Yahoo to Omini
Quote:
Originally Posted by ApothiX
My original post in that thread WAS helpful advice. Seems like you were the one who didn't properly read it.
I didn't mean what I said in the original post to sound like you weren't helpful, but the posts after that by you and Tyrial were pointless.

But thanks for your help.
__________________



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 03:45 PM.


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