Results 1 to 6 of 6

Thread: [Suggestion] A unit target flag to exclude self/caster

  1. #1
    Basic Member
    Join Date
    Jun 2012
    Posts
    184

    [Suggestion] A unit target flag to exclude self/caster

    There are certain existing abilities that can target allies but not the caster himself. Adding a DOTA_UNIT_TARGET_FLAG_NOT_SELF unit target flag would let modders do the same. This may be possible to do already with DOTA_UNIT_TARGET_CUSTOM, but I'm not sure how.
    Last edited by pie4all88; 10-09-2014 at 01:11 AM.

  2. #2
    Basic Member Noya's Avatar
    Join Date
    Dec 2011
    Location
    Uruguay
    Posts
    12,904
    Yeah, I had to do a workaround for this with our Holy Light spell. It's awkward because the spell is still cast and the hero plays the animation, but it is close enough (I even added the Flash message error with the Custom Error library)

    If you are interested, search for holy_light in abilities.lua and npc_abilities_custom.txt
    Last edited by Noya; 10-09-2014 at 08:24 AM.

  3. #3
    Basic Member
    Join Date
    Jun 2012
    Posts
    184
    Quote Originally Posted by Noya View Post
    Yeah, I had to do a workaround for this with our Holy Light spell. It's awkward because the spell is still cast and the hero plays the animation, but it is close enough (I even added the Flash message error with the Custom Error library)

    If you are interested, search for holy_light in abilities.lua and npc_abilities_custom.txt
    Thanks for sharing your method! I ended up doing something very similar. You should be able to use event.ability:RefundManaCost() instead of event.caster:GetPlayerOwner():GetAssignedHero():Gi veMana(event.ability:GetManaCost(1)) you have on line 36, which I think might save some processing time.

  4. #4
    Basic Member
    Join Date
    Jun 2012
    Posts
    184
    This would also be very useful for linear projectiles. Currently, linear projectiles that can affect allied units will hit the caster as soon as they are fired.

    Now, you can add "DeleteOnHit" "0" to the "OnProjectileHitUnit" block and make it so nothing happens if the caster was hit, but "OnProjectileHitUnit" does not pass in the projectile's ID, so you need to try to match up the projectile with its ID either by its position or its target_points variable (which is passed in).

  5. #5
    Basic Member
    Join Date
    Jun 2012
    Posts
    184
    Now, you can add "DeleteOnHit" "0" to the "OnProjectileHitUnit" block and make it so nothing happens if the caster was hit, but "OnProjectileHitUnit" does not pass in the projectile's ID, so you need to try to match up the projectile with its ID either by its position or its target_points variable (which is passed in).
    Correction: target_points is not the same in OnProjectileHitUnit as it is in OnSpellStart, so you can't use that method.

  6. #6
    Basic Member
    Join Date
    Jun 2012
    Posts
    184
    It looks like this issue will be fixed with the Dota 2 Source 2 Beta!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •