Abilityspecials from datadriven file can't get used in lua file [Solved]

edited December 2015 in Questions

So when in my lua file i have, as usual, a some values that i need from my kv file, so i imported them all like this :

local spawnDistance = ability:GetLevelSpecialValueFor("ghostship_distance", ability:GetLevel() - 1 )

but when i print them in the console right after i create them , like this

print(spawnDistance)

it gets the value 0 for all of them. Its like the mechanism for sending over the values isnt working

here are the pastebin links to the full code

http://pastebin.com/wPG3FVLt : lua file http://pastebin.com/nW8khJQR : datadriven file

Comments

  • I'm not sure if that function works because I've never used it, but as a workaround you can try passing through the variable in your RunScript block.

    So change to

      "RunScript"
      {
        "ScriptFile"        "hero/hero_kunkka.lua"
        "Function"          "ghostship_start_traverse"
        "Target"            "POINT"
        "delay"             "%tooltip_delay"
      }
    

    and then access it in your function with event.delay

  • edited December 2015 Posts: 21

    when you need ability special values in lua you call it with self:GetSpecialValueFor("special_value")

    Check out valve's lua ability examples in game/dota_addons/lua_ability_example/scripts/vscripts

  • Posts: 1,670

    GetLevelSpecialValueFor works fine for multi level ability specials. GetSpecialValueFor only works for single level. Also @Aardvark self: won't work in datadriven RunScripts

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

  • Posts: 329

    ah , so thats how it works, thanks

  • Posts: 329

    hmm, well i use GetLevelSpecialValueFor on every value

    after some testing i found out that some values do get transfered as they should and some don't. I havent figured out the pattern yet.

    i will post the lua and datadriven code for the abiltiies that work here in a paste bin and following that another pastebin with the lua and datadriven cod for abilities that dont work

    so working :

    http://pastebin.com/ZnVeCBXR

    not working :

    http://pastebin.com/tBkhJdrt

  • Posts: 329

    nvr mind this thread, problem was due to me having multiple versions of the same spell in my npc_abilites_custom :s