View Single Post
  #13  
Old 01-06-2014, 12:47 PM
i8bit i8bit is offline
Registered User
Join Date: Jul 2013
Posts: 146
i8bit is an unknown quantity at this point
So I took what you said, but modified it a bit

PHP Code:
//#CLIENTSIDE
function onCreated() { 
  
setImg("block.png"); 
  
onTimeout();  
 
scheduleEvent("onDestroy"1);


function 
onTimeout() { 
  if (
player.x in |this.xthis.2| && player.y in |this.ythis.2|) { 
    
triggerServer("weapon""HealthSystem""hitByBlock");
  }
  
  
setTimer(.05); 
}  

function 
onDestroy(){
 
destroy()

Then in the weapon- "HealthSystem"
PHP Code:
function onActionServerSide(){
 if (
params[0] == "hitByBlock"){
  [
PHP]player.clientr.hp -= //whatever amount
  
}
 } 
[/PHP]

I haven't had a chance to test this but I don't see why it wouldn't work

SO my next question is...
How would I check local NPCs (Baddies) to trigger their "Hurt" function with that block too?

I want my "damage block" to not only effect players but NPCs also.
Reply With Quote