Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

[Source2 Beta] Lua : ReplaceHeroWith function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Source2 Beta] Lua : ReplaceHeroWith function

    I understand why you changed it for your demo thing but please bring the alpha version of that function back with a new name if you have to.

    This new function breaks my game mode (Slide Ninja Slide) when used and seems completely unpredictable. For instance it sometimes keeps the old hero (shows up as green on the minimap). It is just bad. Bring back the old function.

  • #2
    ReplaceHeroWith no longer deletes the hero itself to avoid causing problems when abilities or debuffs that may need to persist after the hero is removed.

    If you'd like the old behavior back, you should be able to call UTIL_Remove on the old hero after the ReplaceHeroWith.

    Code:
    local playerNum = 0
    local oldHero = PlayerResource:GetSelectedHeroEntity( playerNum )
    PlayerResource:ReplaceHeroWith( playerNum, "npc_dota_hero_antimage", 0, 0 )
    UTIL_Remove( oldHero ) -- Potentially unsafe if modifiers or other effects persist

    Comment


    • #3
      I also noticed that abilities, items, and level points are not reset now but that's all is easy enough to do in lua. Was there anything else changed?

      I think the change may also have something to do with this http://dev.dota2.com/showthread.php?t=171459.

      Comment


      • #4
        Some of my players seem to crash at the moment the ReplaceHeroWith function is called and when they load back into the game none of their models or particles load (all just models) including the dota prefab models like shops. I occasionally had this problem in the alpha as well but it was much less frequent.

        Comment


        • #5
          Possible fix in the June 22, 2015 patch:

          - Fixed a bug in Custom Games scripting where ReplaceHeroWith would crash if the unit name was invalid

          Comment

          Working...
          X