Skip to content

Instantly share code, notes, and snippets.

@pohka
pohka / dummy_unit
Last active April 29, 2020 19:23
Dummy unit for dota 2 custom game using kv files. Add these values to npc_units_custom.txt and npc_abilities_custom.txt
------------------------
npc_units_custom.txt
------------------------
"dummy_unit"
{
// General
//
"BaseClass" "npc_dota_creep_neutral"
"Model" "models/development/invisiblebox.vmdl"
"SoundSet" "Creep_Good_Range"
@pohka
pohka / custom_timer.lua
Last active April 27, 2020 13:23
custom time for dota custom games
if CAddonTemplateGameMode == nil then
CAddonTemplateGameMode = class({})
end
--global time value
_G.time = 0
-- Create the game mode when we activate
function Activate()
@pohka
pohka / iteration.cpp
Last active December 30, 2018 20:21
C++ iteration
std::string str;
//slow
for(unsigned int i=0; i<str.size(); i++)
//slow
for (auto it = str.begin(); it != str.begin(); it++)
//mega fast
for(char& ch : str)
@pohka
pohka / quick_dota_setup.lua
Created December 12, 2018 12:57
Dota custom games quick setup to skip right to the game mode 0:00
function MyCustomGame:InitGameMode()
--skip all the starting game mode stages e.g picking screen, showcase, etc
GameRules:EnableCustomGameSetupAutoLaunch(true)
GameRules:SetCustomGameSetupAutoLaunchDelay(0)
GameRules:SetHeroSelectionTime(0)
GameRules:SetStrategyTime(0)
GameRules:SetPreGameTime(0)
GameRules:SetShowcaseTime(0)
GameRules:SetPostGameTime(5)