Results 1 to 3 of 3

Thread: attack the monster

  1. #1
    Banned
    Join Date
    Apr 2012
    Location
    Poland, Zambrów
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    0

    attack the monster

    Anyone know how to make a script that will make it easier to attack the nearest monster?

    not know how to combine the functions.
    PHP Code:
    getcreatures(m).isreachable 
    and
    PHP Code:
    getcreatures(m).dist 
    and
    PHP Code:
    getcreature(m).name 
    I need a script to check that the monster is the closest and attacked him. Monster must be reachable

    ty for help

  2. #2
    Banned
    Join Date
    Apr 2012
    Location
    Poland, Zambrów
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    0
    how to unpack table in CREATURE_NAME ?

    i make this, is correct ?

    Code:
    local c = getcreatures("ms")
    local monster = {"Dragon", "Demon", "Dragon Lord"}
    
    for i = 0, c.count - 1 do
        local m = c[i]
        local dist = math.max(math.abs(posx - m.x), math.abs(posy - m.x))
    
        if dist <= MINIMUM_DISTANCE and m.name:lower() == (unpack(monster)):lower() and target.id ~= m.id then
            attack(m.name)
        end
    end

  3. #3
    Banned
    Join Date
    Apr 2012
    Location
    Poland, Zambrów
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    0
    i make it this.

    Code:
    local c = getcreatures("ms")
    local monsters = {"dragon", "demon", "dragon lord"}
    
    for i = 0, c.count - 1 do
    for k = 1, #monsters do
        local m = c[i]
        local dist = math.max(math.abs(posx - m.x), math.abs(posy - m.x))
        if dist <= 3 and m.name:lower() == (monsters[k]):lower() target.id ~= m.name then
            attack(m.name)
        end
    end
    end
    but this action working alltime. changing target. if i hace 2 monster or more around yourself bot changing target.
    how i can stop this ?
    Last edited by laskos6989; 12-26-2012 at 06:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •