User File #30015422586248270

Upload All User Files

#30015422586248270 - Batman Beyond (N64) lua script (hitboxes and stuff)

Batman Beyond - Return of the Joker (U) [!].lua
738 downloads
Uploaded 4/4/2016 5:38 PM by TASeditor (see all 188)
  • Players hitbox is a guess, since I haven't found an address for it yet as well as for attacks and items.
  • The numbers are distance and angle.
  • The line in the circle indicates Y rotation
client.SetGameExtraPadding(0, 0, 320, 0)
Xdraw = 480;
Ydraw = 120;
Mouse = {};
ML = false;
ML_old = false;
showText = true;
MX=0;
MX_old=0;
Zoom = 1;

while true do
	
	XZSpeed = memory.readfloat(0x20867C, true);
	YAngle = memory.readfloat(0x208680, true);
	YAngleOffset = memory.readfloat(0x208684, true);
	
	XSpeedRelative = memory.readfloat(0x20863C, true);
	YSpeedRelative = memory.readfloat(0x208640, true);
	ZSpeedRelative = memory.readfloat(0x208644, true);
	
	XPosition = memory.readfloat(0x208630, true);
	YPosition = memory.readfloat(0x208634, true);
	ZPosition = memory.readfloat(0x208638, true);
	
	XPositionOld = memory.readfloat(0x208648, true);
	YPositionOld = memory.readfloat(0x20864C, true);
	ZPositionOld = memory.readfloat(0x208650, true);
	
	
	
	XZSpeedRelative = math.sqrt(XSpeedRelative^2 + ZSpeedRelative^2);
	
	
	dXPos = (XPosition - XPositionOld);
	dYPos = (YPosition - YPositionOld);
	dZPos = (ZPosition - ZPositionOld);
	
	dXZ = math.sqrt(dXPos^2 + dZPos^2);
	
	gui.drawText(0, 15, "dXZ:"..dXZ, 0xAAFFFFFF, 0xAA222222);
	gui.drawText(0, 30, "XZv:"..XZSpeed, 0xAAFFFFFF, 0xAA222222);
	gui.drawText(0, 45, "Ya:"..YAngle.." + "..YAngleOffset, 0xAAFFFFFF, 0xAA222222);
	
	gui.drawText(0, 60, "dx:"..dXPos, 0xAAFFFFFF, 0x55990000);
	gui.drawText(0, 75, "dz:"..dZPos, 0xAAFFFFFF, 0x55009900);
	gui.drawText(0, 90, "dy:"..dYPos, 0xAAFFFFFF, 0x55000099);  
    
	gui.drawText(0, 110, "Xv':"..XSpeedRelative, 0xAAFFFFFF, 0x55990000);
	gui.drawText(0, 125, "Zv':"..ZSpeedRelative, 0xAAFFFFFF, 0x55009900);
	gui.drawText(0, 140, "Yv':"..YSpeedRelative, 0xAAFFFFFF, 0x55000099);
	
	gui.drawText(0, 160, "Xp:"..XPosition, 0xAAFFFFFF, 0x55990000);
	gui.drawText(0, 175, "Zp:"..ZPosition, 0xAAFFFFFF, 0x55009900);
	gui.drawText(0, 190, "Yp:"..YPosition, 0xAAFFFFFF, 0x55000099);
						  
						  
	gui.drawLine(150, 90, 310, 90);
	gui.drawPixel(309, 89);
	gui.drawPixel(309, 91);
	gui.drawPixel(151, 89);
	gui.drawPixel(151, 91);
	gui.drawLine(230, 170, 230, 10);
	gui.drawPixel(229, 11);
	gui.drawPixel(231, 11);
	gui.drawPixel(229, 169);
	gui.drawPixel(231, 169);
	
	
	
	XCoordYAngl = math.floor(math.sin((YAngle*math.pi)/180)*75);
	YCoordYAngl = math.floor(math.cos((YAngle*math.pi)/180)*75);
	
	gui.drawLine(230, 90, 230+XCoordYAngl, 90-YCoordYAngl, 0xFF00FF00);
	gui.drawPie(180, 40, 100, 100, YAngle-90, YAngleOffset, 0xFF00FF00);
	gui.drawLine(230, 90, 230+XSpeedRelative*40*XZSpeed, 90-ZSpeedRelative*40*XZSpeed, 0xFFFF0000);
	gui.drawLine(230, 90, 230+dXPos*40, 90-dZPos*40, 0xFF0000FF);

	HBRadius = 7*Zoom;
	
	gui.drawEllipse(Xdraw-HBRadius, Ydraw-HBRadius, HBRadius*2, HBRadius*2, 0xFFFF0000);
	gui.drawPixel(Xdraw, Ydraw, 0xFFFF0000);
	gui.drawLine(Xdraw, Ydraw, Xdraw+math.sin(YAngle*math.pi/180)*HBRadius, Ydraw+math.cos(YAngle*math.pi/180)*HBRadius, 0xFFFF0000);
	gui.drawPixel(Xdraw+math.sin(YAngle*math.pi/180)*HBRadius, Ydraw+math.cos(YAngle*math.pi/180)*HBRadius, 0xFFFFFF00);
	
	for i = 0, 0xF, 1 do
	
		EType = memory.read_u8(0x1FC46F+i*0x138);
		
		if EType ~= 255
		then EX = memory.readfloat(0x1FC470+i*0x138, true);
			 EZ = memory.readfloat(0x1FC478+i*0x138, true);
			 dX = XPosition-EX;
			 dZ = ZPosition-EZ;
		     if dX*Zoom <= Xdraw - 320 
			 then EY = memory.readfloat(0x1FC474+i*0x138, true);
				  EHP = memory.read_u8(0x1FC45F+i*0x138);
				  EHitBoxRadius = memory.readfloat(0x1FC4B0+i*0x138, true)*Zoom;
				  DistanceToPlayer = memory.readfloat(0x1FC4B8+i*0x138, true);
				  VRot = memory.readfloat(0x1FC480+i*0x138, true);
			   
				  Xcircle = Xdraw-dX*Zoom-EHitBoxRadius;
				  Ycircle = Ydraw-dZ*Zoom-EHitBoxRadius;
				  Diameter =EHitBoxRadius*2;
				  
				  EPAngle = math.atan2(dX, dZ)*180/math.pi % 360;
				  
				  gui.drawEllipse(Xcircle, Ycircle, Diameter, Diameter, 0xFF000000+i*0x4973+0x36F4) 	         
				  gui.drawLine(Xdraw, Ydraw, Xdraw-dX*Zoom, Ydraw-dZ*Zoom, 0xFF000000+i*0x4973+0x36F4);
				  gui.drawLine(Xdraw-dX*Zoom, Ydraw-dZ*Zoom, Xdraw-(dX*Zoom)+math.sin(VRot*math.pi/180)*EHitBoxRadius, Ydraw-(dZ*Zoom)+math.cos(VRot*math.pi/180)*EHitBoxRadius, 0xFF000000+i*0x4973+0x36F4);
				  gui.drawPixel(Xdraw-dX*Zoom, Ydraw-dZ*Zoom, 0xFFFF5500);
				  gui.drawPixel(Xdraw-dX*Zoom+math.sin(VRot*math.pi/180)*EHitBoxRadius, Ydraw-dZ*Zoom+math.cos(VRot*math.pi/180)*EHitBoxRadius, 0xFFFF5500);
				  		
				  if showText
				  then gui.drawText(Xdraw-dX*Zoom+2, Ydraw-dZ*Zoom+2, string.format("%.2f\n%.2f", DistanceToPlayer, EPAngle), 0xFFFFFFFF, 0x00000000);
				  end;
			 else Ys = Ydraw+(320-Xdraw)/-dX*-dZ;
				  gui.drawLine(Xdraw, Ydraw, 320, Ys, 0xFF000000+i*0x4973+0x36F4)
			 end;
		
		end;
		

	end;

	for i = 0, 0xF, 1 do
		
		IType = memory.read_u8(0x206641+i*0x18);
		
		if IType ~= 0
		then IX = memory.readfloat(0x206644+i*0x18, true);
			 IY = memory.readfloat(0x206648+i*0x18, true);
			 IZ = memory.readfloat(0x20664C+i*0x18, true);
			 IYrot = memory.readfloat(0x206650+i*0x18, true);
			
			 dX = XPosition - IX;
			 dZ = ZPosition - IZ;
			 if dX*Zoom <= Xdraw - 320
			 then gui.drawLine(Xdraw,Ydraw, Xdraw-dX*Zoom, Ydraw-dZ*Zoom, 0xFF000000+i*0x484B1+0x36F4);
				  gui.drawPixel(Xdraw-dX*Zoom, Ydraw-dZ*Zoom, 0xFF00FF00);
			 else Ys = Ydraw+(320-Xdraw)/-dX*-dZ;
				  gui.drawLine(Xdraw, Ydraw, 320, Ys, 0xFF000000+i*0x4973+0x36F4);
			 end
		end
	end

	
	
	gui.drawBox(320, 229, 330, 239);
	gui.drawText(320, 227, "T");
	
	gui.drawBox(332, 229, 342, 239);
	gui.drawText(332, 227, "-");
	
	gui.drawBox(344, 229, 354, 239);
	gui.drawText(344, 227, "+");
	
	Mouse = input.getmouse();
	
	ML = Mouse.Left
	
	if Mouse.X >= 320 and Mouse.X <= 330 and Mouse.Y >= 229 and Mouse.Y <= 239 and ML
	then if ML_old ~= ML
		 then showText = not showText;
		 end;		
	end;
	
	if Mouse.X >= 332 and Mouse.X <= 342 and Mouse.Y >= 229 and Mouse.Y <= 239 and ML
	then Zoom = Zoom - 0.1;	 		
	end;
	
	if Mouse.X >= 344 and Mouse.X <= 354 and Mouse.Y >= 229 and Mouse.Y <= 239 and ML
	then Zoom = Zoom + 0.1;		
	end;
	
	ML_old = ML;
	
	
	emu.frameadvance();
end