i want to make this code passive .. it should just change base attack effect .

edited July 2015 in Questions

hi guys i am making a towerdefense map and it is nearlydone. my problem is i just want to change their attack effect and i couldnt do that can u help me under this code what should i change. it should be passive no mana no cd just effect. Thnx

"orb_ability_example"
{
    "BaseClass"                 "ability_datadriven"
    "AbilityBehavior"           "DOTA_ABILITY_BEHAVIOR_UNIT_TARGET | DOTA_ABILITY_BEHAVIOR_AUTOCAST|     DOTA_ABILITY_BEHAVIOR_ATTACK"
    "AbilityUnitTargetTeam"     "DOTA_UNIT_TARGET_TEAM_ENEMY"
    "AbilityUnitTargetType"     "DOTA_UNIT_TARGET_ALL"
    "AbilityCastPoint"          "0.0"
    "AbilityCastRange"          "900"
    "AbilityCooldown"           "0"
    "AbilityManaCost"           "10"
    "AbilitySpecial"
    {
        "01"
        {
            "var_type"          "FIELD_INTEGER"
            "RangeDamage"       "75"
        }
    }

    "Modifiers"
    {
        "TestOrb_Modifier"
        {
            "Passive"     "1"
            "IsHidden"    "1"
            "Orb"
            {
                "Priority"          "DOTA_ORB_PRIORITY_ABILITY"
                "ProjectileName"    "particles/units/heroes/hero_sven/sven_spell_storm_bolt.vpcf"
                "CastAttack"        "1"
            }
            "OnOrbFire"
            {
                "SpendMana"
                {
                    "Mana"    "%AbilityManaCost"
                }
            }
            "OnOrbImpact"
            {
                "FireEffect"
                {
                    "EffectName"            "particles/units/heroes/hero_sven/sven_spell_warcry.vpcf"
                    "EffectAttachType"      "attach_hitloc"
                    "Target"                "TARGET"
                }
                "Damage"
                {
                    "Type"          "DAMAGE_TYPE_PURE"
                    "Damage"        "%RangeDamage"
                    "Target"
                    {
                        "Center"    "TARGET"
                        "Teams"     "DOTA_UNIT_TARGET_TEAM_ENEMY"
                        "Type"      "DOTA_UNIT_TARGET_ALL"
                        "Radius"    "275"
                    }
                }
                "Stun"
                {
                    "Duration"      "2"
                    "Target"
                    {
                        "Center"    "TARGET"
                        "Teams"     "DOTA_UNIT_TARGET_TEAM_ENEMY"
                        "Type"      "DOTA_UNIT_TARGET_ALL"
                        "Radius"    "275"
                    }
                }
            }
        }
    }
}

Comments

  • Posts: 1,670

    Edited your post to show the code, it goes with ~~~, not the quote tag.

    Change your AbilityBehavior to "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"and add"Passive" "1"` to your modifiers.

    All of this is in the Ability DataDriven docs

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

  • Posts: 5

    thank you for hellping noya :) finally i found to set some effect for my game. if u have a energy i would like to ask another question.

    this is my game mode scripts . i want to make like 6 more spawner . i tried everything that gives me error all the time.

    what should i change on this to make more spawners.

    if GameMode == nil then
        _G.GameMode = class({})
    end
    
    -- initialize game
    function GameMode:InitGameMode()
        -- setup rules
        Util:SetupGameRules(self)
        -- load waypoints, todo: better entities name
        -- special
        GameRules.waypoints = {}
        GameRules.waypoints['Special'] = {}
        GameRules.waypoints['Special']['AllyPortal'] = {Position = Entities:FindByName(nil, 'p_ally_portal'):GetAbsOrigin()}
        GameRules.waypoints['Special']['EnemyKillPit'] = {Position = Entities:FindByName(nill, 'p_enemy_killpit'):GetAbsOrigin()}
        GameRules.waypoints['Special']['SpawnForPath1'] = {Position = Entities:FindByName(nil, 'p_enemy1_start'):GetAbsOrigin()}
        GameRules.waypoints['Special']['SpawnForPath2'] = {Position = Entities:FindByName(nil, 'p_enemy2_start'):GetAbsOrigin()}
        -- paths
        GameRules.waypoints['Path1'] = {}
        GameRules.waypoints['Path2'] = {}
        for i = 1, 8 do
            local pos1 = Entities:FindByName(nil, "p_enemy1_path" .. i):GetAbsOrigin()
            local pos2 = Entities:FindByName(nil, "p_enemy2_path" .. i):GetAbsOrigin()
            GameRules.waypoints['Path1'][i] = {Position = pos1, DistanceToPortal = AI:Distance(pos1, GameRules.waypoints['Special']['AllyPortal']['Position'])}
            GameRules.waypoints['Path2'][i] = {Position = pos2, DistanceToPortal = AI:Distance(pos2, GameRules.waypoints['Special']['AllyPortal']['Position'])}
        end
        -- setup lights
        for i = 1, 10 do
            local location = Entities:FindByName(nil, 'fow' .. i)
            if location ~= nil then
                local radius = location:GetIntAttr('light_radius')
                if radius == 0 then radius = 900 end
                AddFOWViewer(DOTA_TEAM_GOODGUYS, location:GetAbsOrigin(), radius, 60 * 60 * 60, false)
            end
        end
        -- ensure particle portal teleport play
        AddFOWViewer(DOTA_TEAM_GOODGUYS, GameRules.waypoints['Special']['EnemyKillPit']['Position'], 200, 60 * 60 * 60, false)
        -- setup general
        GameRules.Lives = MAX_LIVES
        -- setup round tracker
        GameRules.rounds = {}
        GameRules.rounds['CurrentRound'] = 0
        GameRules.rounds['RoundCount'] = 24
        GameRules.rounds['EnemyKilled'] = 0
        GameRules.rounds['TotalEnemies'] = 0
        GameRules.rounds['SpawnInProgress'] = false
        -- setup hud
        GameRules.hud = {}
        GameRules.hud['CountdownEnabled'] = true
        GameRules.hud['CountdownValue'] = 0
        -- setup rounds
        -- round 1
        GameRules.rounds['Round1_Title'] = 'asd'
        GameRules.rounds['Round1_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round1_Unit'] = 'enemy_trol'
        GameRules.rounds['Round1_CountPerSide'] = '5'
        GameRules.rounds['Round1_TinkerFunc'] = 'Basic'
        -- round 2
        GameRules.rounds['Round2_Title'] = 'Winter is comming'
        GameRules.rounds['Round2_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round2_Unit'] = 'enemy_trolchief'
        GameRules.rounds['Round2_CountPerSide'] = '5'
        GameRules.rounds['Round2_TinkerFunc'] = 'Basic'
        -- round 3
        GameRules.rounds['Round3_Title'] = 'aasdasd'
        GameRules.rounds['Round3_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round3_Unit'] = 'enemy_dragons'
        GameRules.rounds['Round3_CountPerSide'] = '5'
        GameRules.rounds['Round3_TinkerFunc'] = 'Basic'
        -- round 4
        GameRules.rounds['Round4_Title'] = 'LOL'
        GameRules.rounds['Round4_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round4_Unit'] = 'enemy_vulture'
        GameRules.rounds['Round4_CountPerSide'] = '5'
        GameRules.rounds['Round4_TinkerFunc'] = 'Basic'
        -- round 5
        GameRules.rounds['Round5_Title'] = 'qweqe'
        GameRules.rounds['Round5_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round5_Unit'] = 'enemy_beast'
        GameRules.rounds['Round5_CountPerSide'] = '5'
        GameRules.rounds['Round5_TinkerFunc'] = 'Basic'
        -- round 6
        GameRules.rounds['Round6_Title'] = 'Volkytalky'
        GameRules.rounds['Round6_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round6_Unit'] = 'enemy_worg'
        GameRules.rounds['Round6_CountPerSide'] = '5'
        GameRules.rounds['Round6_TinkerFunc'] = 'Basic'
        -- round 7
        GameRules.rounds['Round7_Title'] = 'Cyka'
        GameRules.rounds['Round7_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round7_Unit'] = 'enemy_thorndrake'
        GameRules.rounds['Round7_CountPerSide'] = '5'
        GameRules.rounds['Round7_TinkerFunc'] = 'Basic'
        -- round 8
        GameRules.rounds['Round8_Title'] = 'lizard'
        GameRules.rounds['Round8_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round8_Unit'] = 'enemy_thunderlizard'
        GameRules.rounds['Round8_CountPerSide'] = '5'
        GameRules.rounds['Round8_TinkerFunc'] = 'Basic'
        -- round 9
        GameRules.rounds['Round9_Title'] = 'nian'
        GameRules.rounds['Round9_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round9_Unit'] = 'enemy_nian'
        GameRules.rounds['Round9_CountPerSide'] = '5'
        GameRules.rounds['Round9_TinkerFunc'] = 'Basic'
        -- round 10
        GameRules.rounds['Round10_Title'] = 'enemy_ghost'
        GameRules.rounds['Round10_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round10_Unit'] = 'enemy_ghost'
        GameRules.rounds['Round10_CountPerSide'] = '5'
        GameRules.rounds['Round10_TinkerFunc'] = 'Basic'
        -- round 11
        GameRules.rounds['Round11_Title'] = 'enemy_pudge'
        GameRules.rounds['Round11_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round11_Unit'] = 'enemy_pudge'
        GameRules.rounds['Round11_CountPerSide'] = '5'
        GameRules.rounds['Round11_TinkerFunc'] = 'Basic'
        -- round 12
        GameRules.rounds['Round12_Title'] = 'enemy_torso'
        GameRules.rounds['Round12_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round12_Unit'] = 'enemy_torso'
        GameRules.rounds['Round12_CountPerSide'] = '5'
        GameRules.rounds['Round12_TinkerFunc'] = 'Basic'
        -- round 13
        GameRules.rounds['Round13_Title'] = 'enemy_roshan'
        GameRules.rounds['Round13_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round13_Unit'] = 'enemy_roshan'
        GameRules.rounds['Round13_CountPerSide'] = '5'
        GameRules.rounds['Round13_TinkerFunc'] = 'Basic'
        -- round 14
        GameRules.rounds['Round14_Title'] = 'enemy_Wyren'
        GameRules.rounds['Round14_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round14_Unit'] = 'enemy_Wyren'
        GameRules.rounds['Round14_CountPerSide'] = '5'
        GameRules.rounds['Round14_TinkerFunc'] = 'Basic'
        -- round 15
        GameRules.rounds['Round15_Title'] = 'enemy_smeevil'
        GameRules.rounds['Round15_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round15_Unit'] = 'enemy_smeevil'
        GameRules.rounds['Round15_CountPerSide'] = '5'
        GameRules.rounds['Round15_TinkerFunc'] = 'Basic'
        -- round 16
        GameRules.rounds['Round16_Title'] = 'enemy_badmega'
        GameRules.rounds['Round16_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round16_Unit'] = 'enemy_badmega'
        GameRules.rounds['Round16_CountPerSide'] = '5'
        GameRules.rounds['Round16_TinkerFunc'] = 'Basic'
        -- round 17
        GameRules.rounds['Round17_Title'] = 'enemy_necrowarrior'
        GameRules.rounds['Round17_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round17_Unit'] = 'enemy_necrowarrior'
        GameRules.rounds['Round17_CountPerSide'] = '5'
        GameRules.rounds['Round17_TinkerFunc'] = 'Basic'
        -- round 18
        GameRules.rounds['Round18_Title'] = 'enemy_baddiretide'
        GameRules.rounds['Round18_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round18_Unit'] = 'enemy_baddiretide'
        GameRules.rounds['Round18_CountPerSide'] = '5'
        GameRules.rounds['Round18_TinkerFunc'] = 'Basic'
        -- round 19
        GameRules.rounds['Round19_Title'] = 'enemy_goldgreevil'
        GameRules.rounds['Round19_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round19_Unit'] = 'enemy_goldgreevil'
        GameRules.rounds['Round19_CountPerSide'] = '5'
        GameRules.rounds['Round19_TinkerFunc'] = 'Basic'
        -- round 20
        GameRules.rounds['Round20_Title'] = 'enemy_mech'
        GameRules.rounds['Round20_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round20_Unit'] = 'enemy_mech'
        GameRules.rounds['Round20_CountPerSide'] = '5'
        GameRules.rounds['Round20_TinkerFunc'] = 'Basic'
        -- round 21
        GameRules.rounds['Round21_Title'] = 'enemy_demidoom'
        GameRules.rounds['Round21_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round21_Unit'] = 'enemy_demidoom'
        GameRules.rounds['Round21_CountPerSide'] = '5'
        GameRules.rounds['Round21_TinkerFunc'] = 'Basic'
        -- round 22
        GameRules.rounds['Round22_Title'] = 'enemy_octopus'
        GameRules.rounds['Round22_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round22_Unit'] = 'enemy_octopus'
        GameRules.rounds['Round22_CountPerSide'] = '5'
        GameRules.rounds['Round22_TinkerFunc'] = 'Basic'
        -- round 23
        GameRules.rounds['Round23_Title'] = 'enemy_spiderling'
        GameRules.rounds['Round23_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round23_Unit'] = 'enemy_spiderling'
        GameRules.rounds['Round23_CountPerSide'] = '5'
        GameRules.rounds['Round23_TinkerFunc'] = 'Basic'
        -- round 24
        GameRules.rounds['Round24_Title'] = 'enemy_ram'
        GameRules.rounds['Round24_Type'] = ROUND_TYPE_NORMAL
        GameRules.rounds['Round24_Unit'] = 'enemy_ram'
        GameRules.rounds['Round24_CountPerSide'] = '5'
        GameRules.rounds['Round24_TinkerFunc'] = 'Basic'
    
        Timers:CreateTimer(function()
    
            HUD:HudUpdate()
            return 0.5
        end)
    end
    
    -- handle game state changes
    function GameMode:OnGameRulesStateChange(keys)
        if GameRules:State_Get() == DOTA_GAMERULES_STATE_GAME_IN_PROGRESS then
            GameMode:OnGameInProgress()
        end
    end
    
    -- game reached 00:00 time
    function GameMode:OnGameInProgress()
        GameMode:EndRound()
    end
    
    -- called everytime time unit is killed
    function GameMode:OnEntityKilled(keys)
        local killedUnit = EntIndexToHScript(keys.entindex_killed)
        if killedUnit:GetTeamNumber() == DOTA_TEAM_BADGUYS and killedUnit.spawned_enemy then
            GameRules.rounds['EnemyKilled'] = GameRules.rounds['EnemyKilled'] + 1
        end
        if GameRules.rounds['EnemyKilled'] == GameRules.rounds['TotalEnemies'] then
            GameMode:EndRound()
        end
    end
    
    function GameMode:OnPlayerKilled(keys)
        --GameMode:HudUpdate();
    end
    
    function GameMode:OnPlayerSpawn(keys)
       --GameMode:HudUpdate(); 
    end
    
    function GameMode:OnPlayerPickHero(keys)
        --GameMode:HudUpdate();
    end
    
    function GameMode:OnNPCSpawned(keys)
        local npc = EntIndexToHScript(keys.entindex)
        local unit_name = npc:GetUnitName()
        if FX_AMBIENT[unit_name] then
            npc.fx = {}
            npc.fx.ambient = ParticleManager:CreateParticle(FX_AMBIENT[unit_name], PATTACH_ABSORIGIN_FOLLOW, npc)
        end
    end
    
    -- starts next round
    function GameMode:StartNextRound()
        GameRules.rounds['CurrentRound'] = GameRules.rounds['CurrentRound'] + 1
        GameRules.rounds['TotalEnemies'] = 0
        GameRules.rounds['EnemyKilled'] = 0
        local p_round = 'Round' .. GameRules.rounds['CurrentRound'] .. '_'
        local countdown = ROUND_COUNTDOWN
        Timers:CreateTimer(function()
            if countdown > 0 then
                GameRules.hud['CountdownEnabled'] = true
                GameRules.hud['CountdownValue'] = countdown
                countdown = countdown - 1
                return 1.0
            else
                GameRules.hud['CountdownEnabled'] = false
                GameRules.hud['CountdownValue'] = 0
                if GameRules.rounds[p_round .. 'Type'] == ROUND_TYPE_NORMAL then
                    GameMode:SpawnNormalRound(p_round)
                elseif GameRules.rounds[p_round .. 'Type'] == ROUND_TYPE_BOSS then
                    GameRules:SpawnBossRound(p_round)
                end            
            end
        end)
    end
    
    -- round is over
    function GameMode:EndRound()
        if GameRules.rounds['CurrentRound'] == GameRules.rounds['RoundCount'] then
            HUD:Notify('You WON!!!', 60)
        else
            GameMode:StartNextRound()
        end
    end
    
    -- spawn normal round
    function GameMode:SpawnNormalRound(p_round)
        HUD:Notify('Round ' .. GameRules.rounds['CurrentRound'] .. ': ' .. GameRules.rounds[p_round .. 'Title'])
        local unit_names = Util:ExplodeAsString(' ', GameRules.rounds[p_round .. 'Unit'])
        local unit_counts = Util:ExplodeAsInt(' ', GameRules.rounds[p_round .. 'CountPerSide'])
        local unit_tfuncs = Util:ExplodeAsString(' ', GameRules.rounds[p_round .. 'TinkerFunc'])
        local spawn_delay = 0
        -- calculate total enymies in this round
        GameRules.rounds['TotalEnemies'] = 0;
        for i = 1, table.getn(unit_counts) do GameRules.rounds['TotalEnemies'] = GameRules.rounds['TotalEnemies'] + unit_counts[i] * 2 end
        for i = 1, table.getn(unit_names) do
            local unit_name = unit_names[i]
            local unit_count = unit_counts[i]
            local unit_tfunc = unit_tfuncs[i]
            for j = 1, unit_count do
                spawn_delay = spawn_delay + 0.8
                Timers:CreateTimer(spawn_delay, function()
                    local unit1 = CreateUnitByName(unit_name, GameRules.waypoints['Special']['SpawnForPath1']['Position'], true, nil, nil, DOTA_TEAM_BADGUYS)
                    local unit2 = CreateUnitByName(unit_name, GameRules.waypoints['Special']['SpawnForPath2']['Position'], true, nil, nil, DOTA_TEAM_BADGUYS)
                    unit1.spawned_enemy = true
                    unit2.spawned_enemy = true
                    AI:SetParams(unit1, {PreferedPath = 1, State = AI_STATE_IDLE})
                    AI:SetParams(unit2, {PreferedPath = 2, State = AI_STATE_IDLE})
                    AI:SetContextThinkSmart(unit1, unit_tfunc)
                    AI:SetContextThinkSmart(unit2, unit_tfunc)
                end)
            end
        end
    end
    
    -- spawn boss round
    function GameMode:SpawnBossRound(p_round)
    end
    
    
  • edited July 2015 Posts: 1,670

    use pastebin/hastebin jeezus :pumped:

    Also for huge round configurations, use LoadKeyValues with a table (check how holdout does it)

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

  • Posts: 5

    this is bad right :) but it works perfectly: )