| 04-11-2005, 07:46 PM | #1 |
just what the title says, is there a way to get this? (EX. random point in region matching condition terrain-type = Dungeon - Square Tiles) |
| 04-11-2005, 08:26 PM | #2 |
Code:
function GetRandomLocMatchingCondition takes rect r, boolexpr cond returns location
local location loc
set loc = GetRandomLocInRect(r)
loop
exitwhen cond == true
call RemoveLocation(loc)
set loc = GetRandomLocInRect(r)
endloop
return loc
endfunctionI think thisll do it, but im not sure if the boolexpr can be set to use the local rect if you pass it. Try it out, otherwize, use globals. |
| 04-11-2005, 11:19 PM | #3 |
anyway to do this in GUI Im not that great with JASS nvm Im very stupid and just had to think to figure this one out >< Code:
Change Terrain
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Set Test = (Random point in (Initial camera bounds))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain type at Test) Equal to Dungeon - Square Tiles
Then - Actions
Camera - Pan camera for Player 1 (Red) to Test over 1.00 seconds
Environment - Change terrain type at Test to Dungeon - Lava using variation -1 in an area 1 and shape Square
Wait 4.00 seconds
Environment - Change terrain type at Test to Dungeon - Square Tiles using variation -1 in an area 1 and shape Square
Else - Actions
Trigger - Run (This trigger) (checking conditions) |
| 04-12-2005, 01:44 AM | #4 | |
Quote:
Sweet5, that's the best way, just make sure to clean the leaks |
| 04-12-2005, 04:15 PM | #5 | |
Quote:
=/ I still have problems understanding what leaks and how to clean it up. I set all the points to varibles so doesn't that prevent the leaks? or did I forget somthing? |
| 04-12-2005, 07:06 PM | #6 |
you have to put Custom Script: call RemoveLocation( udg_Test ) at the end a quick lowdown on the mem leaks, when you say Test = (random point in blah blah) war3 makes a little piece of data that represents the point say (0,4) which goes into memory -- variable Test fits into here because when you access Test, test actualy redirects you to the little bit of data represting (0,4)... now, when you say Test = (random point in blah blah) war3 again, it creates a new bit of data represting maybe (3,21) this time and Test points itself to that bit of memory so whenever you use Test you now goto the point (3,21) but what happened to (0,4)? it basically got left in memory with nothing 'pointing' to it (ie no variables know where it is in memory) hence it leaked and is just going to sit in memory taking up space, and doing nothing until the map ends this is why you have to 'destroy' the data (0,4) in memory before making Test point to something else so that piece of memory is free to be used again |
| 04-12-2005, 09:08 PM | #7 | |
Quote:
|
