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

Targetting a random unit matching condition

Status
Not open for further replies.
Level 2
Joined
Dec 9, 2013
Messages
11
So I made this trigger:

Unit Group - Pick every unit in (Random 1 units from (Units within 1000.00 of (Position of Lion) matching ((((Matching unit) is in Heroes) Equal to False) and (((Matching unit) is in GateGroup) Equal to True)))) and do (Actions)
Loop - Actions
Unit - Order Lion to Special Archimonde - Finger Of Death (Picked unit)

How come it still targets a unit that does not belong to GateGroup? It does a good job in not targeting units in group Heroes.
 
Level 2
Joined
Dec 9, 2013
Messages
11
I'm absolutely sure. Also, what does leaking mean? I've heard of it but so far my game has been fine for me... I'm not sure what I'm "fixing".

Edit: never mind about the leaks, I might fix it if I'm bored and want to go over every trigger I made hehe. I'm more interested in the problem at hand to be honest.
 
If you create a point for example, it will take a bit of the memory.

Wc3 is nap, and it doesnt free this memory again after the usage.

So we set a point variable to our location we need, then we work with this variable.
And if we dont need the location anymore we write "call RemoveLocation(variable)" to free this memory again.

If you dont remove memory leaks, it may cause lags & spikes after longer game time.
Hardcore it will be if you leak in a periodic triger which fires very often.

So better always remove memory leaks. In the link of my post above you can see what all leaks, and how to fix it.
______________

Have you tested it with DebugMessage if picked unit is in group?
 
Level 2
Joined
Dec 9, 2013
Messages
11
Yeah I checked, it's not in gategroup.

I now fixed it by making him an ancient and making the finger of death spell non-ancient targetting... it's not optimal but it gets the trick done.

I'd be really interested still in why it doesn't work.

Edit: should I have said "(...) Finger of death (Matching unit))" ?
 
Level 2
Joined
Dec 9, 2013
Messages
11
I attached it.

It's the trigger called "Gate Lion Finger of Death" in the "Gate rs5 category". It is initiated in the "Gate Initialization".
 

Attachments

  • CLASH.w3x
    280.3 KB · Views: 41
You use finger of death to 'matching unit'. Use 'picked unit' instead.

You leak. Read Things that leak

If you remove a unit out of a game, there is no need to remove this unit out of unitgroups.. they will be removed automativally :)

Instead of turning all these trigger on/off you could set a boolean = true/false... and add in all these trigger the condition "YourBoolean Equals True".

Edit:

I just noted yout code sometimes is not MUI (Multi-Unit-Instanceability), that means it wont work for more units at once without bugging.
You use 'waits' and this can be dangerous at making things not MUI. Always use 'triggering unit' if you can, because This is MUI, others can usually get overwritten during the wait, and your reference after the wait will be wrong.

Or if you need bit more complexe you can read this.
 
Level 2
Joined
Dec 9, 2013
Messages
11
But if I set a Boolean will it not start running every second (and turn it off again because boolean will be false), while most of the map isn't about this one particular event? I thought I'd just turn them on/off for this event and then keep them off for the rest of the game.

Additionally, if I remove leaking with special effects they advise me to instantly (after placing the special effect) remove it, will this not end up in them not showing?
 
I don't know when you use the events in game, but no I think you're wrong here.

If trigger wont fire because of a conditions or because it's turned off doesnt make a real difference.
You use events every 60 seconds for example. Lets imaginary count to 30, and then we turn on this trigger.
Now because of 'each 60 seconds' it will get fired after 60 seconds (you think)
But it will fire after 30 seconds, because it already counts the 30 seconds when if was turned off.
 
Status
Not open for further replies.
Top