Results 1 to 3 of 3

Thread: Face away players when using spells

  1. #1
    Focus Group Spike33's Avatar
    Join Date
    Jun 2012
    Posts
    378
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    23 Post(s)
    Reputation
    55
    Rep Power
    5

    Face away players when using spells

    Been searching for this scrit now for a hour

    I know I saw it not too long ago so if any one got the link or the code saved could you please post

    Thanks

  2. #2
    Normal User
    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    1,671
    Mentioned
    18 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    8 Post(s)
    Reputation
    132
    Rep Power
    9
    Creds to sirmate
    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
    Focus Group Spike33's Avatar
    Join Date
    Jun 2012
    Posts
    378
    Mentioned
    31 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    23 Post(s)
    Reputation
    55
    Rep Power
    5
    Awesome thanks!

Posting Permissions

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