Hammer

Customizable hammer. Should be pretty obvious with the comments how to customize it, but if you have any questions just post.
[php]if (created) {
toweapons Hammer;
setstring client.hammerstrength,1; // Strength of the hammer. Can later be changed without re-adding the weapon.
setimg shiny_hammericon-#v(strtofloat(#s(client.hammerstrength))).png;
this.staketiles = {
// STA,KE,TI,LES, ,REP,LAC,ETI,LES, ,STRENGTH(1 = default),LEAPS(-1 = no leaps)
0x14A,0x14B,0x15A,0x15B, ,0x70A,0x70B,0x71A,0x71B, ,1,-1, // STAKE
0x2 ,0x3 ,0x12 ,0x13 , ,0x2A5,0x2A6,0x2B5,0x2B6, ,1,0 , // BUSH
0x200,0x201,0x210,0x211, ,0x70A,0x70B,0x71A,0x71B, ,1,3 , // SIGN
0x2AC,0x2AD,0x2BC,0x2BD, ,0x6EA,0x6EB,0x6FA,0x6FB, ,2,2 , // VASE
0x674,0x675,0x684,0x685, ,0x70A,0x70B,0x71A,0x71B, ,1,-1, // LIGHT STAKE
0x7E0,0x7E1,0x7F0,0x7F1, ,0xFE5,0xFE6,0xFF5,0xFF6, ,2,-1, // SNOW STAKE
0xB4A,0xB4B,0xB5A,0xB5B, ,0xC50,0xC51,0xC60,0xC61, ,3,-1, // VOLCANO STAKE
0x22 ,0x23 ,0x32 ,0x33 , ,0x72A,0x72B,0x73A,0x73B, ,2,2 , // LIGHT ROCK
0x3DE,0x3DF,0x3EE,0x3EF, ,0x72A,0x72B,0x73A,0x73B, ,3,2 , // DARK ROCK
};
}

if (upgradehammer) {
setstring client.hammerstrength,#p(0);
setimg shiny_hammericon-#v(strtofloat(#s(client.hammerstrength))).png;
}

if (weaponfired) {
this.hammerlevel = strtofloat(#s(client.hammerstrength));
setani shiny_hammer,shiny_hammer-#v(this.hammerlevel).png;
freezeplayer .45;

this.checkx = int(playerx+.95)+vecx(playerdir)*2;
this.checky = int(playery+1.25)+vecy(playerdir)*2;

this.stake = -1;
for (i=0;i<arraylen(this.staketiles);i++) {
if (tiles[this.checkx,this.checky] == this.staketiles[i*12]) {
this.stake = i;
break;
}
}

sleep .35;
if (this.stake >= 0 && this.hammerlevel >= this.staketiles[10+this.stake*12]) ReplaceStake();
else play lift.wav;
}

function ReplaceStake() {
for (i=0;i<4;i++) {
if (tiles[this.checkx+(i%2),this.checky+int(i/2)] != this.staketiles[this.stake12+i]) {
play lift.wav;
return;
}
}
for (i=0;i<4;i++) {
tiles[this.checkx+(i%2),this.checky+int(i/2)] = this.staketiles[5+this.stake
12+i];
}
if (this.staketiles[11+this.stake12] >= 0) putleaps this.staketiles[11+this.stake12],this.checkx,this.checky;
updateboard this.checkx,this.checky,2,2;
play sign.wav;
}[/php]
Here is the format of the tiles that are used. If you wish to add more stakes you will have to lay out the tiles like this before you get the hex code:
[attach]562[/attach]
Don’t forget to add the , , between the STAKE and REPLACE tiles in the array!
I’ve also attached the gani and images you’ll need.

UPDATE:
I’ve added a command that will allow you to update the hammer externally from another NPC. All you have to do is call this script from another NPC(perhaps a blacksmith or something). It does not calculate level automatically, you will have to provide the desired level yourself.
[php]for (i=0;i<weaponscount;i++) {
if (strequals(#w(i),Hammer)) {
callweapon i,upgradehammer,3; // UPGRADES THE HAMMER, LAST NUMBER IS DESIRED NEW LEVEL
break;
}
}[/php]

So much easier to link people to these threads then fussing with finding the code and customizing it for them. I’m sure people will whine about there being no weapon icon for the hammer, but the images tend to get cleaned out anyway.

The looks on Beholders hammer is much sexier.

Is this like the one you put on the OGCC?

And for people who do not know any better.

Hammer = Shovel, as far as scripting goes.
Same for Flute/Guitar/Drums having the same coding.

Probably, though I scripted it from scratch and haven’t even looked at that hammer.

As far as Beholder’s being better… all you gotta do is change the gani, so knock yourself out :wink:

Because I’m a nice guy, and Spoon encouraged me(he already made some icons for me, but I never preferred that angle).

Did you scribble on them with the eraser tool on purpose?

What do you mean?

I’m kidding about the eraser tool, but how did you come up with those? Looks like you used a crude extraction method to make them.

Err… copy/pasted out of the hammer graphics themselves :stuck_out_tongue:
Then just grabbed the numbers out of state.png. I figured it would be better to have it match the rest of the GUI. I didn’t really touch anything outside of just copy/pasting.

I’m not going to put that much effort into this, especially the graphics. It was mainly just a scripting thing, but I thought I’d throw in the graphics as well. If people aren’t happy with the graphics, they can fix it :slight_smile:

That’s not what I see…

I don’t know what you’re seeing :stuck_out_tongue:
The numbers and such are white, which will blend in with the background if that’s what you mean. However, this is because the icons are transparent. If they’re just saved to the computer and used, this shouldn’t be an issue.

Oh… I see. Graal has this stupid transparency thing where it will make pure white(255,255,255) and pure black(0,0,0) transparent. It’s so retarded -_-

:[ yeah

Well I fixed it :slight_smile:

Is that hexadecimal for the tiles?

I guess… uses the converter button in the editor.

there’s a converter button?

LOL

Select some tiles, then click the icon of the “rock” being cut into four pieces near the top.
And if Hex doesn’t suit your fancy.
message #v(tiles[x,y]);
to get an integer of the tile directly under the NPC.