Okay, so i have made some more scripts, with the help of a friend aswell, and now i want to make a sword or gun script, and i have found some scripts on testbed to analize, and the help people gave on gultex his script in the code gallery, but im not understanding what to do, i understand the stuff with the playerdirections and with the shoot command, but i don't understand how to make the sword, or bullet hit the player.
anyways here are the scripts i made.
I'd like to know if i did anything wrong, or could've done anything better.
Bombscript that puts an explosion +-7 yards from the player:
PHP Code:
//#CLIENTSIDE
if (playerdir=0)
{
this.x=playerx+0.5;
this.y=playery-7;
}
if (playerdir=1)
{
this.x=playerx-7;
this.y=playery+0.5;
}
if (playerdir=2)
{
this.x=playerx+0.5;
this.y=playery+7;
}
if (playerdir=3)
{
this.x=playerx+7;
this.y=playery+0.5;
}
function onWeaponFired()
{
setani("lift", Null);
putexplosion2(1,2,this.x,this.y);
freezeplayer(0.5);
player.chat = "Kaboom!";
}
i added the freezeplayer because otherwise i ran into my own explosino and hurt myself.
Rotating script, i need some help on this one too, because i failed to make a loop, and i want to make it so that the player keeps rotating on his own when i fire once.
PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
for(playerdir>0)
{
playerdir+=1;
}
for (playerdir==3)
{
playerdir-=3;
}
}
Friend told me to try and make an explosion at a mouseclick, and at the location of my mouse:
PHP Code:
//#CLIENTSIDE
function onMouseDown()
{
setani("lift", Null);
putexplosion2(1,2,mousex,mousey);
player.chat = "Kaboom!";
}
Now i figured out how i could use my mouse, i decided to make a mousewarper, which was unbelievably easy.
PHP Code:
//#CLIENTSIDE
function onMouseDown()
{
player.x = mousex;
player.y = mousey;
}
decided to make something fun
PHP Code:
//#CLIENTSIDE
function onMouseDown()
{
player.x = mousex;
player.y = mousey;
setani("lift", Null);
putexplosion2(1,2,mousex+2.5,mousey+2.5);
putexplosion2(1,2,mousex-1,mousey+2.5);
putexplosion2(1,2,mousex+2.5,mousey-1);
putexplosion2(1,2,mousex-1,mousey-1);
putexplosion2(1,2,mousex+7,mousey+0.5);
putexplosion2(1,2,mousex-7,mousey+0.5);
putexplosion2(1,2,mousex+.5,mousey-7);
putexplosion2(1,2,mousex+.5,mousey+7);
player.chat = "Kaboom!";
freezeplayer(.71);
}
edit:
sorry thought i was in the GS2 forum, should've been posted there.