[PARTIALLY SOLVED] Spell Library Request: Maelstrom

edited December 2015 in Support

I realllyyyyy wanna use the Maelstrom. Can someone with the knowledge help code it and upload to the spell library? :D My eternal thanks!

Comments

  • Posts: 1,670

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

  • edited December 2015 Posts: 69

    DrTeaSpoon - I'm trying to stay away as much as I can from lua atm. Unless it's pretty much a full ctrl+c ctrl+v lol. But thank you nonetheless!

    Noya - I tried doing this on my KV:

        "Modifiers"
        {
            "modifier_lightning"
            {
                "Passive"       "1"
                "IsHidden"      "1"
                "Attributes"    "MODIFIER_ATTRIBUTE_MULTIPLE"
    
                "OnAttackLanded"
                {
                    "Random"
                    {
                        "Chance"        "%lightning_chance"
    
                        "OnSuccess"
                        {
                            "RunScript"
                            {
                                "ScriptFile"    "spells/chain_lightning.lua"
                                "Function"      "ChainLightning"
                            }
                        }
                    }
                }
            }
        }
    

    And uh... the dmg seems to be coming out but it doesn't bounce:

    http://gfycat.com/ShinyBriskAsianpiedstarling

  • edited December 2015 Posts: 858

    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

  • Yeah Noya asked me the same question. Here's the ability special portion:

        "AbilitySpecial"
        {
            "01"
            {
                "var_type"              "FIELD_INTEGER"
                "lightning_damage"      "85 125 180"
            }
            "02"
            {
                "var_type"              "FIELD_INTEGER"
                "lightning_bounces"     "4 6 8"
            }
            "03"
            {
                "var_type"              "FIELD_INTEGER"
                "bounce_range"          "500"
            }
            "04"
            {
                "var_type"              "FIELD_INTEGER"
                "lightning_decay"       "20"
            }
            "05"
            {
                "var_type"              "FIELD_FLOAT"
                "time_between_bounces"  "0.2"
            }
            "06"
            {
                "var_type"              "FIELD_FLOAT"
                "lightning_chance"      "50"
            }        
        }
    
  • edited December 2015 Posts: 69

    I'm getting these errors btw:

    Cannot create an entity because entity class is NULL -1

    ...racks_master\scripts\vscripts\spells\chain_lightning.lua:76: attempt to index upvalue 'dummy' (a nil value)

    stack traceback: scripts/vscripts/libraries/timers.lua:147: in function '__index' ...racks_master\scripts\vscripts\spells\chain_lightning.lua:76: in function <...racks_master\scripts\vscripts\spells\chain_lightning.lua:37> [C]: in function 'xpcall' scripts/vscripts/libraries/timers.lua:146: in function <scripts/vscripts/libraries/timers.lua:107>

  • edited December 2015 Posts: 6

    If I had to guess, dummy_unit isn't actually defined in npc_units_custom (a la https://github.com/MNoya/PMP/blob/master/game/dota_addons/pmp/scripts/npc/npc_units_custom.txt#L748 ) so CreateUnitByName() doesn't return anything, and when it tries to create a particle on the dummy the script fails.

    So I guess make sure dummy_unit actually exists, if you're using PMP's chain lightning.

  • edited December 2015 Posts: 1,670

    Damn that skill is bad, checking an ability made over a year ago it's so terrible... there's really no reason to make a unit, I was just just not sure how to attach the particle to "a body", it shouldn't be hard for me to fix it to not need units and use PATTACH_CUSTOMORIGIN to set the control point instead

    I kept note of this here I'll fix it :soon:

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

  • Yeah, I was kinda wondering about that :p

    But since he said he wanted to avoid messing with lua stuff I figured it was simpler not to tell cowsforyou to change the function

  • edited December 2015 Posts: 69

    Nice catch Jeekaroose! It was indeed the missing dummy unit. And yes I've no idea what Noya just said about all the lua stuff lol. But good to know ur fixing it soon!

    Anyway I've added the dummy unit and now it bounces but... the dummy unit doesn't go away =|

    Check it out here:

    Also is there a way I can directly paste the gfycat into the post like an image?

  • edited December 2015 Posts: 1,670

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

  • edited December 2015 Posts: 69

    Tried putting in the new code Noya. No more errors on the lua but it doesn't bounce again :( Back to square 1...

    I'm guessing it interacts differently with OnAttackLanded? Idk. What to do what to do... lol.

    P.S. I'm still hoping someone will just create the Maelstrom item for the Spell Library :P

  • Noya, also just a side note - I noticed you have DAMAGE_TYPE_MAGICAL in the chain_lightning.lua file but the damage seems to be affecting the towers as well (which I guess isn't supposed to be happening?).

  • Does your item have an AbilityUnitTargetTeam and AbilityUnitTargetType defined?

  • Posts: 1,670

    @cowsforyou hmm it shouldn't bounce to magic immune creatures

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

  • edited December 2015 Posts: 69

    @Jeekaroose

    Those are not defined. But I believe the chain_lightning.lua file has those defined in there. Here is the kv file if you want to inspect.

    @Noya

    Yeah I didn't think so either. Especially since you have the damage type set as magic. I can't tell you about the bounces (the bounces don't seem to work on mine) but I can tell you for sure that the damage buff is applied if it procs directly on the tower. Although... the reason could be that the full .lua script is not going through and the magic damage isn't defined (since that damage definition is at the bottom of the script).

  • Posts: 858

    But I believe the chain_lightning.lua file has those defined in there.

    No it doesn't.

    https://github.com/MNoya/DotaCraft/blob/master/game/dota_addons/dotacraft/scripts/vscripts/heroes/far_seer/chain_lightning.lua#L11-L12

        local targetTeam = ability:GetAbilityTargetTeam()
        local targetTypes = ability:GetAbilityTargetType()
    

    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

  • @Arhowk, I'm not good with understanding the lua files. I initially thought those were the definitions but upon closer inspection do those 2 lines mean that it's trying to grab the logic from the KV file?

    Also, I just wanted to make peace with u. We have our disagreements on money and modding but it shouldn't mean that we can't agree to disagree and move on living peacefully :)

  • Posts: 858

    I don't have any beef with you or with anyone. What you and others choose to do with money is none of my business and has no effect on how I live my life.

    Yes, refer to Jeekaroose's comment.

    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

  • edited December 2015 Posts: 69

    Alright good catch again!

    I just put in the TargetTeam, TargetType and DamageType - everything seems to be firing properly now. My best guess is that the lua probably stopped working after it couldn't retrieve the AbilityUnitTargetTeam.

        "BaseClass"                     "ability_datadriven"
        "AbilityBehavior"               "DOTA_ABILITY_BEHAVIOR_PASSIVE"
        "AbilityUnitTargetTeam"         "DOTA_UNIT_TARGET_TEAM_ENEMY"   
        "AbilityUnitTargetType"         "DOTA_UNIT_TARGET_BASIC | DOTA_UNIT_TARGET_HERO"
        "AbilityUnitDamageType"         "DAMAGE_TYPE_MAGICAL"    
        "AbilityTextureName"            "bm_desolator3"
    

    BUT... the damage seems to be physical still. Now that one I can't seem to figure out why. I also believe the AbilityUnitDamageType is hard coded in the lua - @Noya I'm not sure if you intended that. It's this part of the script:

        EmitSoundOn("Hero_Zuus.ArcLightning.Target", target)    
        ApplyDamage({ victim = target, attacker = caster, damage = damage, damage_type = DAMAGE_TYPE_MAGICAL })
        PopupDamage(target, math.floor(damage))
    

    The sound is firing and the popupdamage is firing though. So I'm quite sure the applydamage is being read too.

  • edited December 2015 Posts: 858

    My best guess is that the lua probably stopped working after it couldn't retrieve the AbilityUnitTargetTeam.

    No. The target defaults to 0, which means that no unit will pass the filt er. It couldn't find a unit to match a null filter to

    the damage seems to be physical still.

    You mean magical? That line of code shows it to be hardcoded to magical

    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

  • @Arhowk, that was my point. Even though the codes show magical it seems to be damaging the towers which is an indicator that it might be physical. Unless I'm wrong about magical damage and damage to tower mechanics?

  • edited December 2015 Posts: 1,670

    npc_dota_tower baseclass can be damaged by magic damage just fine, if the ability targets buildings, think pugna blast.

    That being said, HERO + BASIC shouldn't target a npc_dota_tower, so your towers must be creatures if this ability is damaging them. Add magic immunity to them as I have in dotacraft ability_building.

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

  • edited December 2015 Posts: 69

    @Noya, good point on the Pugna blast. I've ran some test on magic immune units and it seems that the damage doesn't go through so the spell is indeed casting magic damage. The issue I'm guessing is the AbilityUnitTargetType. Even though the KV specifies HERO + BASIC, I have a suspicion that it's only applying to the bounces.

    I'm guessing your first block (function ChainLightning) is the logic you setup for the bounces. And the second block (function CreateChainLightning) is to create the initial point of the chain. And while your first block draws from the KV file, your second block seems to be hardcoded.

        EmitSoundOn("Hero_Zuus.ArcLightning.Target", target)    
        ApplyDamage({ victim = target, attacker = caster, damage = damage, damage_type = DAMAGE_TYPE_MAGICAL })
        PopupDamage(target, math.floor(damage))
    

    My hunch is that because there is no target type or flags in that ApplyDamage line, it will just apply the magic damage to anything it hits. That's why the BASIC + HERO logic is not respected for the initial attack. If you show me how to modify that line I can do the test for you.

  • Posts: 1,670

    But the FindUnitsInRadius is done with hero+basic and it doesnt have a DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES flag, so I'm not sure what's the problem, you can change it on the function directly to fit your needs

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

  • edited December 2015 Posts: 69

    Yeah the FindUnitsInRadius is in the first block and that's working correctly so it will never jump to a tower. The issue only arises if the unit directly attacks the tower.

    How do I weave in targetTypes in this line?

        ApplyDamage({ victim = target, attacker = caster, damage = damage, damage_type = DAMAGE_TYPE_MAGICAL })
    
  • Posts: 1,670

    Oh I finally got it, it's from attacking a tower Directly.

    I you don't want it to jump, add this after target is defined:

    if not (target:IsHero() or target:IsCreature()) then return end
    


    If you want it to jump, but not damage the main target, do:

    if target:IsHero() or target:IsCreature() then
       ApplyDamage...
    end
    

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

  • My apologies - I probably could've done a better job with the explanation.

    BUT.. the good news is that with that new code in place this is working flawlessly now :) Thank you v much! I used your 2nd line so it jumps but doesn't damage.

    Looks like we have the template for Maelstrom if anyone wants to make it now :P