Results 1 to 4 of 4

Thread: Turn if player infront of you?

  1. #1
    iBot User ronnblad's Avatar
    Join Date
    Aug 2012
    Location
    Sweden
    Posts
    121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    11
    Rep Power
    5

    Unhappy Turn if player infront of you?

    hello i remember that i never had a problem with getting skulled when i used neobot, i also remember that i used some sort of script that turned my character away if there was some player that tryed to get me skulled, does some one know if this script exists on Ibot to?
    I relly need that script.
    Thanks.

  2. #2
    Normal User sirmate's Avatar
    Join Date
    Mar 2012
    Location
    Poland
    Posts
    176
    Mentioned
    2 Post(s)
    Tagged
    3 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    105
    Rep Power
    6
    Code:
    local function isPlayerOnTile(POSITION_X, POSITION_Y, POSITION_Z)
        local TILE_DATA = gettile(POSITION_X, POSITION_Y, POSITION_Z)
        
        for CURRENT_INDEX = 0, TILE_DATA.count - 1 do
            if (TILE_DATA.items[CURRENT_INDEX].id == 99 and TILE_DATA.items[CURRENT_INDEX].count <= 0x40000000) then
                return true
            end
        end
        
        return false
    end
    
    if (30 >= target.hppc and target.id > 0 and paround(4) > 0) then
        local POSITIONS, FREE_DIRECTIONS = {{X = 0, Y = -1, DIR = [[n]]}, {X = 1, Y = 0, DIR = [[e]]}, {X = 0, Y = 1, DIR = [[s]]}, {X = -1, Y = 0, DIR = [[w]]}}, {}
            
        if (isPlayerOnTile(posx + POSITIONS[getcreature(id).direction + 1].X, posy + POSITIONS[getcreature(id).direction + 1].Y, posz)) then
            for _, POSITION in ipairs(POSITIONS) do
                if (not isPlayerOnTile(posx + POSITION.X, posy + POSITION.Y, posz)) then
                    table.insert(FREE_DIRECTIONS, POSITION.DIR)
                end
            end
            
            if(#FREE_DIRECTIONS > 0) then
                local TURN_DIRECTION = FREE_DIRECTIONS[math.random(#FREE_DIRECTIONS)]
    
                while ((({[[n]], [[e]], [[s]], [[w]]})[getcreature(id).direction + 1]) ~= TURN_DIRECTION) do
                    turn(TURN_DIRECTION) wait(25, 75)
                end
            end
        end
    end
    (๏̯͡๏ )

  3. #3
    iScripter Eli's Avatar
    Join Date
    Mar 2012
    Posts
    3,764
    Mentioned
    492 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    955 Post(s)
    Reputation
    586
    Rep Power
    10
    nvm :P short:

  4. #4
    iBot User ronnblad's Avatar
    Join Date
    Aug 2012
    Location
    Sweden
    Posts
    121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    11
    Rep Power
    5
    Quote Originally Posted by sirmate View Post
    Code:
    local function isPlayerOnTile(POSITION_X, POSITION_Y, POSITION_Z)
        local TILE_DATA = gettile(POSITION_X, POSITION_Y, POSITION_Z)
        
        for CURRENT_INDEX = 0, TILE_DATA.count - 1 do
            if (TILE_DATA.items[CURRENT_INDEX].id == 99 and TILE_DATA.items[CURRENT_INDEX].count <= 0x40000000) then
                return true
            end
        end
        
        return false
    end
    
    if (30 >= target.hppc and target.id > 0 and paround(4) > 0) then
        local POSITIONS, FREE_DIRECTIONS = {{X = 0, Y = -1, DIR = [[n]]}, {X = 1, Y = 0, DIR = [[e]]}, {X = 0, Y = 1, DIR = [[s]]}, {X = -1, Y = 0, DIR = [[w]]}}, {}
            
        if (isPlayerOnTile(posx + POSITIONS[getcreature(id).direction + 1].X, posy + POSITIONS[getcreature(id).direction + 1].Y, posz)) then
            for _, POSITION in ipairs(POSITIONS) do
                if (not isPlayerOnTile(posx + POSITION.X, posy + POSITION.Y, posz)) then
                    table.insert(FREE_DIRECTIONS, POSITION.DIR)
                end
            end
            
            if(#FREE_DIRECTIONS > 0) then
                local TURN_DIRECTION = FREE_DIRECTIONS[math.random(#FREE_DIRECTIONS)]
    
                while ((({[[n]], [[e]], [[s]], [[w]]})[getcreature(id).direction + 1]) ~= TURN_DIRECTION) do
                    turn(TURN_DIRECTION) wait(25, 75)
                end
            end
        end
    end
    THANK YOU SIRMATE! i will test this out as soon as possible

Posting Permissions

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