Quick Questions Thread

edited May 2016 in Questions
  • Got a question that doesn't deserve a thread on its own?
  • Ashamed of asking 1 line problems you can't resolve?
  • Too lazy/busy to join the Chat or download an IRC Client?

Search no more: this is your thread.

Ask away!

The concept of Modding Community doesn't go well together with Competitive Business
My Project Page || My GitHub Profile ||

«13456740

Comments

  • Posts: 213

    Well I'll kick things off: Is there a way to add modifiers to unit definitions in npc_units_custom.txt through a "Modifiers" or "AddModifiers" block somehow?

  • edited February 2016 Posts: 31

    I have an ability with a simple modifier of making the unit have an unselectable state. The ability is added to the unit and becomes unselectable but when I remove it, it stays unselectable. Why is this?

    Thanks, the RemoveModifierByName worked.

  • Vyrus -

    Give the unit an ability that has a modifier with "Passive" "1"

    That's how I automatically apply modifiers to specific units.

    cakecake -

    maybe when you remove the ability, the modifier sticks. Try also doing unit:RemoveModifierByName("modifier_name") and see if that works

  • edited February 2016 Posts: 1,668

    @vyrus: no but you can make a custom KV system that handles that, so you would just add "Modifiers" { "1" "modifier_blarg" } then have OnNPCSpawned read that (from LoadKeyValues) and apply one by one (if its lua modifier you'll need AddNewModifier, otherwise just the good old item datadriven applier). But its generally easier to just do a passive ability that holds the modifiers that need to be added, and if its a npc_dota_creature it will be added on spawn.

    @cakecake: Passive Modifiers always stays after a RemoveAbility call, its annoying but the only way around it it's either hardcoding what you need to remove, or again just checking if the ability had any "Passive" "1" modifiers associated with it (see LoadKeyValues magic again)

    Also, I'll change the title to Quick instead of Stupid questions :laughing:

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited February 2016 Posts: 44

    What is IsServer() or why should I not put it at the start of every function? I assumed that Lua scripts only executed on the server. I've not run into problems testing with other people though, and the only place I've seen it used on the Wiki is for Lua modifiers.

  • edited February 2016 Posts: 213

    @ChalkyBrush @Noya thanks, those are both good options. I'd considered doing a passive ability (I guess it can just be hidden). I was a little bit worried about using up ability slots, although you get 8(?) or so to play around with, so that's not really a big deal. Still, I'll probably look at doing a side-along KV file, since I have some other data I'd like to include, unless you can add random variables straight into npc_units_custom without having the game break. If that IS the case, I might just use a boolean for each modifier and parse it during the unit creation function in lua.

  • Posts: 1,668

    @H3katonkheir IsServer() is only required inside ability_lua scripts and lua modifiers. It's used to prevent running into problems with client-server difference (because the clients know less things than the server). In datadriven RunScripts, the lua functions only execute on the server.

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • @Noya Thank you, that's a great explanation.

  • Posts: 213

    Can I use a class I've created as a BaseClass for another class, or am I restricted to classes that :valve: provide?

  • Posts: 45

    Is it possible to manipulate modifier's tooltip with lua code? or retrieve the value of a variable that is set inside a lua code in the addon_english.txt KVs?

  • Posts: 1,668

    @vyros: basically no, BaseClass offers no inheritance to us.

    @zakt4n: There's :OnTooltip which executes only clientside, tied to MODIFIER_PROPERTY_TOOLTIP entries can be used to somewhat manipulate the numbers on the tooltip (to show things like dynamic stacks)

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited February 2016 Posts: 22

    Is the best way to do an immediate follow up attack like Legion Commander's passive creating a modifier on the caster with very high bonus attack speed and removing it on attack?

    Edit: Don't want Weaver's geminate attack style.

  • Posts: 5

    How can i put a custom unit to respawn after get killed and just respawn if it was killed, in the same place where i put it on the map? There is a thread about it? I didnt saw any thread specific with it, sorry i am new in programming =x.

  • Posts: 1,668

    @Etiel for units (not heroes), you basically check everytime they are about to take damage and set them hidden+invulnerable+stunned. lua Example here with datadriven modifiers

    It's also possible to just create a new unit and forget about the old one. This can be easier but can have troubles if you need to replicate many of the creep's properties after respawn.

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • Posts: 5

    Thank you very much, I'll try this. But the monster will give bounty normally? Sorry, but it's looks like a reincarnation skill from Skeleton King xD.

  • Posts: 213

    If you follow that method, you're preventing the creep from ever being killed and just hiding it instead, therefore no bounty will be given. If you want the bounty, you'd apply it manually when you're doing the reincarnation.

  • Posts: 5

    I see, thanks.

  • Is there a way to hide the damage that shows up in red next to the hero?

  • How would you make an ability that exchanged the inventory and stash? I tried this http://pastebin.com/ydBNqdsS

    but items end up getting lost and using an item ability causes a game crash.

  • Can I assume there is no "easy-ish" way (if any) to make a Panorama version of Dota's (Scaleform) unit/hero/selection portrait? Thanks :smile:

  • Posts: 39

    Are there more than 12 inventory slots? I am trying to make an ability (https://github.com/Darthseid/heroes_playground/blob/master/scripts/vscripts/stash_exchange_function.lua) that exchanges stash with hero inventory but it causes a weird state with hidden items boosting stats.

  • edited March 2016 Posts: 130

    Hi everybody, im new to modding dota 2, please help me , i have a problem, i modify a hero , giving it custom lua ability but the ability didnt show up in game for my hero, i dont understand why can anyone help me fix that

    npc_heroes_custom.txt : https://codeshare.io/35PEU

    npc_abilities_custom.txt : https://codeshare.io/Rcj2U

    And in each ability lua file in vscript is one line of code which define the ability

    skill_firegod_firefinger_lua = class({})

    skill_firegod_firewall_lua = class({})

    skill_firegod_firestorm_lua = class({})

  • Posts: 1,668

    @lucifekit Quotation errors in lines 15 44 and 73

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited March 2016 Posts: 130

    Thank you @Noya, i fixed it.

    I run into another problem, my lua ability show the effect only if the effect is belong to chosen hero, i cannot use other hero particle even if i precache them :(

    Example i override nevermore hero skill

    "precache"
            {
                "particle_folder"               "particles/units/heroes/hero_jakiro"
                "particle"                      "particles/units/heroes/hero_jakiro/jakiro_macropyre.vpcf"
            }
    

    my lua file (Very long, make new thread)

    And my projectile dont move for no reason :(

  • Posts: 1,668

    This is for quick questions, not -post your entire code here-. Make a new thread

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited March 2016 Posts: 130

    When i test my map, the game automatically close without any error in V-console, so i dont know where my mistake is, can i do anything to figure out where is my error?

    By the way, each time my game crash, i have to start workshop tool again, it open asset browser, i have to click open hammer, click open map, click build map, is there shorter way to have my map open in game without open hammer, open map and build ?

  • Posts: 1,668

    dota_launch_custom_game ADDON_NAME MAP_NAME

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • edited March 2016 Posts: 130

    Can you explain more, i created a shortcut to desktop which path is :

    "C:\Games\Steam\steamapps\common\dota 2 beta\game\bin\win64\dota2cfg.exe" -addon MyAddon
    

    And change it to

    "C:\Games\Steam\steamapps\common\dota 2 beta\game\bin\win64\dota2cfg.exe" -addon MyAddon-dota_launch_custom_game MyAddon
    

    But it's not working.

    And another question : What is the "others" target type? I means when i use paronama javascript to order my unit use ability on a neutrals creep, it not work and say :

    [   Developer            ]: Client tried to execute invalid order (48). Can't cast on target, ability cannot target 'others'.
    

    My ability have those behavior :

    "AbilityBehavior"       "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_POINT"
        "AbilityUnitTargetTeam"     "DOTA_UNIT_TARGET_TEAM_BOTH"
        "AbilityUnitTargetType"     "DOTA_UNIT_TARGET_ALL"
    
  • edited March 2016 Posts: 213

    It's a console command. Type dota_launch_custom_game <addon name> <map name> into vconsole from the main menu (or anywhere else in the client), and it'll launch your game.

    As far as help debugging a crash, it's either a problem with the map, lua code, or data-driven key value files (although this one isn't likely, since it'll tell you if there's a mistake in those).

    I'm not really sure how to debug the map, but you could try removing entities that might be problematic.

    For lua you should add print("unique message #x") lines (or something like that) throughout your code and see how many print out before the crash occurs. From there, just keep doing that but on a narrower scope until you've located the line causing the crash.

  • edited March 2016 Posts: 130

    Ok, thank u vyrus, and how about the spell target problem, i figure out that any other heroes's ability cannot target the creep i create with lua too, but can target the creep i put in map with hammer, so can u tell me what i am wrong here?

    I create creep with this :

    CreateUnitByName("npc_unit_level_1", Vector(0,0,0), true, nil, nil,DOTA_TEAM_NEUTRALS)
    

    And vconsole show yellow message :

    [ W General              ]: Unknown Team Name during parse! (DOTA_TEAM_NEUTRAL)
    

    Figured it out too, in my unit_custom my creep team was DOTA_TEAM_NEUTRAL missing a "s", i fixed it and it worked like a charm:D

    And one more, your base unit should be npc_dota_creature not npc_dota_base_additive like a dummy unit