U-Script For Noobs

America's Army Discuss, U-Script For Noobs at All Other Games listed here!! forum; Authors: Atheena & Squirrel This is a tutorial for people that want to learn how to code Uscript, also known ...


Go Back   Gamerz Needs - For All Your Gaming Needs! > All Other Games listed here!! > America's Army
Forgot Password? | Sign Up!

Notices

Advertisement
   

Reply
 
Bookmark this Thread Tools Display Modes
  #1  
Old 01-21-2007, 02:10 PM
Atheena's Avatar
Stone Axe
 
Last Online: 08-16-2008 02:11 AM
Join Date: Aug 2006
Age: 19
Posts: 33
Thanks: 8
Thanked 35 Times in 14 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0
Atheena is on a distinguished road
Points: 690.69
Bank: 0.00
Total Points: 690.69
Exclamation U-Script For Noobs

Authors: Atheena & Squirrel

This is a tutorial for people that want to learn how to code Uscript, also known as Unreal-Script, and would like to learn how to code their own bots for America's Army v2.6. This tutorial will feature example codes, and also a full bot source. You will learn how to::
Define your bots class.
State global variables.
Set up an Automatic Aim System, AutoAim.
Set up an Automatic Firing System, AutoFire.
Create an ESP, which are visuals on your screen to tell you where the enemy is, thier health, etc.
Add a wallhack to your bot
Add a displays, also known as a menu, to your bot
Define your default properties
Compile your bot!
Before you start to work on your bot, you must know what you want you bot to do. This example bot, will have the following features::
AutoAim --- This will let the bot, Automatically Aim at the enemy.
AutoFire --- This will allow the bot to Automatically Fire at the enemy.
ESP --- This tells the bot, to show you visuals on the screen, telling you where the enemy is, it's distance away from you, and the enemy's health.
Wallhack --- A wallhack is used when the enemy is close to you, you can see him/her through walls. It comes in handy, to see if then enemy is pulling a Frag Grenade or a Flash Grenade on you.
Displays --- The displays that we will be using in this bot, will show you your exact health, your exact ping, and also we will set it up so that it shows you weather your AutoAim, AutoFire, and Wallhack are enabled.
The first thing that you must do, before you start to code your bot, is to define your bots class. In the example bot, the main class is called MyInteraction. So we will define our class like this::

Code:
class MyInteraction extends Interaction;You MUST define your bots class. If you dont then the bot will not compile, and if it doesnt compile then it will serve no purpose.


Now that we know what features we want to use in our bot, we need to know how to define those features. We use Global Variabls to define variables that will be featured in our bot. The following is a list of the different types of variables, as well as the purpose that they serve::
Bools --- These are type of variables that can be turn On/Off. They are represented with a True, or a False.
Vectors --- Vector variabls, are often used to represent location. That is the soul purpose that they will server in the makeing of this bot.
Int --- The variable Integer, or Int, represents a number. A number is an integer.[list]Float --- variable used to represtent a number that is not a whole number, like 4.5
Pawn --- The Pawn variable, is used to represtent a person. Such as your target.
There are also misc. variables that you must include in your variable declarations. These include, but are not limited to::
You must state what PlayerController stands for. You MUST include this in your bot.

PlayerController gets defined like this::


Code:
var PlayerController MyController;This tells the bot, that wherever is sees the text MyController, it refers to PlayerController. You do not have to use MyController. Personally, I prefer to use PC. In the example bot that will be attached with this bot, PC, will represent PlayerController
The next variable that we will discuss is the loader variable. This depends on what your loader is called. In the example bot that will be attached to this post, the loader will be called Load. Here is how you define the loader for this bot::

Code:
var Load Load;Note that the word Load is called twice. This is how our loader is setup.
Another type of variable that you must have in your bots class is your Canvas. The Canvas variable will be assigned like so::

Code:
var Canvas MyCanvas;This line tells your bot, that anywhere it sees the text MyCanvas it means, Canvas. You DO NOT have to use MyCanvas. You can use just about anything. I reccommend using Canvas because it is hard to forget what that stands for. But if you do use Canvas, you must still define it.
You will also need to state what PlayerReplicationInfo stands for. In the example bot, we will have it represented by PRI. Here is how you would do so::

Code:
var PlayerReplicationInfo PRI;Once again, this means that anywhere in the bot that you see the text PRI, it means PlayerReplicationInfo.
Now that we have learnt all about our Variable Declarations, we will start to build our bot. So lets get started!



First we have to define our class, remember? So lets!


Code:
//----- Class Definition -----

Class MyInteraction extends Interaction; // Defines the class of our bot.Now we need to state our Global Variables


Code:
//----- Global Variables ----- now we can start declaring our global variables.

var bool AutoAim;
var bool AutoFire;
var bool ESP;
var bool Wallhack;
var bool Menu;
var vector MyLocation;
var vector ESPVec;
var vector CurrentTargetLocation;
var int I;
var PlayerController PC;
var Pawn Target;
var Playerreplicationinfo PRI;
var Load Load;
var Canvas MyCanvas;Now we can start with our main bot functions, like where we call our aim and such!


Code:

//----- Main Bot Functions -----

function PostRender(Canvas Canvas) // This is our first bot function. It is automatically called by the bot itself.
{
PC = ViewPortOwner.Actor; // We state what the text PC stands for.
MyLocation = PC.Pawn.EyePosition(); // We state what the vector MyLocation stands for
Canvas.Font = Canvas.TinyFont; // Set the default font size for our bot
if (Menu) // if menu is on, then
{
DrawMyMenu(Canvas); // draw our menu
}
If ( PC.Pawn != None && PC.Pawn.Weapon != None ) // If we are alive, and we have a gun, do the following
{
if ( AutoAim ) // If AutoAim is On then...
{
foreach PC.Pawn.Level.AllActors(Class'Pawn', Target)
{
if ( Target != None && Target.PlayerReplicationInfo.Team.TeamIndex != PC.Pawn.PlayerReplicationInfo.Team.TeamIndex && Target != PC.Pawn && !Target.bHidden && !Target.IsInState('dying')) // If There is a target, he isnt on my team, the target isnt me, the target isnt hidden, and the target isnt in the state of dying, then ...
{
if ( pc.fasttrace(target.getbonecoords('neck').origin, mylocation )) // if we can aim at the target's neck, then...
{
pc.setrotation(rotator(target.getbonecoords('neck' ).origin - mylocation ));
if ( AutoFire ) // if AutoFire is on, then...
{
pc.pawn.weapon.serverfire(true,false,false); // tells our bot to fire
pc.pawn.weapon.playfiring(); // since serverfire is silent, this line will tell the bot to make the gun firing noise, as you fire
}
}
}
}
}
AGP_Weapon(PC.Pawn.Weapon).bWpnRecoil = false; // turns off recoil
AGP_Weapon(PC.Pawn.Weapon).bWpnAccuracy = false; // makes our weapons accurate oddly enough
if ( PC.Pawn.Weapon.AmmoType.AmmoAmount == 0 ) // if we dont have any bullets left in our clip, then
{
pc.pawn.serverreload();
}
}
for (I = 0; I < PC.GameReplicationInfo.PRIArray.length; I++ )
{
PRI = PC.GameReplicationInfo.PRIArray[i]; // makes it scan through the players
CurrentTargetLocation = PRI.GetPawnLocation(); // states that current target location stands for PRI.GetPawnLocation()
ESPVec = PC.Player.Console.WorldToScreen(CurrentTargetLocat ion); // Tells what ESPVec stands for
if ( PRI != None && PRI.Team != PC.Pawn.PlayerReplicationInfo.Team && PRI.myPawn != PC.Pawn && !PRI.IsDead() ) // if there is a player, and he's not on our team, and he is not me, and he is not dead, do the following
{
if ( Wallhack ) // If Wallhack is On, then
{
Canvas.DrawActor(PRI.myPawn,false,true); // Sets up the wallhack
PRI.myPawn.bHidden = false; // makes it so we can see the enemy through the walls
}
if ( ESP ) // if ESP is On, then
{
Canvas.SetDrawColor(255,0,0); // Sets the default draw color. The "()" numbers pertain to color. In order of ( Red, Green, Blue )
Canvas.SetPos(ESPVec.X,ESPVec.Y);
Canvas.DrawText(PRI.PlayerName);
Canvas.SetPos(ESPVec.X,ESPVec.Y+10);
Canvas.DrawText("D:: "$String(Int(VSize(CurrentTargetLocation - MyLocation) / 48)) $ " m.");
if ( PRI.myPawn.Health > 0 ) // so that it doesnt just draw the text health, and not give you a number. you must be within a certain distance for it to draw the health
{
Canvas.SetPos(ESPVec.X,ESPVec.Y+20);
Canvas.DrawText("H:: "$PRI.myPawn.Health);
}
}
}
}
} // This ends our post render functionIn the Post Render we called the function DrawMyMenu, so we need to make that function. This is where we will tell the bot to draw the text, that pertains to our health, and such.


Code:

function DrawMyMenu(Canvas Canvas)
{
Canvas.SetDrawColor(255,128,0); // its like an orange, its pretty good to see with
Canvas.SetPos(10,470);
Canvas.DrawText("Health:: "$PC.Pawn.Health);
Canvas.SetPos(10,480);
Canvas.DrawText("Ping:: "$PC.ExactPing * 1000);
Canvas.SetPos(10,500);
Canvas.DrawText("AutoAim::");
if ( AutoAim ) // if AutoAim is On, then
{
canvas.setpos(84,500);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else // if AutoAim is Off, then
{
canvas.setpos(84,500);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
Canvas.SetPos(10,510);
Canvas.SetDrawColor(255,128,0);
Canvas.DrawText("AutoFire:: ");
if ( AutoFire )
{
canvas.setpos(84,510);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else
{
canvas.setpos(84,510);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
Canvas.SetPos(10,520);
Canvas.SetDrawColor(255,128,0);
Canvas.DrawText("Wallhack:: ");
if ( Wallhack )
{
canvas.setpos(84,520);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else
{
canvas.setpos(84,520);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
} // ends the DrawMyMenu functionNow we are going to add the User-InPut Key Events, (Keys that when you hit them, it will turn something on or off ).


Code:
function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
{
if( Action!=IST_Press )
return false;
else if ( Key==IK_Numpad1) // if you hit the disired key it toggles that item..
{
autoaim = !autoaim;
}
else if ( Key==IK_Numpad2)// if you hit the disired key it toggles that item..
{
autofire = !autofire;
}
else if ( Key==IK_Numpad3)// if you hit the disired key it toggles that item..
{
wallhack = !wallhack;
}
else if ( key==IK_Home )// if you hit the disired key it toggles that item..
{
menu = !menu;
}
else
{
return false;
}
} //closes the key eventsNow we will define the default properties of the bot, to set the defaults of what will be on and off when you load the bot! There are two items that you must always have set in your default properties. You must always have, bActive=true, and bVisible=true. In defaultproperties, we do not use semicolons.


Code:
defaultproperties
{
bActive=True
bVisible=True
AutoAim=True
AutoFire=True
ESP=True
Wallhack=True
Menu=True
}
Now we have finished our whole bot! Now we need to compile it. How do we| do that? Well, its simple...here are the steps to compiling:: |
|Download UMake here |
|Download the UnrealEngine2RuntimeDemo |
|Download Humm3r's Uscript Byte-Code Converter |
|Download the AGP,Core,Engine, and XInterface files below(See links Below. |
|_________________________________________________ ______________|
Next you need to copy the UMake files, to the same directory as where were installed the UnrealEngine2RunTimeDemo.
Now copy the open the attached RAR archive, and copy the folder called TutBot to the UnrealEngine2RuntimeDemo folder as well.
Run UMake.exe
Browse for the folder called TutBot, and open that up, then select the classes file.
Then, click compile, and your all set! then but should be in your UnrealEngine2RuntimeDemo



The attached file contains::
The TutBot Source.
The TutBot.u
The TutBot ReAdMe!
Enjoy! I hope this helped some of you!!!

//Credits\\
Atheena - For writing
Squirrel - For compile the bot for me and giving me the tools he used to compile
Humm3r -For contributing Uscript Byte-Code Converter


Download Links:

AGP___Core___Engine___XInterface.rar (623.55 KB)
MEGAUPLOAD - The leading online storage and file delivery service

UE2R2AA26.rar (269.02 KB)
MEGAUPLOAD - The leading online storage and file delivery service

UE2Runtime-22262002_Demo.rar (14.37 MB)
MEGAUPLOAD - The leading online storage and file delivery service

UMake-1-1.zip (263.52 KB)
MEGAUPLOAD - The leading online storage and file delivery service
Attached Files
File Type: rar Tutorial Bot.rar (12.5 KB, 33 views)
__________________
Quote:
Originally Posted by TrueAssasin View Post
.If I tell you I'm stupid you would think I'm boasting. But if i told you I'm smarter then a retard you KNOW im lying
.

Last edited by Atheena; 01-21-2007 at 03:12 PM..
The Following 5 Users Say Thank You to Atheena For This Useful Post:
AznMonky (01-21-2007), deaddude (01-23-2007), GangstaDude (01-23-2007), Hybrid (01-26-2007), noobwhoneedplvl (01-23-2007)
  #2  
Old 01-21-2007, 03:21 PM
Atheena's Avatar
Stone Axe
 
Last Online: 08-16-2008 02:11 AM
Join Date: Aug 2006
Age: 19
Posts: 33
Thanks: 8
Thanked 35 Times in 14 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0
Atheena is on a distinguished road
Points: 690.69
Bank: 0.00
Total Points: 690.69
STATUS: FINISHEDComplete scanning result of "Tutorial_Bot.rar", received in VirusTotal at 01.22.2007, 0023 (CET).

Antivirus Version Update Result
AntiVir 7.3.0.26 01.21.2007 no virus found
Authentium 4.93.8 01.21.2007 no virus found
Avast 4.7.936.0 01.18.2007 no virus found
AVG 386 01.21.2007 no virus found
BitDefender 7.2 01.21.2007 no virus found
CAT-QuickHeal 9.00 01.20.2007 no virus found
ClamAV devel-20060426 01.21.2007 no virus found
DrWeb 4.33 01.21.2007 no virus found
eSafe 7.0.14.0 01.21.2007 no virus found
eTrust-InoculateIT 23.73.118 01.20.2007 no virus found
eTrust-Vet 30.3.3336 01.19.2007 no virus found
Ewido 4.0 01.21.2007 no virus found
Fortinet 2.82.0.0 01.21.2007 no virus found
F-Prot 3.16f 01.21.2007 no virus found
F-Prot4 4.2.1.29 01.21.2007 no virus found
Ikarus T3.1.0.27 01.09.2007 no virus found
Kaspersky 4.0.2.24 01.21.2007 no virus found
McAfee 4943 01.19.2007 no virus found
Microsoft 1.1904 01.21.2007 no virus found
NOD32v2 1995 01.21.2007 no virus found
Norman 5.80.02 01.21.2007 no virus found
Panda 9.0.0.4 01.21.2007 no virus found
Prevx1 V2 01.22.2007 no virus found
Sophos 4.13.0 01.20.2007 no virus found
Sunbelt 2.2.907.0 01.12.2007 no virus found
TheHacker 6.0.3.153 01.21.2007 no virus found
UNA 1.83 01.19.2007 no virus found
VBA32 3.11.2 01.20.2007 no virus found
VirusBuster 4.3.19:9 01.21.2007 no virus found


Aditional Information
File size: 12814 bytes
MD5: 5f1ab5f1e98effc659e4941abf96a88b
SHA1: 33b6260e0e8cf1157099b8a90dd5c2e914e0d300








STATUS: FINISHEDComplete scanning result of "AGP___Core___Engine___XInterface.", received in VirusTotal at 01.22.2007, 0050 (CET).

Antivirus Version Update Result
AntiVir 7.3.0.26 01.21.2007 no virus found
Authentium 4.93.8 01.21.2007 no virus found
Avast 4.7.936.0 01.18.2007 no virus found
AVG 386 01.21.2007 no virus found
BitDefender 7.2 01.21.2007 no virus found
CAT-QuickHeal 9.00 01.20.2007 no virus found
ClamAV devel-20060426 01.21.2007 no virus found
DrWeb 4.33 01.21.2007 no virus found
eSafe 7.0.14.0 01.21.2007 no virus found
eTrust-InoculateIT 23.73.118 01.20.2007 no virus found
eTrust-Vet 30.3.3336 01.19.2007 no virus found
Ewido 4.0 01.21.2007 no virus found
Fortinet 2.82.0.0 01.21.2007 no virus found
F-Prot 3.16f 01.21.2007 no virus found
F-Prot4 4.2.1.29 01.21.2007 no virus found
Ikarus T3.1.0.27 01.09.2007 no virus found
Kaspersky 4.0.2.24 01.21.2007 no virus found
McAfee 4943 01.19.2007 no virus found
Microsoft 1.1904 01.21.2007 no virus found
NOD32v2 1995 01.21.2007 no virus found
Norman 5.80.02 01.21.2007 no virus found
Panda 9.0.0.4 01.21.2007 no virus found
Prevx1 V2 01.22.2007 no virus found
Sophos 4.13.0 01.20.2007 no virus found
Sunbelt 2.2.907.0 01.12.2007 no virus found
TheHacker 6.0.3.153 01.21.2007 no virus found
UNA 1.83 01.19.2007 no virus found
VBA32 3.11.2 01.20.2007 no virus found
VirusBuster 4.3.19:9 01.21.2007 no virus found


Aditional Information
File size: 638516 bytes
MD5: 3e4be3fc7108224d852c5e105f066ce1
SHA1: 7764ee005ebb03b387106k8f7553eb4f12d3f56




STATUS: FINISHEDComplete scanning result of "UE2R2AA26.rar", received in VirusTotal at 01.22.2007, 0016 (CET).

Antivirus Version Update Result
AntiVir 7.3.0.26 01.21.2007 no virus found
Authentium 4.93.8 01.21.2007 no virus found
Avast 4.7.936.0 01.18.2007 no virus found
AVG 386 01.21.2007 no virus found
BitDefender 7.2 01.21.2007 no virus found
CAT-QuickHeal 9.00 01.20.2007 no virus found
ClamAV devel-20060426 01.21.2007 no virus found
DrWeb 4.33 01.21.2007 no virus found
eSafe 7.0.14.0 01.21.2007 no virus found
eTrust-InoculateIT 23.73.118 01.20.2007 no virus found
eTrust-Vet 30.3.3336 01.19.2007 no virus found
Ewido 4.0 01.21.2007 no virus found
Fortinet 2.82.0.0 01.21.2007 no virus found
F-Prot 3.16f 01.21.2007 no virus found
F-Prot4 4.2.1.29 01.21.2007 no virus found
Ikarus T3.1.0.27 01.09.2007 no virus found
Kaspersky 4.0.2.24 01.21.2007 no virus found
McAfee 4943 01.19.2007 no virus found
Microsoft 1.1904 01.21.2007 no virus found
NOD32v2 1995 01.21.2007 no virus found
Norman 5.80.02 01.21.2007 no virus found
Panda 9.0.0.4 01.21.2007 no virus found
Prevx1 V2 01.22.2007 no virus found
Sophos 4.13.0 01.20.2007 no virus found
Sunbelt 2.2.907.0 01.12.2007 no virus found
TheHacker 6.0.3.153 01.21.2007 no virus found
UNA 1.83 01.19.2007 no virus found
VBA32 3.11.2 01.20.2007 no virus found
VirusBuster 4.3.19:9 01.21.2007 no virus found


Aditional Information
File size: 275474 bytes
MD5: 3e4be3fc7108224d852c5e105f066ce1
SHA1: 66853bc095bbe03bd87106d8f7544eb4f12d3f56


STATUS: FINISHEDComplete scanning result of "UMake-1-1.zip", received in VirusTotal at 01.22.2007, 0057 (CET).

Antivirus Version Update Result
AntiVir 7.3.0.26 01.21.2007 no virus found
Authentium 4.93.8 01.21.2007 no virus found
Avast 4.7.936.0 01.18.2007 no virus found
AVG 386 01.21.2007 no virus found
BitDefender 7.2 01.21.2007 no virus found
CAT-QuickHeal 9.00 01.20.2007 no virus found
ClamAV devel-20060426 01.21.2007 no virus found
DrWeb 4.33 01.21.2007 no virus found
eSafe 7.0.14.0 01.21.2007 no virus found
eTrust-InoculateIT 23.73.119 01.22.2007 no virus found
eTrust-Vet 30.3.3336 01.19.2007 no virus found
Ewido 4.0 01.21.2007 no virus found
Fortinet 2.82.0.0 01.21.2007 no virus found
F-Prot 3.16f 01.21.2007 no virus found
F-Prot4 4.2.1.29 01.21.2007 no virus found
Ikarus T3.1.0.27 01.09.2007 no virus found
Kaspersky 4.0.2.24 01.22.2007 no virus found
McAfee 4943 01.19.2007 no virus found
Microsoft 1.1904 01.21.2007 no virus found
NOD32v2 1995 01.21.2007 no virus found
Norman 5.80.02 01.21.2007 no virus found
Panda 9.0.0.4 01.21.2007 no virus found
Prevx1 V2 01.22.2007 no virus found
Sophos 4.13.0 01.20.2007 no virus found
Sunbelt 2.2.907.0 01.12.2007 no virus found
TheHacker 6.0.3.153 01.21.2007 no virus found
UNA 1.83 01.19.2007 no virus found
VBA32 3.11.2 01.20.2007 no virus found
VirusBuster 4.3.19:9 01.21.2007 no virus found


Aditional Information
File size: 269849 bytes
MD5: 175f2b9da1435391521bebe539a25acf
SHA1: af4981b5e327fcffff60ff1b7ec3a5a13889707a

Couldn't upload one of em, you get the point there all safe ^^ thank me if this was helpful to you
__________________
Quote:
Originally Posted by TrueAssasin View Post
.If I tell you I'm stupid you would think I'm boasting. But if i told you I'm smarter then a retard you KNOW im lying
.

Last edited by Atheena; 01-21-2007 at 03:48 PM..
The Following 4 Users Say Thank You to Atheena For This Useful Post:
BeastfromtheEast (07-27-2007), deaddude (01-23-2007), Hybrid (01-26-2007), noobwhoneedplvl (01-23-2007)
  #3  
Old 07-08-2007, 09:59 PM
Double Wood Axe
 
Last Online: 09-21-2007 05:43 PM
Join Date: Jul 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0
KontaminatioN is on a distinguished road
Points: 222.00
Bank: 0.00
Total Points: 222.00
This isn't Atheena and Squirrel. This is unreal-pwner, the biggest douche in AA cheating.

UnKnoWnCheaTs ForuM - View Single Post - [Uscript] Complete n00b's Guide
http://www.mpcforum.com/showthread.php?t=131696

Anyway, nice try. Atleast put it into code tags.

Code:
class MyInteraction extends Interaction;You MUST define your bots class. If you dont then the bot will not compile, and if it doesnt compile then it will serve no purpose.


Now that we know what features we want to use in our bot, we need to know how to define those features. We use Global Variabls to define variables that will be featured in our bot. The following is a list of the different types of variables, as well as the purpose that they serve::
Bools --- These are type of variables that can be turn On/Off. They are represented with a True, or a False.
Vectors --- Vector variabls, are often used to represent location. That is the soul purpose that they will server in the makeing of this bot.
Int --- The variable Integer, or Int, represents a number. A number is an integer.[list]Float --- variable used to represtent a number that is not a whole number, like 4.5
Pawn --- The Pawn variable, is used to represtent a person. Such as your target.
There are also misc. variables that you must include in your variable declarations. These include, but are not limited to::
You must state what PlayerController stands for. You MUST include this in your bot.

PlayerController gets defined like this::


Code:
var PlayerController MyController;This tells the bot, that wherever is sees the text MyController, it refers to PlayerController. You do not have to use MyController. Personally, I prefer to use PC. In the example bot that will be attached with this bot, PC, will represent PlayerController
The next variable that we will discuss is the loader variable. This depends on what your loader is called. In the example bot that will be attached to this post, the loader will be called Load. Here is how you define the loader for this bot::

Code:
var Load Load;Note that the word Load is called twice. This is how our loader is setup.
Another type of variable that you must have in your bots class is your Canvas. The Canvas variable will be assigned like so::

Code:
var Canvas MyCanvas;This line tells your bot, that anywhere it sees the text MyCanvas it means, Canvas. You DO NOT have to use MyCanvas. You can use just about anything. I reccommend using Canvas because it is hard to forget what that stands for. But if you do use Canvas, you must still define it.
You will also need to state what PlayerReplicationInfo stands for. In the example bot, we will have it represented by PRI. Here is how you would do so::

Code:
var PlayerReplicationInfo PRI;Once again, this means that anywhere in the bot that you see the text PRI, it means PlayerReplicationInfo.
Now that we have learnt all about our Variable Declarations, we will start to build our bot. So lets get started!



First we have to define our class, remember? So lets!


Code:
//----- Class Definition -----

Class MyInteraction extends Interaction; // Defines the class of our bot.Now we need to state our Global Variables


Code:
//----- Global Variables ----- now we can start declaring our global variables.

var bool AutoAim;
var bool AutoFire;
var bool ESP;
var bool Wallhack;
var bool Menu;
var vector MyLocation;
var vector ESPVec;
var vector CurrentTargetLocation;
var int I;
var PlayerController PC;
var Pawn Target;
var Playerreplicationinfo PRI;
var Load Load;
var Canvas MyCanvas;Now we can start with our main bot functions, like where we call our aim and such!


Code:

//----- Main Bot Functions -----

function PostRender(Canvas Canvas) // This is our first bot function. It is automatically called by the bot itself.
{
PC = ViewPortOwner.Actor; // We state what the text PC stands for.
MyLocation = PC.Pawn.EyePosition(); // We state what the vector MyLocation stands for
Canvas.Font = Canvas.TinyFont; // Set the default font size for our bot
if (Menu) // if menu is on, then
{
DrawMyMenu(Canvas); // draw our menu
}
If ( PC.Pawn != None && PC.Pawn.Weapon != None ) // If we are alive, and we have a gun, do the following
{
if ( AutoAim ) // If AutoAim is On then...
{
foreach PC.Pawn.Level.AllActors(Class'Pawn', Target)
{
if ( Target != None && Target.PlayerReplicationInfo.Team.TeamIndex != PC.Pawn.PlayerReplicationInfo.Team.TeamIndex && Target != PC.Pawn && !Target.bHidden && !Target.IsInState('dying')) // If There is a target, he isnt on my team, the target isnt me, the target isnt hidden, and the target isnt in the state of dying, then ...
{
if ( pc.fasttrace(target.getbonecoords('neck').origin, mylocation )) // if we can aim at the target's neck, then...
{
pc.setrotation(rotator(target.getbonecoords('neck' ).origin - mylocation ));
if ( AutoFire ) // if AutoFire is on, then...
{
pc.pawn.weapon.serverfire(true,false,false); // tells our bot to fire
pc.pawn.weapon.playfiring(); // since serverfire is silent, this line will tell the bot to make the gun firing noise, as you fire
}
}
}
}
}
AGP_Weapon(PC.Pawn.Weapon).bWpnRecoil = false; // turns off recoil
AGP_Weapon(PC.Pawn.Weapon).bWpnAccuracy = false; // makes our weapons accurate oddly enough
if ( PC.Pawn.Weapon.AmmoType.AmmoAmount == 0 ) // if we dont have any bullets left in our clip, then
{
pc.pawn.serverreload();
}
}
for (I = 0; I < PC.GameReplicationInfo.PRIArray.length; I++ )
{
PRI = PC.GameReplicationInfo.PRIArray[i]; // makes it scan through the players
CurrentTargetLocation = PRI.GetPawnLocation(); // states that current target location stands for PRI.GetPawnLocation()
ESPVec = PC.Player.Console.WorldToScreen(CurrentTargetLocat ion); // Tells what ESPVec stands for
if ( PRI != None && PRI.Team != PC.Pawn.PlayerReplicationInfo.Team && PRI.myPawn != PC.Pawn && !PRI.IsDead() ) // if there is a player, and he's not on our team, and he is not me, and he is not dead, do the following
{
if ( Wallhack ) // If Wallhack is On, then
{
Canvas.DrawActor(PRI.myPawn,false,true); // Sets up the wallhack
PRI.myPawn.bHidden = false; // makes it so we can see the enemy through the walls
}
if ( ESP ) // if ESP is On, then
{
Canvas.SetDrawColor(255,0,0); // Sets the default draw color. The "()" numbers pertain to color. In order of ( Red, Green, Blue )
Canvas.SetPos(ESPVec.X,ESPVec.Y);
Canvas.DrawText(PRI.PlayerName);
Canvas.SetPos(ESPVec.X,ESPVec.Y+10);
Canvas.DrawText("D:: "(Int(VSize(CurrentTargetLocation - MyLocation) / 48)) $ " m.");
if ( PRI.myPawn.Health > 0 ) // so that it doesnt just draw the text health, and not give you a number. you must be within a certain distance for it to draw the health
{
Canvas.SetPos(ESPVec.X,ESPVec.Y+20);
Canvas.DrawText("H:: ".myPawn.Health);
}
}
}
}
} // This ends our post render functionIn the Post Render we called the function DrawMyMenu, so we need to make that function. This is where we will tell the bot to draw the text, that pertains to our health, and such.


Code:

function DrawMyMenu(Canvas Canvas)
{
Canvas.SetDrawColor(255,128,0); // its like an orange, its pretty good to see with
Canvas.SetPos(10,470);
Canvas.DrawText("Health:: ".Pawn.Health);
Canvas.SetPos(10,480);
Canvas.DrawText("Ping:: ".ExactPing * 1000);
Canvas.SetPos(10,500);
Canvas.DrawText("AutoAim::");
if ( AutoAim ) // if AutoAim is On, then
{
canvas.setpos(84,500);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else // if AutoAim is Off, then
{
canvas.setpos(84,500);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
Canvas.SetPos(10,510);
Canvas.SetDrawColor(255,128,0);
Canvas.DrawText("AutoFire:: ");
if ( AutoFire )
{
canvas.setpos(84,510);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else
{
canvas.setpos(84,510);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
Canvas.SetPos(10,520);
Canvas.SetDrawColor(255,128,0);
Canvas.DrawText("Wallhack:: ");
if ( Wallhack )
{
canvas.setpos(84,520);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else
{
canvas.setpos(84,520);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
} // ends the DrawMyMenu functionNow we are going to add the User-InPut Key Events, (Keys that when you hit them, it will turn something on or off ).
Code:
function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
{
if( Action!=IST_Press )
return false;
else if ( Key==IK_Numpad1) // if you hit the disired key it toggles that item..
{
autoaim = !autoaim;
}
else if ( Key==IK_Numpad2)// if you hit the disired key it toggles that item..
{
autofire = !autofire;
}
else if ( Key==IK_Numpad3)// if you hit the disired key it toggles that item..
{
wallhack = !wallhack;
}
else if ( key==IK_Home )// if you hit the disired key it toggles that item..
{
menu = !menu;
}
else
{
return false;
}
} //closes the key eventsNow we will define the default properties of the bot, to set the defaults of what will be on and off when you load the bot! There are two items that you must always have set in your default properties. You must always have, bActive=true, and bVisible=true. In defaultproperties, we do not use semicolons.


Code:
defaultproperties
{
bActive=True
bVisible=True
AutoAim=True
AutoFire=True
ESP=True
Wallhack=True
Menu=True
}
__________________
hwo du cpp viruz my wind0sw!
  #4  
Old 09-07-2007, 09:31 PM
Chick
 
Last Online: 04-11-2008 08:33 PM
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0
noobish_me is on a distinguished road
Points: 249.00
Bank: 0.00
Total Points: 249.00
Quote:
Originally Posted by KontaminatioN View Post
This isn't Atheena and Squirrel. This is unreal-pwner, the biggest douche in AA cheating.

UnKnoWnCheaTs ForuM - View Single Post - [Uscript] Complete n00b's Guide
http://www.mpcforum.com/showthread.php?t=131696

Anyway, nice try. Atleast put it into code tags.

Code:
class MyInteraction extends Interaction;You MUST define your bots class. If you dont then the bot will not compile, and if it doesnt compile then it will serve no purpose.


Now that we know what features we want to use in our bot, we need to know how to define those features. We use Global Variabls to define variables that will be featured in our bot. The following is a list of the different types of variables, as well as the purpose that they serve::
Bools --- These are type of variables that can be turn On/Off. They are represented with a True, or a False.
Vectors --- Vector variabls, are often used to represent location. That is the soul purpose that they will server in the makeing of this bot.
Int --- The variable Integer, or Int, represents a number. A number is an integer.[list]Float --- variable used to represtent a number that is not a whole number, like 4.5
Pawn --- The Pawn variable, is used to represtent a person. Such as your target.
There are also misc. variables that you must include in your variable declarations. These include, but are not limited to::
You must state what PlayerController stands for. You MUST include this in your bot.

PlayerController gets defined like this::


Code:
var PlayerController MyController;This tells the bot, that wherever is sees the text MyController, it refers to PlayerController. You do not have to use MyController. Personally, I prefer to use PC. In the example bot that will be attached with this bot, PC, will represent PlayerController
The next variable that we will discuss is the loader variable. This depends on what your loader is called. In the example bot that will be attached to this post, the loader will be called Load. Here is how you define the loader for this bot::

Code:
var Load Load;Note that the word Load is called twice. This is how our loader is setup.
Another type of variable that you must have in your bots class is your Canvas. The Canvas variable will be assigned like so::

Code:
var Canvas MyCanvas;This line tells your bot, that anywhere it sees the text MyCanvas it means, Canvas. You DO NOT have to use MyCanvas. You can use just about anything. I reccommend using Canvas because it is hard to forget what that stands for. But if you do use Canvas, you must still define it.
You will also need to state what PlayerReplicationInfo stands for. In the example bot, we will have it represented by PRI. Here is how you would do so::

Code:
var PlayerReplicationInfo PRI;Once again, this means that anywhere in the bot that you see the text PRI, it means PlayerReplicationInfo.
Now that we have learnt all about our Variable Declarations, we will start to build our bot. So lets get started!



First we have to define our class, remember? So lets!


Code:
//----- Class Definition -----

Class MyInteraction extends Interaction; // Defines the class of our bot.Now we need to state our Global Variables


Code:
//----- Global Variables ----- now we can start declaring our global variables.

var bool AutoAim;
var bool AutoFire;
var bool ESP;
var bool Wallhack;
var bool Menu;
var vector MyLocation;
var vector ESPVec;
var vector CurrentTargetLocation;
var int I;
var PlayerController PC;
var Pawn Target;
var Playerreplicationinfo PRI;
var Load Load;
var Canvas MyCanvas;Now we can start with our main bot functions, like where we call our aim and such!


Code:

//----- Main Bot Functions -----

function PostRender(Canvas Canvas) // This is our first bot function. It is automatically called by the bot itself.
{
PC = ViewPortOwner.Actor; // We state what the text PC stands for.
MyLocation = PC.Pawn.EyePosition(); // We state what the vector MyLocation stands for
Canvas.Font = Canvas.TinyFont; // Set the default font size for our bot
if (Menu) // if menu is on, then
{
DrawMyMenu(Canvas); // draw our menu
}
If ( PC.Pawn != None && PC.Pawn.Weapon != None ) // If we are alive, and we have a gun, do the following
{
if ( AutoAim ) // If AutoAim is On then...
{
foreach PC.Pawn.Level.AllActors(Class'Pawn', Target)
{
if ( Target != None && Target.PlayerReplicationInfo.Team.TeamIndex != PC.Pawn.PlayerReplicationInfo.Team.TeamIndex && Target != PC.Pawn && !Target.bHidden && !Target.IsInState('dying')) // If There is a target, he isnt on my team, the target isnt me, the target isnt hidden, and the target isnt in the state of dying, then ...
{
if ( pc.fasttrace(target.getbonecoords('neck').origin, mylocation )) // if we can aim at the target's neck, then...
{
pc.setrotation(rotator(target.getbonecoords('neck' ).origin - mylocation ));
if ( AutoFire ) // if AutoFire is on, then...
{
pc.pawn.weapon.serverfire(true,false,false); // tells our bot to fire
pc.pawn.weapon.playfiring(); // since serverfire is silent, this line will tell the bot to make the gun firing noise, as you fire
}
}
}
}
}
AGP_Weapon(PC.Pawn.Weapon).bWpnRecoil = false; // turns off recoil
AGP_Weapon(PC.Pawn.Weapon).bWpnAccuracy = false; // makes our weapons accurate oddly enough
if ( PC.Pawn.Weapon.AmmoType.AmmoAmount == 0 ) // if we dont have any bullets left in our clip, then
{
pc.pawn.serverreload();
}
}
for (I = 0; I < PC.GameReplicationInfo.PRIArray.length; I++ )
{
PRI = PC.GameReplicationInfo.PRIArray[i]; // makes it scan through the players
CurrentTargetLocation = PRI.GetPawnLocation(); // states that current target location stands for PRI.GetPawnLocation()
ESPVec = PC.Player.Console.WorldToScreen(CurrentTargetLocat ion); // Tells what ESPVec stands for
if ( PRI != None && PRI.Team != PC.Pawn.PlayerReplicationInfo.Team && PRI.myPawn != PC.Pawn && !PRI.IsDead() ) // if there is a player, and he's not on our team, and he is not me, and he is not dead, do the following
{
if ( Wallhack ) // If Wallhack is On, then
{
Canvas.DrawActor(PRI.myPawn,false,true); // Sets up the wallhack
PRI.myPawn.bHidden = false; // makes it so we can see the enemy through the walls
}
if ( ESP ) // if ESP is On, then
{
Canvas.SetDrawColor(255,0,0); // Sets the default draw color. The "()" numbers pertain to color. In order of ( Red, Green, Blue )
Canvas.SetPos(ESPVec.X,ESPVec.Y);
Canvas.DrawText(PRI.PlayerName);
Canvas.SetPos(ESPVec.X,ESPVec.Y+10);
Canvas.DrawText("D:: "(Int(VSize(CurrentTargetLocation - MyLocation) / 48)) $ " m.");
if ( PRI.myPawn.Health > 0 ) // so that it doesnt just draw the text health, and not give you a number. you must be within a certain distance for it to draw the health
{
Canvas.SetPos(ESPVec.X,ESPVec.Y+20);
Canvas.DrawText("H:: ".myPawn.Health);
}
}
}
}
} // This ends our post render functionIn the Post Render we called the function DrawMyMenu, so we need to make that function. This is where we will tell the bot to draw the text, that pertains to our health, and such.


Code:

function DrawMyMenu(Canvas Canvas)
{
Canvas.SetDrawColor(255,128,0); // its like an orange, its pretty good to see with
Canvas.SetPos(10,470);
Canvas.DrawText("Health:: ".Pawn.Health);
Canvas.SetPos(10,480);
Canvas.DrawText("Ping:: ".ExactPing * 1000);
Canvas.SetPos(10,500);
Canvas.DrawText("AutoAim::");
if ( AutoAim ) // if AutoAim is On, then
{
canvas.setpos(84,500);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else // if AutoAim is Off, then
{
canvas.setpos(84,500);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
Canvas.SetPos(10,510);
Canvas.SetDrawColor(255,128,0);
Canvas.DrawText("AutoFire:: ");
if ( AutoFire )
{
canvas.setpos(84,510);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else
{
canvas.setpos(84,510);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
Canvas.SetPos(10,520);
Canvas.SetDrawColor(255,128,0);
Canvas.DrawText("Wallhack:: ");
if ( Wallhack )
{
canvas.setpos(84,520);
canvas.setdrawcolor(0,255,0,255);
canvas.drawtext("On");
}
else
{
canvas.setpos(84,520);
canvas.setdrawcolor(255,0,0,255);
canvas.drawtext("Off");
}
} // ends the DrawMyMenu functionNow we are going to add the User-InPut Key Events, (Keys that when you hit them, it will turn something on or off ).
Code:
function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
{
if( Action!=IST_Press )
return false;
else if ( Key==IK_Numpad1) // if you hit the disired key it toggles that item..
{
autoaim = !autoaim;
}
else if ( Key==IK_Numpad2)// if you hit the disired key it toggles that item..
{
autofire = !autofire;
}
else if ( Key==IK_Numpad3)// if you hit the disired key it toggles that item..
{
wallhack = !wallhack;
}
else if ( key==IK_Home )// if you hit the disired key it toggles that item..
{
menu = !menu;
}
else
{
return false;
}
} //closes the key eventsNow we will define the default properties of the bot, to set the defaults of what will be on and off when you load the bot! There are two items that you must always have set in your default properties. You must always have, bActive=true, and bVisible=true. In defaultproperties, we do not use semicolons.


Code:
defaultproperties
{
bActive=True
bVisible=True
AutoAim=True
AutoFire=True
ESP=True
Wallhack=True
Menu=True
}
you took words off my mouth. these (Squirrel and unreal-pwner) makes good tuts. and i have learned my coding from them. greds will be theirs.
  #5  
Old 09-21-2007, 05:41 PM
Double Wood Axe
 
Last Online: 09-21-2007 05:43 PM
Join Date: Jul 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0
KontaminatioN is on a distinguished road
Points: 222.00
Bank: 0.00
Total Points: 222.00
Quote:
Originally Posted by noobish_me View Post
you took words off my mouth. these (Squirrel and unreal-pwner) makes good tuts. and i have learned my coding from them. greds will be theirs.
It wasn't even squirrel, it was just unreal.
__________________
hwo du cpp viruz my wind0sw!
  #6  
Old 02-29-2008, 09:58 PM
AnomieGat's Avatar
Wood Axe
 
Last Online: 08-27-2008 07:04 PM
Join Date: Feb 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 0
AnomieGat is on a distinguished road
Points: 354.00
Bank: 0.00
Total Points: 354.00
People love to try and steal credit.
  #7  
Old 08-05-2008, 05:00 AM
humanoriino's Avatar
Silver Double Sided Axe+
 
Last Online: 10-19-2008 06:21 AM
Join Date: Nov 2007
Location: Netherlands
Posts: 200
Thanks: 16
Thanked 177 Times in 32 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 3
humanoriino is on a distinguished road
Points: 2,368.20
Bank: 0.00
Total Points: 2,368.20
Can you guys like not fight please ? thanks to whoever made it .. :]
  #8  
Old 08-20-2008, 10:03 AM
halim123's Avatar
Double Gold Axe
 
Last Online: 10-22-2008 01:08 PM
Join Date: Aug 2007
Posts: 141
Thanks: 13
Thanked 19 Times in 13 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Latest Blog:
Rep Power: 3
halim123 is on a distinguished road
Points: 1,954.20
Bank: 0.00
Total Points: 1,954.20
Send a message via ICQ to halim123
srry i dont wanna get crazy by reading all that you posted ^^
-----------------This post was merged together. In future use the edit button.-----------------

: who is sooo crazy and wants to read all the written things XD
-----------------This post was merged together. In future use the edit button.-----------------

LEAAAAAAAAAAAAAAAAAACHER! stop leaching newbie -.-
__________________
->->ThAnK Me,ReP mE, If I hElpEd yOu<-<-

Last edited by halim123; 08-20-2008 at 10:04 AM.. Reason: Automerged Doublepost
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump