Bot Script
Code: Select all
{
// Allied Bot Script Version 2
// VARIABLES
SCALE [1.4] // Set the scale of the actor
FOV [150] // Field of View aka FOV
RUNSPEED [300] // How fast the bot runs
WALKSPEED [200]
FIRSTPOINT [NULL]
SPAWNPOINT [spawn_good]
SPAWNPOINT2 [spawn_good2]
GROUP [Ally]
// Death
DIEHOLD [4]
// Health
HEALTH [100]
HEALTHATTRIBUTE [playerhealth]
DAMAGEATTRIBUTE [enemy_health]
// Lost
LOSTTIME [10]
SEARCHTIME [5]
// Animations
Idle [idle]
Reload [reload]
Walk [walk]
Run [run]
Pain [pain]
Shoot [shoot]
Shootup [shoot1]
Shootdown [shoot2]
ShootStrafeRight [ShootstrafeR]
ShootStrafeLeft [ShootstrafeL]
DIE [die]
DIE2 [die2]
// Weapons
WEAPON1 [M16_bot]
WEAP1MAG [30]
WEAPON2 [FAMAS_bot]
WEAP2MAG [25]
WEAPON3 [AWP_BOT] // Sniper Weapon
WEAP3MAG [10]
WEAPON4 [MP7_BOT]
WEAP4MAG [30]
WEAPON5 [ump_bot]
WEAP5MAG [25]
CURRENTWEAPAMMO [0]
CURRENTWEAP [NULL]
ATTACKRANGE [3000]
SIGHTRANGE [3400]
RELOADTIME [2]
BULLET [bad_shell]
FIREBONE [BIP01]
WEAPON [0]
// Sounds
Runsound [breath.wav]
Shootsound [good.wav]
Diesound [speak/imdieing.wav]
Diesound2 [death1.wav]
Reloadsound [weapon/rifle_reload.wav]
RUNSOUNDDELAY [0]
// Target
TargetX [0]
TargetY [0]
TargetZ [0]
// Functions
DEATHORDER [Death]
PAINORDER [hurted]
ALERTORDER [Alert]
AVOIDORDER [Avoid]
FOUNDORDER [FoundTarget]
RUNORDER [FollowTarget]
LOSTORDER [SearchTarget]
lost_time [0]
exist [0]
run_sound_time [0]
nearestwall [10000]
nearestwalldir [0]
furthestwall [0]
furthestwalldir [0]
tmp [0]
Spawn[ ()
{
Console(true);
AttributeOrder(HEALTHATTRIBUTE, HEALTH, DEATHORDER);
Scale(SCALE);
SetFOV(FOV); // Sets FOV
AvoidOrder(AVOIDORDER); // Avoid obsticles
AddPainOrder(PAINORDER, 75 );
FIRSTPOINT = self.point_name;
PlayAnimation(Idle, false, "");
switch(random(1,5)) // lets bot choose between 5 weapons
{
case 1
{
SetWeapon("M16_bot");
WEAPON = 1; // Weapon Number. Used in Attack cmds.
CURRENTWEAPAMMO = WEAP1MAG;
}
case 2
{
SetWeapon("FAMAS_bot");
WEAPON = 2; // Weapon Number. Used in Attack cmds.
CURRENTWEAPAMMO = WEAP2MAG;
}
case 3
{
SetWeapon("AWP_BOT"); // Sets Sniping Weapon
WEAPON = 3; // Weapon Number. Used in Attack cmds.
CURRENTWEAPAMMO = WEAP3MAG;
}
case 4
{
SetWeapon("MP7_BOT");
WEAPON = 4; // Weapon Number. Used in Attack cmds.
CURRENTWEAPAMMO = WEAP4MAG;
}
case 5
{
SetWeapon("ump_bot");
WEAPON = 5; // Weapon Number. Used in Attack cmds.
CURRENTWEAPAMMO = WEAP5MAG;
}
}
if(random(1,10) < 5)
{
NewOrder("Patrol");
}
else
{
FindPointOrder("Patrol");
}
} ]
Avoid[ ()
{
if(random(1,10) < 5)
{
MoveForward(Run, RUNSPEED, 100, Runsound); // Runs forward
MoveRight(Run, RUNSPEED, 100, Runsound );
if(random(1,10) < 5)
{
SetFOV(360);
FindPointOrder("Patrol");
}
}
else
{
MoveForward(Run, RUNSPEED, 100, Runsound); // Run forward
MoveLeft(Run, RUNSPEED, 100, Runsound );
if(random(1,10) < 5)
{
SetFOV(360);
FindPointOrder("Patrol");
}
}
Return();
} ]
Patrol[ ()
{
SetFOV(FOV);
AvoidOrder(AVOIDORDER);
AddPainOrder(PAINORDER,100 );
FindTargetOrder(SIGHTRANGE, FOUNDORDER, DAMAGEATTRIBUTE );
RotateMoveToPoint(Run, RUNSPEED, RUNSPEED ,false, Runsound ); // Rotates to script point
MoveToPoint(Run, RUNSPEED, Runsound ); // moves to script point
NextPoint();
RestartOrder();
} ]
}
;
Code: Select all
===
; pawn weapons
;===
[M16_bot]
actorname = m16_bot.act
actorrotation = 0 180 0
actorscale = 1
fillcolor = 255 255 255
ambientcolor = 255 255 255
type = weapon
environmentmapping = false
allmaterial = false
percentmapping = 75
percentmaterial = 75
[FAMAS_bot]
actorname = famas_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon
[AWP_BOT]
actorname = awp_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon
[MP7_BOT]
actorname = mp7_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon
[ump_bot]
actorname = ump_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon