Problem with hat weapon

Look that :

[HTML]// Graal2002 NPC by Stefan Knorr
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head11.mng;
setcharprop #C0,white;
setcharprop #C1,darkblue;
setcharprop #C2,black;
setcharprop #C3,white;
setcharprop #C4,blue;
setcharprop #n,/AH;
setcharprop #2,no-shield.png;
shieldpower = 1;
message 1000G;
setcharprop #P1,hat1.png;
dir = 2;
}
if (playerchats && strequals(#c,/AH)) {
if (playerrupees>=1000) {
toweapons hats/hat1;
}
if(weaponfired) {
setplayerprop #P1,hat1.png;
setplayerprop #c,;
}

}[/HTML]
what’s wrong ?

[HTML]// Graal2002 NPC by Some Tard
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head11.mng;
setcharprop #C0,white;
setcharprop #C1,darkblue;
setcharprop #C2,black;
setcharprop #C3,white;
setcharprop #C4,blue;
setcharprop #n,/AH;
setcharprop #2,no-shield.png;
shieldpower = 1;
message 1000G;
setcharprop #P1,hat1.png;
dir = 2;
}
if (playerchats && strequals(#c,/AH)) {
if (playerrupees>=1000) {
toweapons hats/hat1;
}
}
if(weaponfired) {
setplayerprop #P1,hat1.png;
setplayerprop #c,;
}
[/HTML]
You’ve put weaponfired inside the playerchats&&strequals flag.

You also forgot to do “playerrupees-=1000;” in the playerrupees>=1000 flag.
Also toweapons adds that entire NPC as the weapon.

So I would recommend keeping it in a different NPC other than the shopkeep.
And to add a flag check “hasweapon(hats/hat1)” to make sure you can’t buy it while you already have it.

Maybe he wants to make some system where people keep gralats as a score. =P