(PLEASE SEE LATEST COMMENT BELOW FOR THE ACTUAL CAUSE OF THE PROBLEM)
In the link below, I created a custom unit to fire while moving and look the direction its firing.
Every time it dies, it lags the entire game, for about 2 seconds. There are no triggers attached to the unit and just to double check, I disabled all triggers to test. Still lags like crazy. It is clear to me now the actor modifications have caused significant lag to the unit when it dies. I know this because when I took my modifications out. Boom, no more lag.
I have an update on this situation. It has nothing to do with the actors. Correlation does not always = causation. While I did remove my actor effects, and it happened to work once or twice, I failed to test it multiple times. It turns out the actors are not the problem. It is a single behavior. When I remove the behavior from the unit, everything works properly and I have tested dozens of times. My only conclusion is it is either this single behavior, or a combination of this behavior and something else.
My behavior works as follows. It is a damage resistance buff which is applied while the target is moving and unapplied while standing still. I've modified the damage taken field in behavior buff.
Ahh, I was thinking the "caster is moving" you can alter "Caster" to "source" and it may work.
It be just be how the game calculates moving, and how many times per second it is forced to calculate it; and then add and remove the behavior.
If the game is adding/removing your behavior 30 times per second; that would quite easily explain the lag. Or even try a "Greater than .1, less than .1" to test if maybe there is a flicker of movement somewhere in there.
(PLEASE SEE LATEST COMMENT BELOW FOR THE ACTUAL CAUSE OF THE PROBLEM)
In the link below, I created a custom unit to fire while moving and look the direction its firing.
Every time it dies, it lags the entire game, for about 2 seconds. There are no triggers attached to the unit and just to double check, I disabled all triggers to test. Still lags like crazy. It is clear to me now the actor modifications have caused significant lag to the unit when it dies. I know this because when I took my modifications out. Boom, no more lag.
You can find my modifications here.
https://www.sc2mapster.com/forums/development/data/131517-modified-actor-follows-target-while-firing-and-moving/#p1
I've added them in a quick summary here for easy viewing.
When the unit dies, with the added attachments from the above game, it lags the game for 2 seconds.
How do I destroy the appropriate actors I need to destroy or make the necessary adjustments to keep my modifications?
@onlyleviathan: Go
Disregard my earlier comment I posted here. I was mistaken.... Still investigating the cause of the lag.
@onlyleviathan: Go
I have an update on this situation. It has nothing to do with the actors. Correlation does not always = causation. While I did remove my actor effects, and it happened to work once or twice, I failed to test it multiple times. It turns out the actors are not the problem. It is a single behavior. When I remove the behavior from the unit, everything works properly and I have tested dozens of times. My only conclusion is it is either this single behavior, or a combination of this behavior and something else.
My behavior works as follows. It is a damage resistance buff which is applied while the target is moving and unapplied while standing still. I've modified the damage taken field in behavior buff.
The way the behavior is removed and added back is with unit speed validators.
Strange that such a simple behavior would cause so much lag when the unit dies.
I might also add that if you test it and hold the unit still so the behavior is not activated, the lag still occurs.
A speed validator? like a validator that checks the current speed of the unit? Have you tried it with the more simple "is moving" validator?
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
@GlornII: Go
It is of type "Unit compare speed".
I noticed it in the Multi Swarm mod dependency on the wraith singularity anchor.
I have not seen a validator in the list that simply says, "moving" or "not moving".
To which validator type are you referring?
Ahh, I was thinking the "caster is moving" you can alter "Caster" to "source" and it may work.
It be just be how the game calculates moving, and how many times per second it is forced to calculate it; and then add and remove the behavior.
If the game is adding/removing your behavior 30 times per second; that would quite easily explain the lag. Or even try a "Greater than .1, less than .1" to test if maybe there is a flicker of movement somewhere in there.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
@GlornII: Go
Correction! This problem is solved!
I did change to source, and I changed the validator type from "Remove behavior" to "Disable Behavior".
Should of thought of that to begin with. Sometimes the simplest things cause the craziest issues.
Thanks for the help Glorn.
Usually lag is caused by too many polygons or periodics.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg