| 01-20-2007, 01:10 AM | #1 |
i dont know which is best. i have an ability that every player will be allowed to have and i dont really want to make 12 copies of the exact same trigger with trigger 1 referencing everything related to player 1.. then trig 2 for everything for player 2. so i'd figure i'd just do an integer A loop for 1 to 12 and wrap it up all nicely in one trigger.. which i can do with no problem.. however what worries me is this one thing. In the trigger i have a wait for condition of buff being on a target unit before following through with the rest of the actions. will this multi-instance without a hitch or is there going to be problems? the reason i ask is i know wait states within loops are not always a good thing.. and here i have one that will be repeated often.. X12 players.. each with the exact same spell.. triggering the same trigger.. Example would go something similiar to this: Code:
event -
unit casts an ability
condition -
ability = fire bolt
casting unit is a hero is = to true
event -
set HeroCasterVar[player number of owner of casting unit] = casting unit
set TargetUnitVar [player number of owner of casting unit] = target unit of ability being cast.
for each integer A from 1 to 12
Loop
if/then/else
if -
owner of casting unit = to player number integer A
then do -
Wait until TargetUnitVar [integer A] has buff "fire bolt stun"
Cause HeroCasterVar[integer A] to damage TargetUnitVar[integer A] for 100 damage.anyhow, i just typed that up to keep it short and sweet.. my actual trigger is long and complex. but this pretty much sums up the part that i worry about.. that "wait until condition" state underneath that loop.. Plus be multiinstance.. think there will be a problem or is this safe? |
| 01-20-2007, 05:47 AM | #2 |
any type of wait in a loop is a bad idea, unless the loop is using a local variable. I would suggest looking into damage detection systems, which can be found on these forums, to do that. |
| 01-20-2007, 02:47 PM | #3 |
do you say that because of a potential overlap of another player restarting my waitstate? even if the wait is seperated like it is per player with an array of 12? cuz like i have it up there.. there is no way that another player can start it because it's based of their own array size at the time. so if player 1 starts the trigger and the wait state is sitting there waiting to perform the other actions for it's array.. then another player triggers it and is waiting.. there should be 2 instances of waiting. should there not? or is it something else |
| 01-20-2007, 03:02 PM | #4 |
Yes, but the array will change during the time of waiting, so the second person to cast it would have the actions happen twice for him. |
| 01-20-2007, 03:09 PM | #5 |
What you say is true, there will be two instances of it waiting, But unless you use local variables both of those instances are trying to use the same variables. In the case of your example trigger, say your first trigger goes off. It sets the target unit to be X, and the casting unit to be Y. It's all fine until the second instance of the trigger begins. It sets those same two variables to A and B, meaning that both triggers are now looking at the same units. This is because those variables you set are global variables rather than local variables. The end result of this in our example is that unit A will be damaged twice by unit B, and X and Y won't have anything happen to them. Sadly, I can't give you a suggestion as to how to fix this because my brain is freezing up at the moment as to some technicalities and I wouldn't want to suggest something to you which will not work. |
| 01-20-2007, 05:04 PM | #6 |
okay that's what i was worried about. i understand what you both are saying. i just wanted it varified by someone else. i was hoping it wouldn't but had doubts it would be as you say. i just ran a test by putting a ton of units .. gave them all same spell.. no cooldown and ordered them to keep performing those actions to eachother and i did notice that some were not triggering it off and others seemed to trigger frequently. |
