• 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] Autocast Ability - Performance?

Status
Not open for further replies.
Level 4
Joined
Nov 22, 2006
Messages
28
I´ve a question about performance. I made some abilities autocasting with the following trigger:

Autocast Chain Lightning
Events
Unit - A unit Is attacked
Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Attacking unit)) Equal to Something 1
(Unit-type of (Attacking unit)) Equal to Something 2
(Unit-type of (Attacking unit)) Equal to Something 3
Actions
Unit - Order (Attacking unit) to Orc Far Seer - Chain Lightning (Attacked unit)

But i´m afraid that´s going to lag because it´s a TD with many (95% non-autocasting but fast attacking) towers. I guess it´s laggy to check 250x times per second if the attacking tower is an autocasting one. Is it better to work with channeling abilities? Or to give the Order to every tower without the "if"?

I also tried a autocasting dummy spell but it worked not very well and i don´t want two visible spells.
 
Level 4
Joined
Nov 22, 2006
Messages
28
And what unit do i add to this unit group? I never heard that "Attacking unit" oder "Attacked unit" leaks. I usually destroy unit- and player groups, special effects and points :p

I hope the normal way is also a performant way. Maybe it´s better to add the towers to a trigger autocast the spell if they do damage?
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Make a unit group(global).
Make a trigger when a unit with the ability enters playable map area, add it to the group, and there should be an action that adds the following event to another trigger:
Entering unit(or triggering) attacks.
This trigger should have no events at the first place, no conditions, just Unit - Order (Attacking unit) to Orc Far Seer - Chain Lightning (Attacked unit).
You might also want to add triggers when the unit is sold(killed/removed) to remove it from the group, then reset trigger 2 to remove the custom added events then pick every unit in the group, and add the event the picked up unit attacks to the second trigger).
A bit roughly explained, nothing said about leaks but it will do the job.
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
every 0.01 seconds
Creating a group
Enuming all units in that group
ordering them to do something
and destroying to group

wont make a visibile lag
so ur fine
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Won't work here.
As it should order them to do it when they attack something.
It might cause lag, as it is a td - lot of towers.
Using a normal A unit attacks will cause as much or potentially more lag than what you suggested(whether all towers have that ability).
P.s. In TDs when there is a permanent lag such a function would be catastrophic.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Depending on two things:
How many towers(any kind) there are on the map
And how fast these towers attack.
Surely if there 1000(for example) and each attack 100 times a sec 100000 executions per second is just a lot.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
But i don't suppose that autocasted spells go with horrible speed. For me, the atkspeed of them is averagely 1 and not 0.01. And sure there are VERY few tds which contain about 1k towers

Doesn't really matter what the speed of the spells is(cooldown).
The trigger fires when the unit attacks.
You are right though, such a situation is very rare.
But it is a matter of principles ;)
 
Level 12
Joined
Aug 10, 2004
Messages
1,141
Hm............
I know...... you probably want to get good with triggers.....

But.... THere is a Nightelf Upgrade for the Hunters that you can use....
It makes the attacks bounce.....
-Just change the animation/Lightning effects and you have chain o' lightning....
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
I believe he was referring to Sserpyc.
That would work with chain based abilities.
But what about other abilities?
 
Level 12
Joined
Aug 10, 2004
Messages
1,141
Who were you reffering to when you said "get good with triggers"?
Was it me?
I thought that I was pretty good with GUI.

Nah the OPer :p
I'm sure you are :)

That would work with chain based abilities.
But what about other abilities?

I'm not sure... But worth a shot....
ANd if it doesn't it would be just as simply coded to add the Lightning effects... I think...
I'm not around and havent done this before...
But ANIMATION actions probably could do the trick...
 
Level 4
Joined
Nov 22, 2006
Messages
28
I´ll stick to my original plan.

Autocast Chain Lightning
Events
Unit - A unit Is attacked
Conditions
Or - Any (Conditions) are true
Conditions
(Unit-type of (Attacking unit)) Equal to Something 1
(Unit-type of (Attacking unit)) Equal to Something 2
(Unit-type of (Attacking unit)) Equal to Something 3
Actions
Unit - Order (Attacking unit) to Orc Far Seer - Chain Lightning (Attacked unit)

The casting towers are quite slow but the normal towers are fast. We´ll see...
 
Status
Not open for further replies.
Top