Ok. I made a firework weapon that places those bee fireworks on the ground. I used putnpc2 to do it. Here is my code:
NPC Code:
// NPC made by Boco
if (playerenters || created) {
message Bee;
}
if (playerchats && strequals(#c,buy bee)) {
if (playerrupees>=5) {
playerrupees-=5;
toweapons Bee;
setstring client.Firework_Bee_Count,#v(strtofloat(#s(client. Firework_Bee_Count))+5);
} else {
say2 You don't have enough Gralats!;
}
}
if (weaponfired) {
setplayerprop #c,#s(client.Firework_Bee_Count);
putnpc2 playerx+vecx(playerdir)*2, playery+vecy(playerdir)*2, {
if (created) {
message Bee;
showcharacter;
dontblock;
setcharani bravo_firework_bee,;
sleep 0.95;
this.x=random(-1,1);
this.y=random(-1,1);
for (this.time=0.95;this.time<1.85;this.time+=0.1) {
if (this.time<1.2) { hitobjects 0.5,x+1.5,y+2; }
this.x+=random(-0.5,0.5);
this.y+=random(-0.5,0.5);
move this.x,this.y,0.1,1;
sleep 0.1;
}
move this.x,this.y,0.55,1;
sleep 1;
destroy;
}
};
setstring client.Firework_Bee_Count,#v(strtofloat(#s(client. Firework_Bee_Count))-1);
if (strtofloat(#s(client.Firework_Bee_Count))==0) { destroy; }
}
//#CLIENTSIDE
if (created) {
setimgpart bravo_firework_bee.gif,0,0,16,16;
}
Ok. The putnpc2 part of the code doesn't work. The script seems to halt completely at that part of the code. I know this because it won't subtract the string 'client.Firework_Bee_Count' by 1. Can anyone help me in getting this to work? Thanks.