Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Shoot to GS2? (https://forums.graalonline.com/forums/showthread.php?t=66354)

Omini 05-31-2006 07:14 AM

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.)

Warcaptain 05-31-2006 07:22 AM

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

Omini 05-31-2006 07:26 AM

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.

Warcaptain 05-31-2006 07:27 AM

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);

Omini 05-31-2006 07:42 AM

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") { }


ApothiX 05-31-2006 02:17 PM

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.

Warcaptain 05-31-2006 08:58 PM

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";

ApothiX 06-01-2006 01:33 AM

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.

Warcaptain 06-01-2006 02:34 AM

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. :)

Omini 06-01-2006 05:19 AM

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. :)


All times are GMT +2. The time now is 11:09 AM.

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