• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

trigger question and also UI tooltip question

Status
Not open for further replies.

311

311

Level 4
Joined
May 12, 2019
Messages
73
I am trying to make a trigger that every time certain unit type kills a unit it will heal a random unit for that persons team for 100health.
I tried

Event- Unit dies
Condition= owner of killing unit equal to (my unit that heals when he kills)
Action
Set life of random unit owned by owner of killing unit to life of random unit owned by killing player +100

but I need to make sure its a unit that's even missing health, as of now it don't even seem to work half the time.


and as far as the tooltip thing, you know how abilities will say the damage of the ability because it uses the code of the ability (so you don't need to update the tooltip every single time you change something)
for example Bash says
Gives a <AHbh,DataA1>% chance

Well is there a way to make it so you can reference a different ability/unit?

For example I have an ability that summons a unit, and I want the tooltip of my Summon ability to show the damage/health/attack speed of the unit it summons.

I thought if I just simply put the code for my unit it would work, but it comes up as 0 for most fields
for example my custom unit code is h000:hfoo I can get the HP field (HP) to work but not the move speed, attack speed or damage fields
so <h000:hoof,HP> it will display the units health, so that's good works as normal I never have to update
but <h000:hoof,cool1> doesn't
<h000:hoof,dmgplus1> doesn't
<h000:hoof,spd> doesn't
 
Level 13
Joined
May 10, 2009
Messages
868
I am trying to make a trigger that every time certain unit type kills a unit it will heal a random unit for that persons team for 100health.
Well, your current trigger is not filtering out units properly. That means, when it doesn't seem to work, the trigger could've picked a dead unit, or a structure, etc...
The easiest way would be work with 2 different unit groups: A temporary group that enumerates all units close to the killing unit, and another for storing the desired units (targets allowed), and then get a random unit out of it.
Here's a simple example:
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Killing unit)) Equal to Paladin
  • Actions
    • Set point = (Position of (Triggering unit))
    • -------- Filter out units --------
    • -------- Do note that we need to destroy the group below because it's temporary, i.e., we aren't storing it in any variable and won't use it in the future --------
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 600.00 of point) and do (Actions)
      • Loop - Actions
        • Set pickedUnit = (Picked unit)
        • -------- TARGETS ALLOWED --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (pickedUnit belongs to an ally of (Owner of (Killing unit))) Equal to True
            • (pickedUnit is dead) Equal to False
            • (pickedUnit is A structure) Equal to False
            • (Percentage life of pickedUnit) Less than 100.00
          • Then - Actions
            • Unit Group - Add pickedUnit to ValidUnits
          • Else - Actions
    • Custom script: call RemoveLocation(udg_point)
    • -------- Pick random unit from filtered group and do whatever with it --------
    • Set pickedUnit = (Random unit from ValidUnits)
    • Unit - Set life of pickedUnit to ((Life of pickedUnit) + 100.00)
    • Special Effect - Create a special effect attached to the origin of pickedUnit using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
    • Special Effect - Destroy (Last created special effect)
    • -------- Since ValidUnits group will probrably be used in the future, we don't need to destroy and recreate it later. --------
    • Unit Group - Remove all units from ValidUnits
Well, the example above isn't perfect as it can heal "weak" units over "strong" ones. Personally, I would filter the units in a different way prioritizing heroes, stronger units, units with less hp. However, I think that should be enough to clarify how to filter them.

As for your second question, a lot of object editor fields, unfortunately, don't work with tooltip codes. Regarding the damage field, blizzard uses <xxxx,mindmg1> and <xxxx,maxdmg1> by default.
 
Last edited:

311

311

Level 4
Joined
May 12, 2019
Messages
73
<xxxx,mindmg1> and <xxxx,maxdmg1> didn't seem to work :(, they gave me #s but I have no idea where from.
For min it is 12 and max is 13, but I can change my damage on my unit to anything and it will stay 12 and 13, I looked at other fields, and none of the fields at all are even 12 or 13 on unit
I think I might just do a lazy work around, and put in a field that does work.
so for mana (all my units have no mana anyway) I can use this field for the move speed, so anytime I update the movespeed, I will just have to copy/paste it in the mana section, its still easier then doing the tooltip everytime lol. It will have to do :(, maybe reforged/patch will make the fields work.
Thanks for the trigger though, I will try it out :)
 

311

311

Level 4
Joined
May 12, 2019
Messages
73
aww :( Well I cant use regenHP because some units do regen HP. Also for Def, I cant just give my units different def for no reason :(
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
BloodSoul's suggestion looks great but if you didn't want to use "Units within 600 range" and instead wanted it to be a global effect I would suggest storing each team's units into a Unit Group. This way we can avoid Picking every single unit in the game and just pick through the ones that matter.

------------------------------------------------
Events:
A unit enters the map

Conditions:
Unit belongs to an ally of player 1

Actions:
Add triggering unit to Team 1 Unit Group
------------------------------------------------

------------------------------------------------
Events:
A unit dies

Conditions:
Unit belongs to an ally of player 1 OR you could check "Unit is in Team 1 Unit Group"

Actions:
Remove triggering unit from Team 1 Unit Group
------------------------------------------------

Note: I'm not sure if this will work with heroes dying/reviving. Does a reviving hero trigger an Enters the map event? If not, you'll have to use the "Hero revives" Event to add Heroes back to their Team Unit Group after they revive.

Then using BloodSoul's trigger change the "Pick every unit within 600 range" to "Pick every unit in Team 1 Unit Group".

To do this you'll need to check which Team that dying unit belongs to. So "If dying unit is in Team 1 Unit Group then do the Pick every unit in Team 1 Unit Group. Else: If dying unit is in Team 2 Unit Group then do Pick every unit in Team 2 Unit Group.

Note: Make sure that the Heal trigger runs BEFORE the unit is removed from it's Teams Unit Group. Because we will have two triggers now, the first one does: "When a unit dies remove it from Unit Group" and the second one does: "When a unit dies check which Unit Group it's in and do the heal stuff". You can see the problem, if you remove the unit from it's Unit Group first then the second trigger won't work.

Also, maybe you'd be interested in this. Not sure if it's too heavy on performance but I think this would let you find which unit has the LEAST health in it's Unit Group and heal that specific unit:
SortGroup [GUI Friendly]
 
Last edited:
Status
Not open for further replies.
Top