Git Product home page Git Product logo

addon_template_butt's Introduction

Hi

Hey, im Schokokeksrepublik, if you want some features, if you find a bug, let me know (on Github or Steam).

Whats new

First of all, after some crashing and so on, i started everything from scratch again. New stuff is: Timers, Talents, example Modifier, example Ability, Startitems, Thinker, so basically the files you find inside game/dota_addons/addon_template_butt/scripts/vscripts/. Also we have cheats.

Use This Template

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)".

KV Files

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.

Startitems

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

Thinker

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

Filters

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

Talents

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 "special_bonus_" and the modifier file name with "modifier_special_bonus_".

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).

Abilities

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

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

Settings

The Loadscreen settings. Feel free to balance your game here.

Events

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

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

Lua Tipps

-- 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 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 become teleported to the spawn after.

Links

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

Map Editing

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.

addon_template_butt's People

Contributors

schokokex avatar pr0crustes avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.