make people start with X skillpoints in datadriven

how can i do that?

Comments

  • Posts: 1,670

    You can't. Just do it on lua its SetAbilityPoints

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

  • where do i exactly put that? in my addon gamemode?

  • and if i put it in my addon_gamemode? where do i put it there?

  • Posts: 1,670

    Read on Lua scripting. Check barebones.

    You want to have it on your game mode's handler for picked heroes or hero in game.

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

  • is there anyway i can just start with all abiliities at max level?

  • Posts: 1,670

    Yes that takes just a couple of lines in lua.

    When your hero gets picked:

    for i=0,15 do
        local ability = hero:GetAbilityByIndex(i)
        if ability then
            ability:SetLevel(ability:GetMaxLevel())
        end
    end
    

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

  • Okay,can you give me the link to the barebones file?

  • AshAsh
    edited July 2015 Posts: 14

    https://github.com/bmddota/barebones

    Check the tools tab at the top of the page for a bunch of resources to help you get started.

  • events.lua is where i put the code above?

  • edited July 2015 Posts: 77
    function GameMode:OnNPCSpawned(keys)
    for i=0,15 do
        local ability = hero:GetAbilityByIndex(i)
        if ability then
            ability:SetLevel(ability:GetMaxLevel())
        end
    end
    

    What am i doing wrong here?

  • edited July 2015 Posts: 858
    function GameMode:OnNPCSpawned(keys)
        for i=0,15 do
            local ability =  EntIndexToHScript(keys.entindex):GetAbilityByIndex(i)
            if ability then
                ability:SetLevel(ability:GetMaxLevel())
            end
        end
    end
    

    indentationmatters

    MAKE CUSTOM GAMES GREAT AGAIN

    Finished-
    kv checker - https://arhowk.github.io
    panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

    My pet project This Cursed World/Crestfallen (name pending)
    https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest

  • Posts: 1,670

    Do it OnHeroInGame with the hero handle directly

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

  • @Arhowk pretty sure it was something like that but didn't know what it would be @noya can you give me the code directly?

  • Posts: 1,670

    You have to learn a bit from the examples given, if I just code it for you then you won't learn.

    Add the leveling up of skills in OnHeroInGame, it is inside the gamemode.lua on barebones: https://github.com/bmddota/barebones/blob/source2/game/dota_addons/barebones/scripts/vscripts/gamemode.lua#L81-L97

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

  • @Noya

    function GameMode:OnHeroInGame(hero)
        for i=0,15 do
            local ability =  EntIndexToHScript(keys.entindex):GetAbilityByIndex(i)
            if ability then
                ability:SetLevel(ability:GetMaxLevel())
            end
        end
    end
    

    This doesn't seem to work, put it in the events.lua file. and it doesn't work still, Can you tell me what is actully wrong?

  • Posts: 1,670

    Of course that doesn't work, you are trying to get the keys.entindex on a function that has no reference to that. It should be hero:GetAbilityByIndex(i)

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

  • function GameMode:OnHeroInGame(hero)
        for i=0,15 do
            local ability = hero:GetAbilityByIndex(i)
            if ability then
                ability:SetLevel(ability:GetMaxLevel())
            end
        end
    end
    

    Still having a problem.. this isn't working..

  • AshAsh
    edited July 2015 Posts: 14

    There's nothing wrong with the script, I just created a fresh addon using BMD's barebones script and didn't make any changes. Simply added the following:

        for i=0,15 do
            local ability = hero:GetAbilityByIndex(i)
            if ability then
                ability:SetLevel(ability:GetMaxLevel())
            end
        end
    

    in gamemode.lua file, under \game\dota_addons\ADDONNAME\script\vscripts\

    --If the above information, isn't enough to get this working for you, then add me on steam (http://steamcommunity.com/profiles/76561198084146636/) and I'll try to go through it with you. Just bare in mind, I'm by no means an expert but I'll try my best to help ya out.

  • Nevermind me, it actully worked, thanks for help @Ash @Noya @Arhowk my problem was that i was using lua_ability_example map, which did not contain certain important things..