View Single Post
  #9  
Old 06-18-2012, 04:53 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Well this is my solution for online which still doesn't work...

Level NPC:
PHP Code:
this.join("cancarry");
function 
onCreated(){
  
this.size = {2,2};
  
setshape(1,16*this.size[0],16*this.size[1]);
}
//#CLIENTSIDE
function onCreated(){
  
this.carry "block.png";
  
this.size = {2,2};
  
settimer(.1);

Class: cancarry
PHP Code:
function onActionCarry(cmd,pl,plx,ply){
  switch(
cmd){
    case 
"Grab":
      
//this.hide();
      
this.2;
      
this.2;
      break;
    case 
"Throw":
      
//this.show();
      
this.plx+.5;
      
this.ply-1;
      
findPlayer(pl).chat "true";
      break;
  }
  
sleep(1);
  
this.chat " ";
}
//#CLIENTSIDE
function onTimeout(){
  
//this.chat = "X:" SPC this.x-3 SPC this.x+this.size[0] SPC "Y:" SPC this.y-3.5 SPC this.y+this.size[1]-.5;
  
if (player.ani == "grab" && player.x in |this.x-3,this.x+this.size[0]| && player.y in |this.y-3.5,this.y+this.size[1]-.5| && this.newplayer == null){
    
setani("carrystill",null);
    
replaceani("idle","carrystill");
    
replaceani("walk","carry");
    
player.attr[3] = this.carry;
    
triggeraction(this.x,this.y,"Carry","Grab",player.account);
    
//this.hide();
    
sleep(.5);
    
this.newplayer player.account;
  }  
  
settimer(.1);
}

function 
onKeyPressed(a,b,c){
    if (
b=="a" && player.account == this.newplayer){
      
throwcarry();
      
setani("grab",null);
      
replaceani("idle","idle");
      
replaceani("walk","walk");
      
//this.show();
      
player.attr[3] = "";
      
triggeraction(this.x,this.y,"Carry","Throw",player.account,player.x,player.y);
      
freezeplayer(.2);
      
this.newplayer null;
    }
  } 
I was going to have it change Z and X depending on the player.dir...
but I still feel there is an easier way then how I'd do it..

Even if I got it to work, serverside, it would still be pretty slow...
Doesn't want to react after hidden it seems, and I don't want to change its alpha...
Then at -2 -2 it doesn't want to react... X = 2 and Y = 2 was my best bet. :/

Also, E_Man, you can also 'fake quote' by putting QUOTE and /QUOTE with the brackets.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote