Axe Culling Blade Prompt 1.2

This is a discussion on Axe Culling Blade Prompt 1.2 within the Warcraft 3 Lua Scripts board part of the Warcraft 3 forum category; Code: local myHero = 0 local heroes = {} local _plugin = nil function OnGameStarted() Game.WriteText("|CFF8989DE" .. _plugin:GetName() .. " ...

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Sosha's Avatar
    Sosha is offline :)



    Array
    Join Date
    Oct 2011
    Location
    Iran
    Posts
    489
    Mentioned
    21 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    946

    Axe Culling Blade Prompt 1.2

    Code:
    local myHero = 0
    local heroes = {}
    local _plugin = nil
     
    function OnGameStarted()
        Game.WriteText("|CFF8989DE" .. _plugin:GetName() .. " " .. _plugin:GetVersion() .. "|R has been successfully loaded.", FRAME.MESSAGE, 10)
    end
    
    function OnEnterLoading()
        table.clear(heroes)
    end
    
    function OnGameTick()
        if (Game.IsInGame(false) ~= true) then
            return
        end
        
        if myHero == 0 then return end
        
        local iUnitTypeID = Jass.GetUnitTypeId(myHero)
    
        if iUnitTypeID == 1332766568 then -- Our hero is Axe
            AxeCullingBladePrompt()
        end
        
        Sleep(1000)
    end
    
    function SetUnitX_Pre(unit, newX)
        local hType = Jass.ConvertUnitType(0) -- Hero
        local bIsHero = Jass.IsUnitType(unit, hType)
        
        if bIsHero == false then return nil end
        
        local owningPlayer = Jass.GetOwningPlayer(unit)
        local localPlayer = Jass.GetLocalPlayer()
    
        if owningPlayer == localPlayer  then
            myHero = unit
        else
            if not table.contains(heroes, unit) then
                table.insert(heroes, unit)
            end
        end
        
        return nil
    end
    
    function AxeCullingBladePrompt()
        local heroX = 0
        local heroY = 0
        local threshold = 0
        local unitLife = 0
        
        local levelWithoutAghanim = Jass.GetUnitAbilityLevel(myHero, 1093682482)
        local levelWithAghanim = Jass.GetUnitAbilityLevel(myHero, 1093750098)
    
        if levelWithoutAghanim == 0 and levelWithAghanim == 0 then return end
        
        if levelWithoutAghanim > 0 then
            if levelWithoutAghanim == 1 then threshold = 250
            elseif levelWithoutAghanim == 2 then threshold = 325
            elseif levelWithoutAghanim == 3 then threshold = 400 end
        elseif levelWithAghanim > 0 then
            if levelWithAghanim == 1 then threshold = 300
            elseif levelWithAghanim == 2 then threshold = 425
            elseif levelWithAghanim == 3 then threshold = 550 end
        end
        
        for _, hero in pairs(heroes) do
            if Jass.IsUnitAlly(hero, Jass.GetLocalPlayer()) == true then goto continue end
            unitLife = Jass.GetUnitState(hero, Jass.ConvertUnitState(0))
            
            if unitLife <= threshold then
                heroX = Jass.GetUnitX(hero)
                heroY = Jass.GetUnitY(hero)
            
                Jass.PingMinimap(heroX, heroY, 1)
                Jass.SetUnitVertexColor(hero, 255, 0, 0, 255)
            else
                Jass.SetUnitVertexColor(hero, 255, 255, 255, 255)
            end
            
            ::continue::
        end
    end
    
    function table.contains(table, element)
        for _, value in pairs(table) do
            if value == element then
                return true
            end
        end
        return false
    end
    
    function table.clear(table)
        for k in pairs (table) do
            table[k] = nil
        end
    end
    
    function Initialize(plugin)
        plugin:SetName("Axe Culling Blade Prompt")
        plugin:SetVersion("1.2")
        plugin:SetAuthor("Shahriyar")
        plugin:SetDescription("Lua Engine Sample Plugin")
        
        plugin:RegisterGameEvent(EVENT.GAME_STARTED, "OnGameStarted")
        plugin:RegisterGameEvent(EVENT.ENTER_LOADING, "OnEnterLoading")
        plugin:RegisterGameEvent(EVENT.GAME_TICK, "OnGameTick")
        plugin:RegisterNativeHook("SetUnitX", "SetUnitX_Pre", "")
        
        _plugin = plugin -- We are storing this for later use
    end
    Note: This plugins exists in the WLE package.

    Attached Files
    Last edited by Sosha; 06-28-2015 at 09:31 AM.

  2. The Following User Says Thank You to Sosha For This Useful Post:


  3. #2
    ehsan...p is offline Addict
    Array
    Join Date
    Feb 2013
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    ty, but what is this? plz describe it? i just know this is a plugin for lua engine but i don't know what is effect on dota? after copy this file what i see in game? do you understand? (sory for bad English writing )

  4. #3
    Sosha's Avatar
    Sosha is offline :)



    Array
    Join Date
    Oct 2011
    Location
    Iran
    Posts
    489
    Mentioned
    21 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    946
    Quote Originally Posted by ehsan...p View Post
    ty, but what is this? plz describe it? i just know this is a plugin for lua engine but i don't know what is effect on dota? after copy this file what i see in game? do you understand? (sory for bad English writing )
    When you pick axe in dota you will be notified when you can kill someone with your ultimate (Culling Blade)
    It pings minimap on their current locations and changes their color to red.

  5. #4
    Sosha's Avatar
    Sosha is offline :)



    Array
    Join Date
    Oct 2011
    Location
    Iran
    Posts
    489
    Mentioned
    21 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    946
    Updated to 1.1

  6. #5
    DiabloTheOG is offline Newbie
    Array
    Join Date
    Dec 2015
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    Hm... I am new to LUA and im not understanding how this plugin is supposed to work and where it goes

  7. #6
    logic2 is offline Newbie
    Array
    Join Date
    Mar 2009
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    I love the idea of lua and start to script a bit. How could I update this script so it does not "spam" the ping, but does it only 1 time? So I want to store/Save it for each hero until he is dead or above X HP again ...

  8. #7
    ehsan...p is offline Addict
    Array
    Join Date
    Feb 2013
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    how can i create lua scripts for auto cast multi skill
    Last edited by ehsan...p; 06-15-2016 at 03:14 PM.

  9. #8
    ehsan...p is offline Addict
    Array
    Join Date
    Feb 2013
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    @Sosha @tricky @anyone that have skill in lua warcraft
    i have question:
    what is sleep(1000) in your script??
    and how can i find it for another hero??

  10. #9
    ehsan...p is offline Addict
    Array
    Join Date
    Feb 2013
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0
    it seams sosha don't want to help us and developing lua engine?!

  11. #10
    Tracky's Avatar
    Tracky is offline Administrator

    Array
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9,831
    Mentioned
    148 Post(s)
    Tagged
    2 Thread(s)
    Rep Power
    41
    Reputation
    5582
    Quote Originally Posted by ehsan...p View Post
    @Sosha @tricky @anyone that have skill in lua warcraft
    i have question:
    what is sleep(1000) in your script??
    and how can i find it for another hero??
    Sleep(1000) is a command to make the script "pause" at the respective position for 1000 milliseconds (= 1 second).

Page 1 of 2 12 LastLast

Similar Threads

  1. Free Steam Game Key: Culling of the Cows
    By Justin in forum Freebies
    Replies: 0
    Last Post: 05-28-2015, 04:26 AM
  2. FREE STEAM KEY. The Culling Of The Cows
    By MaphackUser in forum Freebies
    Replies: 0
    Last Post: 11-08-2014, 09:57 AM
  3. How to use Command Prompt at school
    By snocher in forum Operating Systems
    Replies: 0
    Last Post: 10-27-2009, 05:15 PM
  4. Starting Off With MS-DOS Prompt
    By Hallowsend in forum Development
    Replies: 6
    Last Post: 02-11-2008, 09:55 PM
  5. [TUT] [WIN] Command Prompt
    By Kalbintion in forum Development
    Replies: 6
    Last Post: 01-30-2008, 09:04 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
  •