Tibia Brasil

www.tibiabrazil-blog.blogspot.com


    Atack Tal Monstro Primeiro

    Compartilhe
    avatar
    ADM Altair Junior
    Admin

    Mensagens : 73
    Data de inscrição : 13/05/2009
    Idade : 25

    Atack Tal Monstro Primeiro

    Mensagem  ADM Altair Junior em Dom Mar 14, 2010 1:28 pm

    Const
    Name=['Dragon Lord', 'Dradon', 'Fire Devil'];
    SwitchAt=30;// the % of the current attacked monster
    //that if the monster has lass % hp than this, we Will NOt change to the stronger monster.
    function GetPlace(st:string):integer;
    var
    x:integer;
    begin
    Result:=1000;
    for x:=Low(Name) To High(Name) do
    begin
    if Name[x]=st then
    Result:=x;
    end;
    end;

    function GetCreatureByID(ID: integer): TCreature;
    var
    x: integer;
    begin
    Result := nil;
    for x := 0 to Creatures.Count - 1 do
    begin
    if x >= Creatures.Count then Break;
    if Creatures.Creature[x].ID = ID then
    begin
    Result := Creatures.Creature[x];
    Exit;
    end;
    end;
    end;

    function IsCreatureBesideYou(c: TCreature): boolean;
    begin
    UpdateWorld;
    Result := False;
    if (abs(c.X-self.X) <= 4) and (abs(c.Y-self.Y) <= 4) then begin
    if c.Z = self.Z then begin
    Result := True;
    end;
    end;
    end;

    var
    x:integer;
    b:boolean;
    begin
    while not terminated do
    begin
    b:=false;
    updateworld;
    If (Self.Attacking<>0) then
    begin
    Creature:=GetCreatureByID(Self.Attacking);
    if Creature<>nil then
    if SwitchAt<Creature.Health then
    begin
    for x := 0 to Creatures.Count - 1 do
    begin
    updateworld;
    if b then break;
    if x >= Creatures.Count then Break;
    if Creatures.Creature[x].NPC then
    if Creatures.Creature[x].z=self.z then
    if Creatures.Creature[x].Name<>self.name then
    if Creatures.Creature[x].Attacking = false then
    if IsCreatureBesideYou(Creatures.Creature[x]) then
    if GetPlace(Creature.Name)>GetPlace(Creatures.Creature[x].Name) then
    begin
    sleep(100);
    updateworld;
    Creatures.Creature[x].attacking:=true;
    B:=true;
    end;
    end;
    end;
    end;
    Sleep(100);
    end;
    end;

    Legenda:
    Vermelho: Altere os nomes e as ordens dos bixos a seu gosto

    Download

    Megaman9

    Mensagens : 148
    Data de inscrição : 05/11/2011

    Re: Atack Tal Monstro Primeiro

    Mensagem  Megaman9 em Ter Nov 08, 2011 2:00 pm



    Pagina Ownada !!!


    Pixel lfie by zeruel[ pixellife.foro.bz/forum]

      Data/hora atual: Qua Jun 28, 2017 12:40 am