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() .. " ...
Note: This plugins exists in the WLE package.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
Last edited by Sosha; 06-28-2015 at 09:31 AM.
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 )
Updated to 1.1
Hm... I am new to LUA and im not understanding how this plugin is supposed to work and where it goes
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 ...
how can i create lua scripts for auto cast multi skill
Last edited by ehsan...p; 06-15-2016 at 03:14 PM.
it seams sosha don't want to help us and developing lua engine?!