Thread: onwall2
View Single Post
  #6  
Old 02-22-2009, 11:06 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Relevant bit:
PHP Code:
  temp.h=10;//really it's the distance to the player
      
for(temp.v=0;v<h;v++){
        
temp.tx=v*(dx/h);
        
temp.ty=v*(dy/h);
        
//        showpoly(0,{x+tx-1,y+ty-1,x+tx+1,y+ty-1,x+tx+1,y+ty+1,x+tx-1,y+ty+1});
        
showimg(0,x+tx-1,y+ty-1,"insomshotgun-icon.png");
        
//doesn't work on a GMAP:
        
if(onwall2(x+tx-1,y+ty-1,2,2)){
          if(
v<1){
            
temp.startedonwall=true;            
//this.chat="Started on wall:";
          
}else{
            
this.chat=(this.chat@" and found one at "@(x+tx-1)@","@(y+ty-1)@" ("@((x+tx-1)%64)@", "@((y+ty-1)%64)@")");
            if(
startedonwallv=-1;
            else 
v--;
            
h=0;
          }
        }else if(
v>0temp.startedonwall=false;
      }
      
      if (
v<this.r){
        
setTimer(2);
//        message("Idle 2: v<this.r");
      
}else if (startedonwall){
        
setTimer(2);
//        message("Idle 2: startedonwall");
        //hurt the player or:
        //glomp the ally happens on acquiretarget
      
}else{
        
temp.tt=(v*this.speed*0.5)+(hearts/20);
        
move tx,ty,tt,24;
        
setTimer(1+tt);
//        message("Move "@1+tt);
      

Works fine on an inside level built with the default tileset, fails on an outside level built with the newtype tiledef.
Also it should be noted the NPC in question has dontblock(); and setshape 0 by 0, just to make sure it won't block itself.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233

Last edited by Tyhm; 02-23-2009 at 12:44 AM.. Reason: oops, left the debug code in
Reply With Quote