McDota icon indicating copy to clipboard operation
McDota copied to clipboard

Lua Execution

Open Otacon-404 opened this issue 4 years ago • 5 comments

is there an example of how to use the Lua Execution

Otacon-404 avatar Nov 17 '20 12:11 Otacon-404

I am looking too. I have not seen any examples about this.

hexvalid avatar Nov 17 '20 13:11 hexvalid

https://github.com/LWSS/McDota/issues/41

LWSS avatar Nov 17 '20 13:11 LWSS

so will something like this works ?

for i = 1, Heroes.Count() do
        local hero = Heroes.Get(i)
        local name = NPC.GetUnitName(hero)
        if not heroList[name] and not NPC.IsIllusion(hero) then
            heroList[name] = hero
        end
    end

Otacon-404 avatar Nov 17 '20 16:11 Otacon-404

    print( "[ ---> CHEAT SCRIPT LOAD SUCCESS <--- ]" )
     
    print( "[CHEAT]: MAP: " .. GetMapName() )
     
    if GameRules ~= nil then
    	print( "[CHEAT]: GameRules:GetGameTime: " .. GameRules:GetGameTime() )
    end
     
    if IsClient() then
    	print( "[CHEAT]: IsClient" )
    end
     
    if IsDedicatedServer() then
    	print( "[CHEAT]: IsDedicatedServer" )
    end
     
    if IsServer() then
    	print( "[CHEAT]: IsServer" )
    end
     
    if IsInToolsMode() then
    	print( "[CHEAT]: IsInToolsMode" )
    end
     
    if Entities ~= nil then
    	print( "[CHEAT]: Entities ok" )
    end
     
    if HeroList ~= nil then
    	print( "[CHEAT]: HeroList ok" )
    end
     
    if PlayerResource ~= nil then
    	print( "[CHEAT]: PlayerResource ok" )
    end
     
    if ParticleManager ~= nil then
    	print( "[CHEAT]: ParticleManager ok" )
    end
     
    if ConVars ~= nil then
    	print( "[CHEAT]: ConVars ok" )
    end
     
    if CustomGameEventManager ~= nil then
    	print( "[CHEAT]: CustomGameEventManager ok" )
    end
     
    if CustomNetTables ~= nil then
    	print( "[CHEAT]: CustomNetTables ok" )
    end
     
    if Tutorial ~= nil then
    	print( "[CHEAT]: Tutorial ok" )
    end
     
    function npc_spawned( event )
    	
    	if EntIndexToHScript ~= nil and event ~= nil then
    	
    		local spawnedUnit = EntIndexToHScript( event.entindex )
    		
    		if spawnedUnit ~= nil then
    			print( "[CHEAT]: npc_spawned:spawnedUnit" )
     
    			if spawnedUnit:IsHero() then
    				print( "[CHEAT]: npc_spawned:IsHero" )
    			end
    			
    			if spawnedUnit:IsRealHero() then
    				print( "[CHEAT]: npc_spawned:IsRealHero" )
    			end
    			
    		end
    		
    	end
    	
    	print( "[CHEAT]: npc_spawned" )
    end
     
    ListenToGameEvent("npc_spawned",npc_spawned,nil)
     
    DebugDrawScreenTextLine(150,50,1,"dota 2 easy hack",0,255,0,255,60.0)

Here is bazinga.lua from when I tested (not my lua code)

LWSS avatar Nov 17 '20 17:11 LWSS

thank you

Otacon-404 avatar Nov 17 '20 17:11 Otacon-404