I seem to be having a problem with my mineral mining scripts.
The NPC weapon is fine for the most part...it retrieves the player's ID and then sends it through triggeraction.
NPC Code:
//#CLIENTSIDE
// NPC made by GregoryYoshi
if (playerenters) {
setshape 1,32,32;
this.axepower = 2;
setcharprop #c,Level 1 Pickaxe;
}
if (playertouchsme) {
toweapons Pickaxe L1;
hide;
sleep 3;
show;
}
if (weaponfired) {
this.axepower = 2;
this.playerid = playerid;
freezeplayer .75;
setani jaxe,pickaxemetal.png;
triggeraction playerx+1.5+vecx(playerdir)*2,playery+1.75+vecy(pl ayerdir)*2,mining,#v(this.axepower),#v(this.player id);
showimg 210,dk_hitpointer.png,playerx+1.5+vecx(playerdir)* 2,playery+1.75+vecy(playerdir)*2;
sleep .75;
setani idle,;
hideimg 210;
}
The problem is the mineral NPC (which is a class NPC script) is not accepting the playerid parameter sent through triggeraction
NPC Code:
if (created) {
setshape 1,32,32;
this.mined = 0;
}
if (actionmining && !this.mined==100) {
this.mined = this.mined + strtofloat(#p(0));
this.hitterid = strtofloat(#p(2));
gethitter();
setcharprop #c,#v(this.mined) | #v(this.hitter);
} else
if (actionmining && this.mined==100) {
this.hitterid = strtofloat(#p(1));
gethitter();
setimg explosion.gif;
play2 bomb.wav,x-1,y-1,1;
if (hitter>0) {
with (players[hitter]) {
freezeplayer 1;
setani dk_mined,this.type*10;
if (this.type==4) {
setstring uncraftedgold,#v(strtofloat(#s(uncraftedgold))+1);
} else if (this.type==3) {
setstring uncraftedred,#v(strtofloat(#s(uncraftedred))+1);
} else if (this.type==2) {
setstring uncraftedblue,#v(strtofloat(#s(uncraftedblue))+1);
} else if (this.type==1) {
setstring uncraftedgreen,#v(strtofloat(#s(uncraftedgreen))+1 );
}
}
}
hide;
sleep 5;
this.type = int(random(1,5);
this.mined = 0;
show;
}
function gethitter() {
hitter = -1;
for (i=0; i<playerscount; i++)
if (players[i].id==this.hitterid) {
hitter = i;
break;
}
}
Neither of these are confidentail scripts, so I don't mind showing them
There's probably something wrong that I'm doing...hopefully I can get this fixed fast
