• 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.

How to make minions follow a necromancer?

Status
Not open for further replies.
Level 9
Joined
Jun 13, 2010
Messages
365
I cannot figure out this bug..

Hi guys

I have newly updated this question with a new one. Not yet solved.

Btw, thx for the guidelines for the wander system! I will look into it! :)
And the buff issue is solved as well, thanks for the help.

Now to the new question...
I am trying to make a Hero create units when he uses an ability.
His ultimate ability will deal damage in a target area equal to surrounding units created. Trigger follows.

For some reason it doesn't work. The first Unit Group - Pick works.. But the second doesn't. The strange part however is, if I change the position of the 2 Unit Group - Pick ladders, it will accour then..
Is there some kind of rule saying not 2 Unit Group - Pick actions can go at in the same trigger.. Maybe?

The Game texts are for tests and so is the 500 damage taken to the caster... He kills himself if I rotate the two action ladders... If it is as it stands there, nothing happens to him.

  • Coretremble
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Earthen Heart (Coretremble)
    • Actions
      • Set ASpell_Caster = No unit
      • Set ASpell_AreaTarget_Enemy = No unit
      • Set ASpell_AreaTarget_Ally = No unit
      • Set ASpell_Counter = 0
      • Set ASpell_Caster = (Triggering unit)
      • Set ASpell_Point = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units within 400.00 of (Position of ASpell_Caster)) and do (Actions)
        • Loop - Actions
          • Set ASpell_AreaTarget_Ally = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of ASpell_AreaTarget_Ally) Equal to Wild Rune
              • (Owner of ASpell_AreaTarget_Ally) Equal to (Owner of ASpell_Caster)
            • Then - Actions
              • Set ASpell_Counter = (ASpell_Counter + 1)
              • Game - Display to (All players) the text: (String(ASpell_Counter))
              • Special Effect - Create a special effect at (Position of ASpell_AreaTarget_Ally) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Kill ASpell_AreaTarget_Ally
            • Else - Actions
      • Unit Group - Pick every unit in (Units within 200.00 of ASpell_Point) and do (Actions)
        • Loop - Actions
          • Set ASpell_AreaTarget_Enemy = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ASpell_AreaTarget_Enemy is A structure) Equal to False
              • (ASpell_AreaTarget_Enemy is Magic Immune) Equal to False
              • (ASpell_AreaTarget_Enemy belongs to an enemy of (Owner of ASpell_Caster)) Equal to True
              • (ASpell_AreaTarget_Enemy is dead) Equal to False
            • Then - Actions
              • Game - Display to (All players) the text: (String(ASpell_Counter))
              • Unit - Cause ASpell_Caster to damage ASpell_Caster, dealing 500.00 damage of attack type Spells and damage type Normal
              • Unit - Cause ASpell_Caster to damage ASpell_AreaTarget_Enemy, dealing ((Real(ASpell_Counter)) x (0.55 x (Real((Intelligence of ASpell_Caster (Include bonuses)))))) damage of attack type Spells and damage type Normal
              • Unit - Cause ASpell_Caster to damage ASpell_AreaTarget_Enemy, dealing ((Real(ASpell_Counter)) x (0.05 x (Max life of ASpell_Caster))) damage of attack type Spells and damage type Normal
              • Unit - Set life of ASpell_Caster to ((Life of ASpell_Caster) + ((Real(ASpell_Counter)) x (0.05 x (Max life of ASpell_Caster))))
            • Else - Actions
      • Custom script: call RemoveLocation (udg_ASpell_Point)
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,658
I recommend you to make a special group and add all the units (minions only) in it.
Then you also save their necromancer in a unit array using the custom value of the minion as index (default Unit Indexer results/solution).

Or when you want even better performance, a group for each necromancer containing only their minions.
... or even better than that, a Linked List containing the minions... but that gets really annoying in GUI :D

In any case, you will end up having an average-interval-periodic-timer which uses a lot of locations/groups. You don't seem to be familiar with the leaks that they cause so you might want to search a bit about "Warcraft 3 location/group leaks".
 
Level 9
Joined
Jun 13, 2010
Messages
365
I recommend you to make a special group and add all the units (minions only) in it.
Then you also save their necromancer in a unit array using the custom value of the minion as index (default Unit Indexer results/solution).

Or when you want even better performance, a group for each necromancer containing only their minions.
... or even better than that, a Linked List containing the minions... but that gets really annoying in GUI :D

In any case, you will end up having an average-interval-periodic-timer which uses a lot of locations/groups. You don't seem to be familiar with the leaks that they cause so you might want to search a bit about "Warcraft 3 location/group leaks".

What does that mean..? xD
So I'm supposed to put them in a group. But I don't follow how it will resolve this:
There may be multiple necromancers, 1 per player, with each group of minions.
Only the minion that leaves area of the Necromancer will be moved to him, and not the entire group.

But do you mean that this whole system is a no-go?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
That was supposed to be in addition to what Chaosy said.

Searching for a system that does what you want is often a much more recommended approach than making something yourself... unless your name is Wietlol.
So if Chaosy says there are 2 systems that pretty much do what you described, you should definately check those out then.

However, even when you are using those systems, your trigger that you have to use those will still be a periodic loop that contains leaks. (Yes it will have them.)
And unless you remove those leaks, you will see increasing lagg in your map when you play for too long... and I can tell you, that is not fun to play.

So when you have implemented and are satisfied with either of the wander systems, you then check out some threads/tutorials about location/group leaks to remove those.
But first check out those systems.
 
Level 9
Joined
Jun 13, 2010
Messages
365
There are two wander systems in the spell section that you can use for this purpose rather easily. Just update the position periodically.

Oh I guess I misread what you were suggesting. I thought there were 2 kinds of the wander ability in the object editor.. <.<

I will try checking them out.. I assume they would just be under "Tutorials"?
Never really fully checked this forum out. ^^

But I seem to have hard time understanding what GUI means.. Cant really google any useful results.
 
Level 12
Joined
May 9, 2009
Messages
735
Firstly, are you just using the locust ability for them to be unselectable? Locust makes them go through stuff as well, it's not ideal. I learned this trick a while back to make units unselectable but still have collision by using the chaos ability.

I think this shouldn't be too hard. Make a periodic trigger for every 2-5 seconds and check and pick all minion type units and check if there is a necromancer nearby. If not, then order them to follow to the necromancer's location, if yes then order them to move to a random nearby location (don't use wander, it screws with combat capabilities as units keep running away).

GUI stands for Graphic User Interface, I believe. It refers to the interface that is presented in the world editor's trigger editor. Some people instead of using the GUI instead write their own JASS code for superior triggers.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
I will try checking them out.. I assume they would just be under "Tutorials"?
Never really fully checked this forum out. ^^
Try spell section.

But I seem to have hard time understanding what GUI means.. Cant really google any useful results.
GUI is short for Graphical User Interface... also used as Gooey (properly pronounced as both "goo-e" and "gee-you-i").
In the world editor of Warcraft III, there is a trigger window, where you can create your triggers, there are two different ways of creating the code/script.
1, Using JASS (including all the versions of it).
2, Using a "Trigger".

The second one is a GUI version of a script and allows you to "easily" understand and make a script.
However, that comes with limitations and may be very much slower to both make and use (performance-wise) than writing a proper JASS script.

(Be aware that MUI is nowhere the same as GUI even though the abbreviation looks the same... this comes with many laughable quotes like "I rather have GUI or MUI than JASS" or "Why use MUI when we have GUI".)

Firstly, are you just using the locust ability for them to be unselectable? Locust makes them go through stuff as well, it's not ideal. I learned this trick a while back to make units unselectable but still have collision by using the chaos ability.
First things first... stop using Chaos!
Chaos is the same as pausing units via triggers. It is an amazing thing... until you see the side-effects.
Better use a reversed transformation ability (which is also often used) inproperly named "Hero Passive Transformation" (because it is not "Hero-only" and is not necessarily "passive").

I think this shouldn't be too hard. Make a periodic trigger for every 2-5 seconds and check and pick all minion type units and check if there is a necromancer nearby. If not, then order them to follow to the necromancer's location, if yes then order them to move to a random nearby location (don't use wander, it screws with combat capabilities as units keep running away).
A properly designed wander system will check if the unit is doing nothing before it makes them wander to some place... I didn't check any of the wander systems so they may or may not be that well designed but if they are, then there is little need of creating this from scratch.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
when they leave an area of 1500 yards.
Which is how much in WC3 units? I cannot seem to find a conversion anywhere from yards to WC3 units.

I know in SC2 each tile represents ~1 meter. If we assume the same for WC3 that means 128 WC3 units per meter. As 1,500 yards is ‪1,371.6 meters, this means that it must be 175,564.8 WC3 units in range. ‬

To make the unit uncontrollable you need to use order cancellation. Ward classification (or something similar) hides most abilities except you can still order the unit to attack targets and move. Order cancelation is done by in response to an issued order event waiting 0.00 seconds (0 second timer, not TriggerSleepAction) and then issuing a new order. The delay is needed because the event runs the trigger before the event response order is issued to the unit so issuing any orders then will be cancelled out by the event response order.

You will need some sort of MUI system, it is the only way to know which summon belongs to which hero. Instances could be per hero (with unit group for summons) or per mapping (1 summon to hero relationship).

If the distance between any of a hero's summons is greater than 175,564.8 then teleport them nearby. You iterate through all instances every few seconds performing this test. You can also use this periodic trigger as the summon's tactical AI function so that they have more intelligent behaviour (using abilities, prioritizing certain enemies etc).

A secondary question I have got is this:
I have an Ice Revenant Hero with 3 different types of abilities, which each lays a different slow buff on enemies.
Now I want a fourth ability to trigger the buffs, by counting them (only those 3, not all the unit possess, including some the Ice Revenant haven't given).
So it is supposed to trigger only his buffs on the enemy target, so that I can make him deal fx 100% intelligence as damage for each buff on the target. How do I make this happen? :)

I can make it count with an Integer Comparison the number of buffs on the target... That doesn't include other buffs..
I can then check for buffs with a condition.. But I check for buff-types on the unit..
It is actually rather frustrating when you try making something advanced, it cannot just be advanced, but you also have to learn all other new systems and programs.. -.-
You need to test for specific buffs and increment a counter if present. You set a counter (integer variable) to 0. Then you test if the unit has the specific buff (in JASS this is checking if the buff type ID has a level greater than 0, GUI maps it nicely to some function) and if it does you then increment the counter by 1. Repeat this with different tests for all 3 buffs. The counter will end at a maximum of 3 since if all 3 buffs are present it will be incremented by 1 a total of 3 times.

You can then use the counter value to compute the amount of damage you want to do.
 
Level 9
Joined
Jun 13, 2010
Messages
365
Which is how much in WC3 units? I cannot seem to find a conversion anywhere from yards to WC3 units.

Sorry I just didn't know what terms you used in WC3... ^^
To make the unit uncontrollable you need to use order cancellation. Ward classification (or something similar) hides most abilities except you can still order the unit to attack targets and move. Order cancelation is done by in response to an issued order event waiting 0.00 seconds (0 second timer, not TriggerSleepAction) and then issuing a new order. The delay is needed because the event runs the trigger before the event response order is issued to the unit so issuing any orders then will be cancelled out by the event response order.

I will look into it. Needs a bit testing i assume.

You will need some sort of MUI system, it is the only way to know which summon belongs to which hero. Instances could be per hero (with unit group for summons) or per mapping (1 summon to hero relationship).

Can't I just go the unprofessional way and create a group for each player and a Hero variable for each player and combine those two?
So minions goes to the group. I am unfortunately too lazy to learn MUI.. I just want it to work. I know it's my own problem tho. ^^


You need to test for specific buffs and increment a counter if present.

Found it, thx. Just oversaw it I guess. The hard part is really not making it. It's finding everything and know what it does and the limits for it. ^^

I got a question for you, if you would mind helping? :)
It is written in the primary question, just edited it to avoid spamming threads.
If you got the time ofc. :)

And thx for the help! :)
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
I got a question for you, if you would mind helping? :)
It is written in the primary question, just edited it to avoid spamming threads.
If you got the time ofc. :)

And thx for the help! :)

Why not make a new thread?
This thread is about "how to make minions follow necromancer?".
You should make another thread with "Unit group loops are not working correctly.".

Better organize the threads than having multiple unrelated questions in one thread at the same time.



About the actual problem:
Leaks:
1 location
2 groups
1 looping "kill unit"
1 looping location

Also, try to not kill the caster in the second loop.
 
Level 9
Joined
Jun 13, 2010
Messages
365
Why not make a new thread?
This thread is about "how to make minions follow necromancer?".
You should make another thread with "Unit group loops are not working correctly.".

Better organize the threads than having multiple unrelated questions in one thread at the same time.

I just got restricted for making too many threads... So I decided to do something about it somehow, without coursing too much trouble. :p


About the actual problem:
Leaks:
1 location
2 groups
1 looping "kill unit"
1 looping location

I believe I have checked everything through.. And as I said, I've tryed reorganizing the chain action, which actually makes it run the second Group action. But it will only run one of the Group actions at a time.. Strange.

Also, try to not kill the caster in the second loop.
I only added that to see if it actually worked or if it was the integer that was bugging.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
They can never run at the same time.
But they should run both right after each other before anything else can happen.

About the leaks,
Killing a unit with that action leaks.
You should rather give it a 0.01 seconds expiration timer.
You leak a location where you create the special effect.
You leak groups because you dont destroy either of them.
You leak another location when you create the first group.
 
Level 9
Joined
Jun 13, 2010
Messages
365
They can never run at the same time.
But they should run both right after each other before anything else can happen.

About the leaks,
Killing a unit with that action leaks.
You should rather give it a 0.01 seconds expiration timer.
You leak a location where you create the special effect.
You leak groups because you dont destroy either of them.
You leak another location when you create the first group.

Okay so let me get this straight.
1: If I set a variable for a point and then create a group, the point is used up, even though it is not included in the action?
2: Same for a special effect? But the special effects are spawned at the positon of a unit, not a point. Does that leak too, even though I remove it?
3: I create a group no matter if I just pick units? How can I destroy it then?

Btw I just gave an expiration timer to 0.01, instead of kill action and it works. How come?? :O
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
1, You do know that you are creating a new location when you create the first group right?
There is no variable in your first group.
2, The position of a unit creates a new location using the coordinates of the unit (which are used in the back end). So when yo do (Position of <unit>), you create a new location.
3, You can use the same method as locations by calling "DestroyGroup(udg_mygroup)" or you can do "set bj_wantDestroyGroup = true" as custom script just before you loop through the group (before you create it as well).

It all depends on how the actual back end is working and I am not 100% sure of how it does that.
But in any case, it is always good to just take a few things in consideration while making a trigger... and leaks are not the least of them.

EDIT:
Ow yea, one more thing.
It is a good habit to organize the effect of your spell better for additional effects and efficiency.
For example:
Make unitX deal damageA to unitY.
Make unitX deal damageB to unitY.
Should be:
set damage = damageA + damageB.
Make unitX deal damage to unitY.

Equal as removing the heal from the loop and counting the total healing value and heal the caster after the loop is done.
 
Status
Not open for further replies.
Top