| 04-16-2005, 05:07 AM | #1 |
Here is the trigger... Code:
Area Creation
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Set RandomPoint[1] = (Random point in Building_Area[1])
Set RandomPoint[2] = (Random point in Building_Area[2])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Terrain type at RandomPoint[1]) Equal to Cityscape - Brick
(Terrain type at RandomPoint[1]) Equal to Cityscape - Square Tiles
Then - Actions
Environment - Change terrain type at RandomPoint[1] to Cityscape - Grass Trim using variation -1 in an area 1 and shape Square
[b]Environment - Turns terrain at RandomPoint[1] Buildability pathing to On
Else - Actions
Trigger - Run (This trigger) (checking conditions)[/b]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Terrain type at RandomPoint[2]) Equal to Cityscape - Brick
(Terrain type at RandomPoint[2]) Equal to Cityscape - Square Tiles
Then - Actions
Environment - Change terrain type at RandomPoint[2] to Cityscape - Grass Trim using variation -1 in an area 1 and shape Square
[b]Environment - Turns terrain at RandomPoint[2] Buildability pathing to On
Else - Actions
Trigger - Run (This trigger) (checking conditions)[/b]Now, there are two problems with this trigger. The bolded areas show the 2 actions that have the problems. Problem One: Trigger - Run (This trigger) (checking conditions) crashes WE, it does not crash WE when I have only 1 if/then/else running though. Im assuming this is because at certain times both points picked do not meet my conditions and the trigger is re-run twice at the same time. In that case I think I could fix it by creating serperate triggers. EDIT: FIXED WITH SEPERATE TRIGGERS. Problem Two: Environment - Turns terrain at RandomPoint[2] Buildability pathing to On. In the actions before this I change a spot of size 1 to grass, and so I want to make that grass buildable. BUT Environment - Turns terrain at RandomPoint[2] Buildability pathing to On only turns 1 point, the picked point of that grass to buildable. I think the way to get around this would be to either use offsets?? Or to run a trigger at the end of the 120 sec randomization time that changes all grass to buildable terrain...but Im not sure how to do either one. So if you know how to solve either of my problems, please do help :) |
| 04-16-2005, 09:42 AM | #2 |
Guest | Pb1: Maybe it's that you can't change the pathing of a point, rather of a region. |
| 04-16-2005, 10:41 AM | #3 |
Your first problem was most likely a very interesting infinite probability loop. If the random points happen to be on the right tiles the first time the trigger runs, then everything is allright. However, if not, things can only get worse. If it's wrong on the second if-then-else, then it will just run itself again. However, if it's wrong on the first if-then-else, it will run itself again untill it is for once right on both if-then-elses, but once that happens, both point variables will already be grass, so all the triggers that will be waiting on the stack to do the second region check will definitely turn out false and spawn out new threads. At the same time, more and more of your terrain will be turned to grass, thus decreasing the chances of a trigger being right on both conditions. Eventually, you get grass everywhere and then it becomes an absolute infinite loop. That is still a danger even now, every 10 seconds, you have less chance of getting a tiled square with your random point, requireing the trigger to run more times to find one. I don't know what will happen sooner, either memory leaks from so many trigger runs will clog up the memory (you leak 1 point object every time the trigger runs, and it runs more and more times every 10 seconds) or you will run out of tiled squares... Or, your map takes little enough time to finish so you don't ever get to this problem. |
| 04-16-2005, 03:53 PM | #4 |
Well, if you noticed, I solved problem one. And it wont kill the memory too bad, if that much at all because that trigger only runs 12 times, stops 120 seconds after game starts. Well, 12*5 players so more like 60 times. And I also added the thing to get rid of the leak that vexorian talked about a couple threads ago... Custom Script: removelocation or somthing ( dont have my editor open ) so that should get rid of the leaks. |
| 04-17-2005, 04:19 AM | #5 |
Well, Shvegait cooked me up a JASS function to solve problem 2, and I solved problem one awhile ago so YAY! If you want to use the function, you can download it here... http://www.wc3jass.com/viewtopic.php?p=1997#1997 |
