• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Fixing a healing item for Mirror Images

Status
Not open for further replies.
Level 9
Joined
Feb 17, 2009
Messages
291
So I've got an item that restores a flat amount of health every few seconds when carried. This causes problems for a specific two heroes who happen to use a mirror image ability. When the images die, it starts to subtract that amount of health instead of healing it. So you get numbers like "+-900" on the combat text, resulting in being completely unable to continue playing.

What should I do? As you can see below I tried using the built in boolean exception and it does nothing.

  • Events
    • Time - Every 4.00 seconds of game time
  • Conditions
  • Actions
    • Set AA_LEAK_UnitGroups = (Units in (Playable map area))
    • Unit Group - Pick every unit in AA_LEAK_UnitGroups and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) has an item of type |c0000ffffCure Ring|r) Equal to True
            • ((Picked unit) is an illusion) Equal to False
            • ((Picked unit) is A Hero) Equal to True
            • (Picked unit) Not equal to King Piccolo 0090 <gen>
            • (Picked unit) Not equal to Sabin 0028 <gen>
          • Then - Actions
            • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Real(CureRingNew2015[(Player number of (Owner of (Picked unit)))])) x 300.00))
            • Floating Text - Create floating text that reads ((+ + (String((CureRingNew2015[(Player number of (Owner of (Picked unit)))] x 300)))) + <Empty String>) above (Picked unit) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
            • Floating Text - Change (Last created floating text): Disable permanence
            • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
            • Floating Text - Change the fading age of (Last created floating text) to 0.10 seconds
            • Floating Text - Set the velocity of (Last created floating text) to 90.00 towards 90.00 degrees
            • Custom script: call DestroyGroup(udg_AA_LEAK_UnitGroups)
          • Else - Actions
 
Level 4
Joined
Sep 13, 2014
Messages
106
It sounds like some other code is at fault. So, what happens is (probably) that CureRingNew2015[(Player number of (Owner of (Picked unit)))] begins to return -3. Player number of Owner of Picked unit should not change. So CureRingNew2015[blah] must change. How is CureRingNew2015[blah] calculated?
 
Level 9
Joined
Feb 17, 2009
Messages
291
I think you might be right. This is an older item and by a fluke I didn't realize this until recently. Here's the on/off triggers for it, I think we found the problem hehe.

  • Cure ring ON
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |c0000ffffCure Ring|r
    • Actions
      • Trigger - Turn on Cure Ring tick <gen>
      • Set CureRingNew2015[(Player number of (Owner of (Hero manipulating item)))] = (CureRingNew2015[(Player number of (Owner of (Hero manipulating item)))] + 1)
---

  • Cure ring DROP
    • Events
      • Unit - A unit Loses an item
      • Unit - A unit Pawns an item (to shop)
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |c0000ffffCure Ring|r
    • Actions
      • Trigger - Turn on Cure Ring tick <gen>
      • Set CureRingNew2015[(Player number of (Owner of (Hero manipulating item)))] = (CureRingNew2015[(Player number of (Owner of (Hero manipulating item)))] - 1)
This was originally written a long ass time ago (the "new 2015" bit was named for a different reason) so maybe that condition DOES work, it just needs to be asking if a unit is an illusion in those two triggers as well. Now I just feel silly. XD Thanks for pointing that out!
 

sentrywiz

S

sentrywiz

Your trigger is unnecessarily complex for a simple task such as heal X per Y.

First of all, why pick all units? Its easier to add the unit that obtain the ring into a group and heal only units in that group.
Secondly, you are destroying the group via custom script each time a unit is picked. Safer to destroy the group outside of the loop.

I'd do it this way:
1. Add units that acquire the item into a group
2. Every Y seconds heal X to all units in the group that aren't illusions or dbz characters

X. Remove units from the group when they lose the ring

Done.
 
Level 9
Joined
Feb 17, 2009
Messages
291
Well I fixed the mirror image problem. I only had exceptions checking illusions for the second half and that's why it was killing him.

Also regarding the location I chose for terminating the group - I did this because I made an ability a while back that continued to leak groups no matter where I put it until I placed it inside at the end of the loop. So I figured that was just how it had to be done. It's confusing because of how context sensitive leaks seem to be, and we've begun cleaning leaks from a ten year old map with 1300 triggers. I'm just doing my best
 

sentrywiz

S

sentrywiz

Well I fixed the mirror image problem. I only had exceptions checking illusions for the second half and that's why it was killing him.

Also regarding the location I chose for terminating the group - I did this because I made an ability a while back that continued to leak groups no matter where I put it until I placed it inside at the end of the loop. So I figured that was just how it had to be done. It's confusing because of how context sensitive leaks seem to be, and we've begun cleaning leaks from a ten year old map with 1300 triggers. I'm just doing my best

I'm not saying you aren't.

1300 triggers?! damn.

Well good luck with your project anyway :)
 
Status
Not open for further replies.
Top