PDA

View Full Version : [USCRIPT] Box ESP


dman
24th July 2005, 04:32
Box ESP is a modified Range ESP function that does not display any thing inside a Box, with user defined dimensions. you must declare the dimensions (length and width), DimY and DimX, somewhere. I declared them globally so I could change them in game.

function DrawBoxESP(Canvas MyCanvas)
{
local Vector DiffLocation, X, Y, Z;
local int Distance;
local float PosX, PosY, StartX, StartY, BoxX, BoxY, extra;

extra = 5;
BoxX = DimX + (extra * 2);
BoxY = DimY + (extra * 2);
StartX = (MyCanvas.ClipX - BoxX) / 2;
StartY = (MyCanvas.ClipY - BoxY) / 2;

MyCanvas.SetDrawColor(230,230,0);
MyCanvas.SetPos(StartX, StartY);
MyCanvas.DrawBox(MyCanvas, BoxX, BoxY);
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY - 8);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY + BoxY);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(StartX - 5, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");
MyCanvas.SetPos(StartX + BoxX + 2, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");

for (i=0; i < MyController.GameReplicationInfo.PRIArray.Length; i++)
{
PRI = MyController.GameReplicationInfo.PRIArray[i];

DiffLocation = PRI.GetPawnLocation() - Me.Location;
Distance = int(VSize(DiffLocation) / 48);
GetAxes(Normalize(MyController.Pawn.GetViewRotatio n()),X,Y,Z);
if ( DiffLocation Dot X > 0.69999999 )
{
if ( !PRI.isDead() )
{
PosX = (MyCanvas.ClipX / 2) + ( (DiffLocation Dot Y)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);
PosY = (MyCanvas.ClipY / 2) + (-(DiffLocation Dot Z)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);

if (PRI.Team.TeamIndex != Me.PlayerReplicationInfo.Team.TeamIndex)
MyCanvas.SetDrawColor(255,0,0);
else
MyCanvas.SetDrawColor(0,255,0);

MyCanvas.Style = 1;

if (( PosX < StartX - 8 ) || ( PosX > StartX + BoxX + 2 ) || ( PosY < StartY - 8 ) || ( PosY > StartY + BoxY ))
{
MyCanvas.SetPos(PosX - 5, PosY - 8);
MyCanvas.DrawTextClipped("+ " $string(Distance));
}
else
{
MyCanvas.SetPos(PosX, StartY - 8);
MyCanvas.DrawTextClipped("v " $string(Distance));
MyCanvas.SetPos(PosX, StartY + BoxY);
MyCanvas.DrawTextClipped("^ " $string(Distance));
MyCanvas.SetPos(StartX - 5, PosY);
MyCanvas.DrawTextClipped("> " $string(Distance));
MyCanvas.SetPos(StartX + BoxX + 2, PosY);
MyCanvas.DrawTextClipped("< " $string(Distance));
}
}
}
}
}
variable extra gives extra spacing for the box.

those numbers added (positively or negatively) for position settings of the text are numbers I calculated from each text character size and appropriately placed them to match the box.

This is a little different from the one seen from DBOE (v1) source. the one on DBOE has room to expand, such as adding player name.

uniNOONE
24th July 2005, 07:59
Tnx alot,So its like old EvilHack ;)

kolbybrooks
24th July 2005, 08:21
I was just going to tutorial this heh

You got it first

Nice work, Like your coding

gil
24th July 2005, 08:36
Good old EvilHack :)


Added to the list, thanks!

deegan
24th July 2005, 10:30
cool man this is pretty nice i will enjot it

tamimego
24th July 2005, 10:34
finally someone who doesnt c & p, +rep from me

dman
25th July 2005, 06:06
finally someone who doesnt c & p, +rep from me

wow, a comment like that from tamimego. I feel special now. (wasn't it last week he called me a C&P ho? lol)

thx dude. i try my best.

btw, i just realized i did something stupid. please change to:

extra = 5;
BoxX = DimX + (extra * 2);
BoxY = DimY + (extra * 2);
StartX = (MyCanvas.ClipX - BoxX) / 2;
StartY = (MyCanvas.ClipY - BoxY) / 2;

DarkCode
25th July 2005, 08:11
Where's EvilBert when ya need him!

itwasfunny
25th July 2005, 12:00
Very nice release! Anyway is kinda old :)

Sevendust
11th November 2005, 21:47
Basicbot users:

Add to your variables:


var Pawn Me;

function DrawBoxESP(Canvas MyCanvas)
{
local Vector DiffLocation, X, Y, Z;
local int Distance;
local float PosX, PosY, StartX, StartY, BoxX, BoxY, DimX, DimY, extra;

extra = 5;
BoxX = DimX + (extra * 2);
BoxY = DimY + (extra * 2);
StartX = (MyCanvas.ClipX - BoxX) / 2;
StartY = (MyCanvas.ClipY - BoxY) / 2;

MyCanvas.SetDrawColor(230,230,0);
MyCanvas.SetPos(StartX, StartY);
MyCanvas.DrawBox(MyCanvas, BoxX, BoxY);
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY - 8);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY + BoxY);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(StartX - 5, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");
MyCanvas.SetPos(StartX + BoxX + 2, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");

for (i=0; i < MyController.GameReplicationInfo.PRIArray.Length; i++)
{
PRI = MyController.GameReplicationInfo.PRIArray[i];

DiffLocation = PRI.GetPawnLocation() - Me.Location;
Distance = int(VSize(DiffLocation) / 48);
GetAxes(Normalize(MyController.Pawn.GetViewRotatio n()),X,Y,Z);
if ( DiffLocation Dot X > 0.69999999 )
{
if ( !PRI.isDead() )
{
PosX = (MyCanvas.ClipX / 2) + ( (DiffLocation Dot Y)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);
PosY = (MyCanvas.ClipY / 2) + (-(DiffLocation Dot Z)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);

if (PRI.Team.TeamIndex != Me.PlayerReplicationInfo.Team.TeamIndex)
MyCanvas.SetDrawColor(255,0,0);
else
MyCanvas.SetDrawColor(0,255,0);

MyCanvas.Style = 1;

if (( PosX < StartX - 8 ) || ( PosX > StartX + BoxX + 2 ) || ( PosY < StartY - 8 ) || ( PosY > StartY + BoxY ))
{
MyCanvas.SetPos(PosX - 5, PosY - 8);
MyCanvas.DrawTextClipped("+ " $string(Distance));
}
else
{
MyCanvas.SetPos(PosX, StartY - 8);
MyCanvas.DrawTextClipped("v " $string(Distance));
MyCanvas.SetPos(PosX, StartY + BoxY);
MyCanvas.DrawTextClipped("^ " $string(Distance));
MyCanvas.SetPos(StartX - 5, PosY);
MyCanvas.DrawTextClipped("> " $string(Distance));
MyCanvas.SetPos(StartX + BoxX + 2, PosY);
MyCanvas.DrawTextClipped("< " $string(Distance));
}
}
}
}
}

This should compile with your Basicbot ;)

Anyway, nice release man! You should add
local float DimX, DimY;
though ;)
Good old EvilHacks... brings back memories... :)

nice release! Keep it up

S@t@nic@
15th November 2005, 17:00
finally someone who doesnt c & p, +rep from me
wow, a comment like that from tamimego. I feel special now. (wasn't it last week he called me a C&P ho? lol)


he's always saying that... anyway good job dude...
but is it a bounding box like in evilhack ? or just a fixed box ?

Sevendust
17th November 2005, 16:47
he's always saying that... anyway good job dude...
but is it a bounding box like in evilhack ? or just a fixed box ?


Code looks like a fixed box, but i could be wrong

lionheart5358
19th November 2005, 08:44
the threads a little old.. theres a better bounding box method in the griffaby source buried somewhere on this forum if anyones interested.

S@t@nic@
19th November 2005, 09:09
the threads a little old.. theres a better bounding box method in the griffaby source buried somewhere on this forum if anyones interested.

oooppppsss sorry i didn't see the date... lol

anyway no way to port mine (c++ at http://www.mpcforum.com/showthread.php?t=102642 ) to uscript?
don't know about griffaby src ... maybe better...

just to say to gil that one is not a "Good old EvilHack"... hehe

No1uKnow
19th November 2005, 09:27
just to say to gil that one is not a "Good old EvilHack"... hehe

so true ^^

nothing close :P

:tired:

anyway no way to port mine (c++ at http://www.mpcforum.com/showthread.php?t=102642 ) to uscript?


yeah it wouldnt be too hard

gil
19th November 2005, 13:27
Sounds like... :(