[Code] Spawn equipped courier for a player

edited November 2015 in Tools

I made a function which spawns the equipped courier for a player (given the player's hero):

http://pastebin.com/dAeYamYc

Example usage:

http://pastebin.com/92Dnq0XH

Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

Comments

  • edited November 2015 Posts: 61
    function YOURGAMEMODE:InitGameMode()
        ListenToGameEvent("dota_player_pick_hero", Dynamic_Wrap( YOURGAMEMODE, "OnHeroPick"), self )
    end
    
    
    function YOURGAMEMODE:OnHeroPick (event)
        local hero = EntIndexToHScript(event.heroindex)
        hero:AddItemByName("npc_dota_courier")
    end
    

    is way simpler i guess

  • Posts: 184

    that wouldn't work? there is no such item as 'npc_dota_courier'. even if there was, you're not force casting the item and returning the courier handle like my code is doing.

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.