PDA

View Full Version : my hammer broke


excaliber7388
05-15-2006, 12:17 AM
I used the hammer from the scripts in the Graal folder (made by stefan)
Modified it a bit (slightly) and reformatted it. It used to work, now it doesn't. The RC and I cannot find any problems in it, any help?

//#CLIENTSIDE
if (playerenters || created) {
hideimg 1;
this.step = 0;
timeout = 0;

}
if (weaponfired && this.step<=0) {
hideimg 1;
hidesword 0.5;
freezeplayer 0.5;

timeout = 0.05;
this.step = 0;
}
if (timeout)
{
this.step++;
if (this.step<10)
{
if (this.step<3)
{
if (playerdir==0)
{
playersprite = 11;
}
else if (playerdir==2)
{
playersprite = 6;
}
else
{
playersprite = 9;
}
}
else
{
if (playerdir==0)
{
playersprite = 10;
}
else if (playerdir==2)
{
playersprite = 11;
}
else
{
playersprite = 11;
}
}
if (this.step==6)
{
set teststake;
set testhurt;
}
if (playerdir==0)
{
showimg 1,wham0.gif,playerx-0.75,playery-1.7;
}
if (playerdir==1)
{
showimg 1,wham1.gif,playerx-1.7,playery-0.2;
}
if (playerdir==2)
{
showimg 1,wham2.gif,playerx+0.6,playery-0.4;
}
if (playerdir==3)
{
showimg 1,wham3.gif,playerx+1.5,playery-0.2;
}
timeout = 0.05;
}
else
{
playersprite = 0;
hideimg 1;
this.step = 0;
}
}
if (teststake)
{
unset teststake;
putx = playerx + 0.5;
puty = playery + 2;
if (playerdir==0)
{
puty -= 3;
}
if (playerdir==1)
{
putx -= 2;
puty -= 0.5;
}
if (playerdir==2)
{
putx += 0.5;
puty += 1;
}
if (playerdir==3)
{
putx += 2;
puty -= 0.5;
}
putx = int(putx);
puty = int(puty);
set isstake;
for (this.i=0; this.i<2; this.i++)
{
for (this.j=0; this.j<2; this.j++)
{
b = board[putx+i+64*(puty+this.j)];
bx = b % 16;
by = int(b / 16);
if (!(bx==10+thisi && by==20+thisj) && !(bx==4+thisi && by==103+thisj))
{
unset isstake;
}
}
}
if (isstake)
{
unset isstake;
board[putx+64*puty] = 10+112*16;
board[putx+1+64*puty] = 11+112*16;
board[putx+64*(puty+1)] = 10+113*16;
board[putx+1+64*(puty+1)] = 11+113*16;
updateboard putx,puty,2,2;
play axe.wav;
}
else
{
play arrowon.wav;
}
}
if (testhurt)
{
unset testhurt;
testx = playerx+1.5;
testy = playery+2;
if (playerdir==0)
{
testy-=2;
}
if (playerdir==1)
{
testx-=2;
}
if (playerdir==2)
{
testy+=2;
}
if (playerdir==3)
{
testx+=2;
}
for (this.i=0; this.i<compuscount; this.i++)
{
if (abs(testx-(compus[i].x+1))<=1 && abs(testy-(compus[i].y+1))<=1.5 && compus[i].mode!=3)
{
hitcompu i,3,testx,testy;
}
}
for (i=1; i<playerscount; i++)
{
if (abs(testx-(players[i].x+1.5))<=1 && abs(testy-(players[i].y+2))<=1.5)
{
hitplayer i,2,testx,testy;
putleaps 2,testx-1,testy-1;
setplayerprop #c,Ha ha!;
}
}
}

Angel_Light
05-15-2006, 02:16 AM
eww gs1. :\ I dont see nothing wrong either

excaliber7388
05-15-2006, 02:44 AM
I know, me either. Maybe I'll convert it to GS2
(btw, gs1 ain't so bad ;) )

Bl0nkt
05-15-2006, 04:07 AM
GS1 is good for making things look more complicated, thus making you seem smart. GS2 is more efficient though.

excaliber7388
05-15-2006, 08:24 PM
....So by this, I assume I should just translate it to GS2, and that should work? That sometimes happenes x_X

Loriel
05-15-2006, 08:28 PM
playersprite = 11;
Are you kidding me.

The setting of non-client. flags is dodgy at best.

excaliber7388
05-17-2006, 08:10 PM
I thought that setting lpayersprite to 11 would litterally set the player's current sprite to 11. This NPC was obviouslydone without a Gani, and I could add one if this is the only problem.

ZeLpH_MyStiK
05-17-2006, 10:53 PM
I thought that setting lpayersprite to 11 would litterally set the player's current sprite to 11. This NPC was obviouslydone without a Gani, and I could add one if this is the only problem.
The problem is that you're trying to fix a salvaged script made years and years ago.

napo_p2p
05-18-2006, 01:48 AM
Are you kidding me.

The setting of non-client. flags is dodgy at best.

But that is like setting player.sprite, is it not?

(NOTE: I am not advocating the use of player.sprite, but I am just pointing out that there are 'non-client. flags' that are OK to set.)

Loriel
05-18-2006, 02:04 AM
But that is like setting player.sprite, is it not?

(NOTE: I am not advocating the use of player.sprite, but I am just pointing out that there are 'non-client. flags' that are OK to set.)
Uh, probably. It is doubly deprecated, then.

excaliber7388
05-18-2006, 03:59 AM
I guess the best thing to do would make a gani for this, take out the playersprite, and make it Gs2. Yay

excaliber7388
05-28-2006, 11:00 PM
Okay, Now in GS2, but It still doesn't work. I don't understand how it's testing for a stake. I used the old script, which worked before for checking for stakes, but it doesn't seem to be working :frown:

//#CLIENTSIDE
function onWeaponfired()
{
setani dr-hammer,;
this.putx = playerx+.5+vecx(playerdir)*2;
this.puty = playery+.75+vecy(playerdir)*2;
for (this.i=0; this.i<2; this.i++)
{
for (this.j=0; this.j<2; this.j++)
{
b = board[this.putx+i+64*(this.puty+this.j)];
bx = b % 16;
by = int(b / 16);
if (!(bx==10+this.i && by==20+this.j) && !(bx==4+this.i && by==103+this.j))
{
this.isstake=0;
}
else
{
this.isstake=1;
}
}
}
if (this.isstake==1)
{
this.isstake=0;
board[putx+64*puty] = 10+112*16;
board[putx+1+64*puty] = 11+112*16;
board[putx+64*(puty+1)] = 10+113*16;
board[putx+1+64*(puty+1)] = 11+113*16;
updateboard putx,puty,2,2;
play("axe.wav");
}
else
{
play("arrowon.wav");
}
}

Loriel
05-28-2006, 11:10 PM
Consider using setAni() instead of setani.

excaliber7388
05-28-2006, 11:31 PM
It makes no difference in the script for detecting stakes, but yeah.

xXziroXx
05-29-2006, 04:53 PM
The problem is that you're trying to fix a salvaged script made years and years ago.


Obey that, make a new hammer from scratch. Its S-I-M-P-L-E. No point intrying to fix a script made centuries ago.

ApothiX
05-29-2006, 05:41 PM
It makes no difference in the script for detecting stakes, but yeah.
I think the new engine does have problems parsing when there is just an empty parameter sometimes. (Atleast it used to, it may be fixed now, who knows)

You should be using setAni("ganiname", NULL), regardless, because you're using gscript2.

Also, considering you are now using gscript2, this post should be moved.

adam
07-14-2006, 07:05 AM
Wouldn't a stake npc and some triggers be better?

If you don't understand how the old script detects stake's. ... practice.
uh.. if i find the example of how to figure it out, I'll post it later.

excaliber7388
07-14-2006, 07:08 AM
well, this is an old thread :P
But anyway, I plan to use the trigger idea, it's nicer, and I can do it locally, so only plaers with the hammer wll be able to get through certain areas