This is for a mining system. I have a trigger going from the pickaxe weapon to the clientside portion of the rock called 'MineHit'. That trigger is received perfectly fine. The problem is that I obviously need to access the Serverside portion of the rock NPC.
I triggered onActionServerside, but for some reason it's finding it on the Clientside instead of on the Serverside. None of the triggers I send are being found anywhere but the Clientside, no matter how I tweak them.
NPC Code:
function onActionServerside() {
switch ( params[0] ) {
case "Damage Rock":
this.chat = "Hit by.."@ params[1];
break;
}
}
//#CLIENTSIDE
function onCreated() {
setShape(1,32,32);
setImg("np_miningrocks_2.png");
DrawUnderPlayer();
}
function onActionMineHit() {
temp.owner = params[0];
temp.pwr = params[1];
triggeraction(x+1.5,y+1.5,"Serverside","Damage Rock",temp.owner); // Triggers the clientside -.-
if ( temp.pwr > 0 ) ShowDamage( temp.pwr );
}
function onActionServerside() {
this.chat = "Called on the Clientside.";
}
function ShowDamage( damage ) {
this.newx = this.x + random(.4,1.1);
this.newy = this.y - .5;
this.newalpha = .99;
temp.subx = random(.05,.135);
temp.suby = random(.12,.22);
for ( i=0;i<25;i++ ) {
this.newx += temp.subx;
this.newy -= temp.suby;
this.newalpha -= .05;
showText(350,this.newx,this.newy,"Arial Narrow","bold",damage);
changeImgColors(350,.8,0,0,this.newalpha);
changeImgVis(350,1);
sleep(.05);
if ( this.newy < this.y - 3 ) {
hideImg(350);
break;
}
}
}
When the rock is hit with the pickaxe, everything works, but instead of getting the intended return 'Hit by..The_Kez' it returns 'Called on the Clientside.'