View Single Post
  #23  
Old 01-08-2014, 04:13 PM
i8bit i8bit is offline
Registered User
Join Date: Jul 2013
Posts: 146
i8bit is an unknown quantity at this point
Allow me to clarify exactly what I'm doing.

When the player presses 'a', the player creates an NPC that I'm using as a damage block. The NPC is functional through joining a class.

Perhaps it'd be easier to explain if I did step by step what I'm doing, so I can get some better, more specific advice.

1. Player presses 'A' and creates the "damage block" NPC.
This is the code from the Weapon
PHP Code:
function onActionServerSide(){
if (
params[0] == "dmgblock"){
 
temp.npc this.level.putNPC2(player.xplayer.y"");
 
temp.npc.join("damageblock");
 }
}

//#CLIENTSIDE
function onKeyPressed(codekey){
 if (
key == "c"){
  
player.chat "Placed!";
   
triggerserver("weapon"this.name"dmgblock");
   }
  } 
I realize the placement with the x and y is off and the player will collide instantly within placing. Ignore that.

2. The NPC preforms it's function, then deletes
This is where I'm Having issues. I need the block to destroy serverside.
This is the script from the CLASS it joined

PHP Code:
function onActionServerside(){
 if (
params[0] == "destroy"){
  
destroy();
  }
  }

//#CLIENTSIDE
function onCreated(){
 
dontblock();
 
setImg("block.png");
 
onTimeOut();
 
scheduleEvent(1"onDestroy");
}


function 
onTimeOut(){
 if (
player.x in |this.xthis.2| && player.y in |this.ythis.2|) { 
 
player.chat "HIT";}
 
//Trigger Actions in the player to make him lose HP and Whatever else
 
setTimer(0.05);
}

function 
onDestroy(){
 
triggerAction("npc"this.name"destroy");

Reply With Quote