Author Topic: [*] SpecialBots -> [Error] (65:6): period ('.') expected  (Read 975 times)

0 Members and 1 Guest are viewing this topic.

Offline mich1103

  • Flagrunner
  • ****
  • Posts: 557
  • Did you say chocolate ? O.o
    • ZoMbIe-DeStRoYeR pk server
[*] SpecialBots -> [Error] (65:6): period ('.') expected
« on: April 18, 2010, 03:34:08 pm »
Code: [Select]
const
  CLASSES = 4;   //how many bot classes you want

type
  SBot = Record
    BName   : string;
    BHealth : integer;
    BHPReg  : integer;
    BRegLim : boolean;
    BShowHP : boolean;
    BHColor : longint;
    BWeapon : byte;
    BBonus  : byte;
    BBonT   : integer;
    BDamage : integer;

    BWaveVal: byte;
    BWaveStl: byte;
    BWaveSpd: integer;
  end;

var
  TheBot: array[0..CLASSES] of SBot;
  IGB: array[1..32] of SBot;
  BotHpLeft: array[1..32] of integer;

//********************************************************************

procedure ActivateServer();


  begin                               //COPY THIS PIECE TO CREATE NEW BOT
    TheBot[1].BName   := 'Zombie';  //bot name
    TheBot[1].BHealth := 150;         //bot health (150- normal, 65- realistic)
    TheBot[1].BHPReg  := 0;           //health regeneration per second(0 to disable)
    TheBot[1].BRegLim := false;       //regeneration limited to max health(true/false)(it will stop anyway at 65000 to avoid crash)
    TheBot[1].BShowHP := false;       //show bot hp (true/false)
    TheBot[1].BHColor := $FFFF00;     //color of hp
    TheBot[1].BWeapon := 15;          //bot weapon (255 to random)
    TheBot[1].BBonus  := 255;         //bonus given to bot (255 to turn off)
    TheBot[1].BBonT   := 0;           //time to give bonus (60 - 1 sec)(0 to give bonus only at respawn)
    TheBot[1].BDamage := 1;           //damage multiplier(1 to normal damage)
                                      //
    TheBot[1].BWaveVal:= 0;          //how many bullets in on death wave(0 to turn off)
    TheBot[1].BWaveStl:= 0;           //style of bullets in wave
    TheBot[1].BWaveSpd:= 0;          //max speed of bullets in wave(speed is random value from -maxspeed to maxspeed)
  end;

  begin
    TheBot[2].BName   := 'Knifer zombie';
    TheBot[2].BHealth := 150;
    TheBot[2].BHPReg  := 0;
    TheBot[2].BRegLim := false;
    TheBot[2].BShowHP := false;
    TheBot[2].BHColor := $FFFFFF;
    TheBot[2].BWeapon := 14;
    TheBot[2].BBonus  := 0;
    TheBot[2].BBonT   := 0;
    TheBot[2].BDamage := 1;

    TheBot[2].BWaveVal:= 4;
    TheBot[2].BWaveStl:= 14;
    TheBot[2].BWaveSpd:= 6;
  end;
   

begin
    TheBot[3].BName   := 'Burning zombie';
    TheBot[3].BHealth := 150;
    TheBot[3].BHPReg  := 0;
    TheBot[3].BRegLim := false;
    TheBot[3].BShowHP := false;
    TheBot[3].BHColor := $FFFFFF;
    TheBot[3].BWeapon := 15;
    TheBot[3].BBonus  := 0;
    TheBot[3].BBonT   := 0;
    TheBot[3].BDamage := 2;

    TheBot[3].BWaveVal:= 20;
    TheBot[3].BWaveStl:= 5;
    TheBot[3].BWaveSpd:= 6;
  end;

 
   begin
    TheBot[4].BName   := 'Mercenary';
    TheBot[4].BHealth := 200;
    TheBot[4].BHPReg  := 0;
    TheBot[4].BRegLim := false;
    TheBot[4].BShowHP := true;
    TheBot[4].BHColor := $FFFF0000;
    TheBot[4].BWeapon := 8;
    TheBot[4].BBonus  := 255;
    TheBot[4].BBonT   := 0;
    TheBot[4].BDamage := 1;

    TheBot[4].BWaveVal:= 0;
    TheBot[4].BWaveStl:= 0;
    TheBot[4].BWaveSpd:= 0;
  end;


    begin
    TheBot[5].BName   := 'Kamikaze';
    TheBot[5].BHealth := 150;
    TheBot[5].BHPReg  := 0;
    TheBot[5].BRegLim := false;
    TheBot[5].BShowHP := false;
    TheBot[5].BHColor := $FF0000;
    TheBot[5].BWeapon := 15;
    TheBot[5].BBonus  := 255;
    TheBot[5].BBonT   := 0;
    TheBot[5].BDamage := 1;

    TheBot[5].BWaveVal:= 3;
    TheBot[5].BWaveStl:= 4;
    TheBot[5].BWaveSpd:= 5;
  end;


//THIS SET WILL BE GIVEN TO ANY OTHER BOT & TO ALL PLAYERS
  begin
    TheBot[0].BName   := '';
    TheBot[0].BHealth := 0;
    TheBot[0].BHPReg  := 0;
    TheBot[0].BRegLim := false;
    TheBot[0].BShowHP := false;
    TheBot[0].BHColor := $000000;
    TheBot[0].BWeapon := 255;
    TheBot[0].BBonus  := 255;
    TheBot[0].BBonT   := 0;
    TheBot[0].BDamage := 1;

    TheBot[0].BWaveVal:= 0;
    TheBot[0].BWaveStl:= 0;
    TheBot[0].BWaveSpd:= 0;
  end;
end;

//********************************************************************

procedure Explode(Target: byte);
var i: byte;
begin
  for i:= 1 to IGB[Target].BWaveVal do CreateBullet(GetPlayerStat(Target,'X'),GetPlayerStat(Target,'Y'),Random(IGB[Target].BWaveSpd, -(IGB[Target].BWaveSpd)),Random(IGB[Target].BWaveSpd, -(IGB[Target].BWaveSpd)), 100, IGB[Target].BWaveStl, Target);
end;

procedure ShowHP(Target,Shooter: byte);
begin
  DrawText(Shooter, IntToStr(BotHpLeft[Target]), 180, IGB[Target].BHColor, 0.1, 260, 350);
end;

function Assignable(ID: byte): boolean;
var i: byte;
begin
  result:= false;
  for i:= 1 to CLASSES do if IDToName(ID) = TheBot[i].BName then result:= true;
  if GetPlayerStat(ID,'Human') = true then result:= false;
end;

procedure Assign(ID: Byte);
var i: byte;
begin
  for i:= 1 to CLASSES do if IDToName(ID) = TheBot[i].BName then begin
    IGB[ID] := TheBot[i];
  end;
  if not Assignable(ID) then IGB[ID]:= TheBot[0];
end;

procedure Regenerate(ID: byte);
begin
  if IGB[ID].BRegLim then begin
    if (IGB[ID].BHealth - BotHpLeft[ID]) < IGB[ID].BHPReg then BotHpLeft[ID]:= BotHpLeft[ID] + (IGB[ID].BHealth - BotHpLeft[ID]);
    if (IGB[ID].BHealth - BotHpLeft[ID]) >= IGB[ID].BHPReg then BotHpLeft[ID]:= BotHpLeft[ID] + IGB[ID].BHPReg;
  end else if BotHpLeft[ID] < 65000 then BotHpLeft[ID]:= BotHpLeft[ID] + IGB[ID].BHealth;
end;

//********************************************************************

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
  if Assignable(Victim) then if IGB[Victim].BWaveVal > 0 then Explode(Victim);
end;

procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
//  AllHealth;
  for i:= 1 to 32 do if Assignable(i) then begin
    if (IGB[i].BBonT >= 60) and (IGB[i].BBonus <> 255) then if Ticks mod IGB[i].BBonT = 0 then GiveBonus(i, IGB[i].BBonus);
    if IGB[i].BWeapon <> 255 then if (GetPlayerStat(i, 'Primary') <> IGB[i].BWeapon) or (GetPlayerStat(i, 'Secondary') <> 255) then ForceWeapon(i, IGB[i].BWeapon, 255, 0);
    if (IGB[i].BHPReg <> 0) and (GetPlayerStat(i,'Alive')= true) then Regenerate(i);
  end;
end;

procedure OnPlayerRespawn(ID: Byte);
begin
  if Assignable(ID) then if IDToName(ID) <> IGB[ID].BName then Assign(ID);

  if Assignable(ID) then begin
    if IGB[ID].BBonus <> 255 then GiveBonus(ID, IGB[ID].BBonus);
    if IGB[ID].BWeapon <> 255 then ForceWeapon(ID, IGB[ID].BWeapon, 255, 0);
    BotHpLeft[ID]:= IGB[ID].BHealth;
  end;
end;

function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer) : integer;
begin
  Result:= Damage;
  if Assignable(Victim) then if IGB[Victim].BShowHP then ShowHP(Victim, Shooter);
  if Assignable(Shooter) then if IGB[Shooter].BDamage <> 1 then Result:= Damage*IGB[Shooter].BDamage;
  if Assignable(Victim) then if BotHpLeft[Victim] > 0 then begin
    Result:= -99999;
    if Damage < 5000 then dec(BotHpLeft[Victim],Damage) else dec(BotHpLeft[Victim],Round(Damage/75));
    if BotHpLeft[Victim] < 1 then DoDamageBy(Victim,Shooter,200);
  end;
end;
//********************************************************************

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: [*] SpecialBots -> [Error] (65:6): period ('.') expected
« Reply #1 on: April 18, 2010, 04:10:26 pm »
Code: (pascal) [Select]
const
  CLASSES = 4;   //how many bot classes you want

type
  SBot = Record
    BName   : string;
    BHealth : integer;
    BHPReg  : integer;
    BRegLim : boolean;
    BShowHP : boolean;
    BHColor : longint;
    BWeapon : byte;
    BBonus  : byte;
    BBonT   : integer;
    BDamage : integer;

    BWaveVal: byte;
    BWaveStl: byte;
    BWaveSpd: integer;
  end;

var
  TheBot: array[0..CLASSES] of SBot;
  IGB: array[1..32] of SBot;
  BotHpLeft: array[1..32] of integer;

//********************************************************************

procedure ActivateServer();
begin                               //COPY THIS PIECE TO CREATE NEW BOT
  TheBot[1].BName   := 'Zombie';  //bot name
  TheBot[1].BHealth := 150;         //bot health (150- normal, 65- realistic)
  TheBot[1].BHPReg  := 0;           //health regeneration per second(0 to disable)
  TheBot[1].BRegLim := false;       //regeneration limited to max health(true/false)(it will stop anyway at 65000 to avoid crash)
  TheBot[1].BShowHP := false;       //show bot hp (true/false)
  TheBot[1].BHColor := $FFFF00;     //color of hp
  TheBot[1].BWeapon := 15;          //bot weapon (255 to random)
  TheBot[1].BBonus  := 255;         //bonus given to bot (255 to turn off)
  TheBot[1].BBonT   := 0;           //time to give bonus (60 - 1 sec)(0 to give bonus only at respawn)
  TheBot[1].BDamage := 1;           //damage multiplier(1 to normal damage)
                                    //
  TheBot[1].BWaveVal:= 0;          //how many bullets in on death wave(0 to turn off)
  TheBot[1].BWaveStl:= 0;           //style of bullets in wave
  TheBot[1].BWaveSpd:= 0;          //max speed of bullets in wave(speed is random value from -maxspeed to maxspeed)

  TheBot[2].BName   := 'Knifer zombie';
  TheBot[2].BHealth := 150;
  TheBot[2].BHPReg  := 0;
  TheBot[2].BRegLim := false;
  TheBot[2].BShowHP := false;
  TheBot[2].BHColor := $FFFFFF;
  TheBot[2].BWeapon := 14;
  TheBot[2].BBonus  := 0;
  TheBot[2].BBonT   := 0;
  TheBot[2].BDamage := 1;

  TheBot[2].BWaveVal:= 4;
  TheBot[2].BWaveStl:= 14;
  TheBot[2].BWaveSpd:= 6;
 
 
  TheBot[3].BName   := 'Burning zombie';
  TheBot[3].BHealth := 150;
  TheBot[3].BHPReg  := 0;
  TheBot[3].BRegLim := false;
  TheBot[3].BShowHP := false;
  TheBot[3].BHColor := $FFFFFF;
  TheBot[3].BWeapon := 15;
  TheBot[3].BBonus  := 0;
  TheBot[3].BBonT   := 0;
  TheBot[3].BDamage := 2;

  TheBot[3].BWaveVal:= 20;
  TheBot[3].BWaveStl:= 5;
  TheBot[3].BWaveSpd:= 6;


  TheBot[4].BName   := 'Mercenary';
  TheBot[4].BHealth := 200;
  TheBot[4].BHPReg  := 0;
  TheBot[4].BRegLim := false;
  TheBot[4].BShowHP := true;
  TheBot[4].BHColor := $FFFF0000;
  TheBot[4].BWeapon := 8;
  TheBot[4].BBonus  := 255;
  TheBot[4].BBonT   := 0;
  TheBot[4].BDamage := 1;

  TheBot[4].BWaveVal:= 0;
  TheBot[4].BWaveStl:= 0;
  TheBot[4].BWaveSpd:= 0;


  TheBot[5].BName   := 'Kamikaze';
  TheBot[5].BHealth := 150;
  TheBot[5].BHPReg  := 0;
  TheBot[5].BRegLim := false;
  TheBot[5].BShowHP := false;
  TheBot[5].BHColor := $FF0000;
  TheBot[5].BWeapon := 15;
  TheBot[5].BBonus  := 255;
  TheBot[5].BBonT   := 0;
  TheBot[5].BDamage := 1;

  TheBot[5].BWaveVal:= 3;
  TheBot[5].BWaveStl:= 4;
  TheBot[5].BWaveSpd:= 5;


//THIS SET WILL BE GIVEN TO ANY OTHER BOT & TO ALL PLAYERS
  TheBot[0].BName   := '';
  TheBot[0].BHealth := 0;
  TheBot[0].BHPReg  := 0;
  TheBot[0].BRegLim := false;
  TheBot[0].BShowHP := false;
  TheBot[0].BHColor := $000000;
  TheBot[0].BWeapon := 255;
  TheBot[0].BBonus  := 255;
  TheBot[0].BBonT   := 0;
  TheBot[0].BDamage := 1;

  TheBot[0].BWaveVal:= 0;
  TheBot[0].BWaveStl:= 0;
  TheBot[0].BWaveSpd:= 0;
   
end;

//********************************************************************

procedure Explode(Target: byte);
var i: byte;
begin
  for i:= 1 to IGB[Target].BWaveVal do CreateBullet(GetPlayerStat(Target,'X'),GetPlayerStat(Target,'Y'),Random(IGB[Target].BWaveSpd, -(IGB[Target].BWaveSpd)),Random(IGB[Target].BWaveSpd, -(IGB[Target].BWaveSpd)), 100, IGB[Target].BWaveStl, Target);
end;

procedure ShowHP(Target,Shooter: byte);
begin
  DrawText(Shooter, IntToStr(BotHpLeft[Target]), 180, IGB[Target].BHColor, 0.1, 260, 350);
end;

function Assignable(ID: byte): boolean;
var i: byte;
begin
  result:= false;
  for i:= 1 to CLASSES do if IDToName(ID) = TheBot[i].BName then result:= true;
  if GetPlayerStat(ID,'Human') = true then result:= false;
end;

procedure Assign(ID: Byte);
var i: byte;
begin
  for i:= 1 to CLASSES do if IDToName(ID) = TheBot[i].BName then begin
    IGB[ID] := TheBot[i];
  end;
  if not Assignable(ID) then IGB[ID]:= TheBot[0];
end;

procedure Regenerate(ID: byte);
begin
  if IGB[ID].BRegLim then begin
    if (IGB[ID].BHealth - BotHpLeft[ID]) < IGB[ID].BHPReg then BotHpLeft[ID]:= BotHpLeft[ID] + (IGB[ID].BHealth - BotHpLeft[ID]);
    if (IGB[ID].BHealth - BotHpLeft[ID]) >= IGB[ID].BHPReg then BotHpLeft[ID]:= BotHpLeft[ID] + IGB[ID].BHPReg;
  end else if BotHpLeft[ID] < 65000 then BotHpLeft[ID]:= BotHpLeft[ID] + IGB[ID].BHealth;
end;

//********************************************************************

procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);
begin
  if Assignable(Victim) then if IGB[Victim].BWaveVal > 0 then Explode(Victim);
end;

procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
//  AllHealth;
  for i:= 1 to 32 do if Assignable(i) then begin
    if (IGB[i].BBonT >= 60) and (IGB[i].BBonus <> 255) then if Ticks mod IGB[i].BBonT = 0 then GiveBonus(i, IGB[i].BBonus);
    if IGB[i].BWeapon <> 255 then if (GetPlayerStat(i, 'Primary') <> IGB[i].BWeapon) or (GetPlayerStat(i, 'Secondary') <> 255) then ForceWeapon(i, IGB[i].BWeapon, 255, 0);
    if (IGB[i].BHPReg <> 0) and (GetPlayerStat(i,'Alive')= true) then Regenerate(i);
  end;
end;

procedure OnPlayerRespawn(ID: Byte);
begin
  if Assignable(ID) then if IDToName(ID) <> IGB[ID].BName then Assign(ID);

  if Assignable(ID) then begin
    if IGB[ID].BBonus <> 255 then GiveBonus(ID, IGB[ID].BBonus);
    if IGB[ID].BWeapon <> 255 then ForceWeapon(ID, IGB[ID].BWeapon, 255, 0);
    BotHpLeft[ID]:= IGB[ID].BHealth;
  end;
end;

function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer) : integer;
begin
  Result:= Damage;
  if Assignable(Victim) then if IGB[Victim].BShowHP then ShowHP(Victim, Shooter);
  if Assignable(Shooter) then if IGB[Shooter].BDamage <> 1 then Result:= Damage*IGB[Shooter].BDamage;
  if Assignable(Victim) then if BotHpLeft[Victim] > 0 then begin
    Result:= -99999;
    if Damage < 5000 then dec(BotHpLeft[Victim],Damage) else dec(BotHpLeft[Victim],Round(Damage/75));
    if BotHpLeft[Victim] < 1 then DoDamageBy(Victim,Shooter,200);
  end;
end;