Hey, im Schokokeksrepublik, if you want some features, if you find a bug, let me know (on Github or Steam).
Feel free to contribute with pull requests. Also check out https://github.com/BOTRaiquia/dota2buttemplate_fixed
Since the Steam interface recently changed, the Workshop Tools are harder to find. Open Dota Settings-> DLCs.
Finding the necessary Dota Workhop DLC
Either you make this the default template by copying everything from addon_template_butt into addon_template of game and content (before you create yours), or you copy the files into every new mod you make. After that you can start the game inside Hammer just by clicking the "Game Controller Icon" and "Run (Skip Build)".
If you paste the template into the steam/dota folder, you can automatically create templates by clicking "Create New Addon From Existing Addon".
HOWEVER, if you auto-generate a mod, you still have to manually copy addoninfo.txt
(or add the line "maps" "dota"
into the curly braces). Otherwise it will be online with 26 different maps, of which half are not playable.
To make it readonly you have to copy the readonly_tools_asset_info.bin
file from game/addon_template
to game/addon_template_butt
.
Using the template just by doubleclicking (when its readonly)
The KV files are the files inside game/.../scripts/npc/. To modify a hero, an ability or so, copy the whole bracket section into the custom file. It works also if you delete the values, that you dont change.
Lets you add free Items, Abilities, Talents or Modifiers, that everyone gets. This is easier than adding it to everyone in the kv file.
Abilities can start with cooldown, a certain level or can be casted initially and more (as shown in the file).
Everyone gets Infest when the game starts, and cooldown is activated for 120seconds
Events that triggers at a timer. Give free Rapiers after 20 Minutes or teleport everyone to the midlane (hero:SetAbsOrigin(Vector(0,0,120))
) every 5 Minutes.
TP everyone to the midlane
You can modify some values like Damage, Heal, Gold or Experience. Keep the return true or the event will cancel (e.g. No Damage will be harmed). If you want to modify the values, for example the gold, you have change the "event.gold" value (e.g. event.gold = event.gold / 2
).
More RNG in Abilites
If you want to add a new Talents, you have to add it to the game/..../scripts/npc/npc_abilites_custom.txt , and create a file in game/..../scripts/vscripts/talents/ as like the example talent. Make sure to start the name in npc_abilites_custom.txt with "specialbonus" and the modifier file name with "modifier_specialbonus".
To add it to the heroes you put it into startitems or you edit the npc_heroes_custom.txt file for the hero. Talents are at Ability10 to Ability17 (10 is bottom right, 11 bottom left and so on).
If you want to add a new Ability, you can give it to every hero in the startitems.lua file or add it to the heroes manually inside the npc_heroes_custom.txt file. Abilites must be added into npc_abilities_custom.txt, where you put the right path to the lua script file.
Abilites can be added to the heroes inside the startitems file.
Everyone gets Infest when the game starts, and cooldown is activated for 120seconds
Modifiers are Buffs or Debuffs. The advantage of Modifiers is, that you dont have to edit the KV files, they are only in lua. If you want to use delayed stuff, they become necessary, because they have StartIntervalThink and OnIntervalThink. To use them you can use unit:AddNewModifierButt(unit, nil, modifiername, {})
, which automatically looks for it in the modifier folder. The Valve provided unit:AddNewModifier(unit, nil, modifiername, {})
can only use modifiers that are already added to the game (with LinkLuaModifier(modifiername, path, 0)
).
You can add them to some events, like entity_spawned, entity_killed, or so. Modifiers have a little odd thing, that they technically exist twice, once on the players computer and once on the server, thats maybe good to keep in mind (If you check Dota Imba in Github from EarthSalamander42, you might often see IsServer()
, thats because of the duality).
Modifiers can do stuff on a lot of events, found in the API. For that you have to add the CONSTANT in DeclareFunctions and add the function also to the .lua file. Most of the events are triggered on the whole map, not only the hero.
DeclareFunctions is great
Can be used to call event functions
Or to give bonus stats
The Loadscreen settings. Feel free to balance your game here.
Events are the main point for making Dota Mods fun. You can add a modifier on any kind of thing, for example you could cut all nearby trees every time a lasthit is made. Or you give a heal for every kill that a player makes.
At the bottom of the file you can find an example, on how to do stuff with nearby units and on how to deal Damage to a unit, here all nearby units.
Dead Heroes drop Feaareiy Fires
Cheats are for offline testing and dont work online.
-start : Starts the game with pocket money and a hero.
-mods : prints out all your modifiers to the console
-entmods : prints nearby Entities with their modifiers to the console
-abils : prints out all your abilities to the console
-entities : prints out all the Entities in the game
-- This is a comment. This means everything in the line after -- will get ignored in the code
If you have a typo in a file, the whole file may turn useless (you will see when you get red errors inside the game).
Using Sublime or Notepad++ makes it much easier.
If you have a function, e.g. function examplemodifier:OnAttackLanded(event)
, you can read the whole event on the console using:
for k,v in pairs(event) do print("OnAttackLanded:",k,v) end
Sometimes events might miss a value (like event.attacker
).
The console can be opened in Dota (depending on your key assignment) or from asset browser. Filter for "VScript".
Arrays (or tables as they are called in lua) usually start with 1, but some Dota Stuff, like PlayerIDs start with 0, since they originally come from the C++ hardcode of Dota.
A lua table, e.g. local herovalues = { antimag = 12, centaur = 5 }
can be accessed (or values can be added) with herovalues.antimag
(=12) or heorovalues["antimag"]
. This means if you have a variable (local playerID = 5
), using the brackets will dissolve the variable (herovalues[playerID]
equals herovalues[5]
). Numerial entries can be initiated like local bestfood = { [1]="peppers", [2]="meat" }
.
If a variable has no value, it is nil
and acts like false. (So you can do if (test) then
... instead of if (test~=nil)
).
If a function gets not enough parameters, it fills up with nil (asd:whtvr(hero,nil)
equals to asd:whtvr(hero)
).
This hero:GetLevel()
equals to hero.GetLevel(hero)
. if (hero.GetLevel) then test = hero:GetLevel() end
or shorter: test = hero.GetLevel and hero:GetLevel() or test
end can be used to ensure this function exists.
If you get errors inside a modifier function, try to set if IsClient() then return end
as the first line inside the function.
Creeps actually dont spawn at 00:00, 00:30 and so on, they spawn earlier and get teleported to the spawn after.
Lua API : https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/API
(Important Sections: CDOTA_BaseNPC, CDOTA_BaseNPC_Hero, PlayerResource and the very Bottom with the CONSTANTS) (I spent a lot of time here, use CTRL+F and type "setgold" or so)
Built-In Modifiers: https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Built-In_Modifier_Names (some are broken if used manually)
Built-In Abilities: https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Built-In_Ability_Names
How can i code a blademail/ fury swipes/ whatever on my own? Look here (Intermediate level): Dota Imba: https://github.com/EarthSalamander42/dota_imba/tree/master/game/dota_addons/dota_imba_reborn/scripts/vscripts/components
Volvo Recipe for lua Ability/Modifier: https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Lua_Abilities_and_Modifiers
Volvo Recipe for Game Events: https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Listening_to_game_events
Volvo Recipe for Thinker: https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/ThinkerFunctions
Being done from Hammer, you can add and delete stuff (trees), alter the heights inside the map, move the spawnpoints or waypoints of creeps. If you edit the object properties you also can add trigger events, for example on a Roshan kill or so.