Thread: Npc to Npc
View Single Post
  #28  
Old 02-05-2011, 04:14 AM
kingcj kingcj is offline
Registered User
kingcj's Avatar
Join Date: Apr 2006
Location: TN
Posts: 114
kingcj will become famous soon enough
Send a message via MSN to kingcj
ok so why won't this work?

PHP Code:
function onCreated() {
  
this.attr[1] = eswitch//switch name 
  
this.attr[2] = edoor//door name 
  
this.attr[3] = 3//hide time
  
this.image "block.png"


function 
onExplode() { 
  if (!
this.exploded) { 
    
this.image "door.png"
    
this.exploded true;
    
setTimer(3);
    
triggerclient(this.name"boom");
  } 


function 
onTimeout() { 
  
this.exploded false;
  
this.image "block.png"
}  

//#CLIENTSIDE

function onCreated(){ 
  
this.attr[1];
  
this.attr[2];
  
this.attr[3];
  
this.level.this
}

function 
onActionClientSide(cmd) {
  if (
cmd == "boom") {
    
this.chat "ClientSide works";
    
this.level.n.wasExploded();
  } 
}

public function 
wasExploded(){ 
  
this.hide(); 
  
sleep(o);
  
this.show();

onExplode is when the bomb explodes and it has a distance that it hits.
I just can't get the clientside to function correctly. This is a switch that when it explodes it sends the wasExploded() to do something in another npc in the same level. Maybe public function needs to be server side, but a different puublic function works fine in clientside with a touch switch?
__________________
Zie

"It is not necessary to change. Survival is not mandatory." - W. Edwards Deming

Last edited by kingcj; 02-05-2011 at 04:19 AM.. Reason: Sorry for the edit but I missed the this.attr[1]
Reply With Quote