PDA

View Full Version : Shoot to GS2?


Omini
05-31-2006, 08:14 AM
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.

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, 08: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 (http://wiki.graal.net/)/wiki (http://wiki.graal.us) 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, 08:26 AM
Well it works ;)

So would that said script become

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, 08: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, 08: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

if (client.cxammo == "on") { }

instead of

if (client.cx == "on") { }

ApothiX
05-31-2006, 03:17 PM
(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.

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, 09:58 PM
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, 02:33 AM
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, 03:34 AM
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, 06:19 AM
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. :)