| 02-22-2007, 07:20 PM | #1 |
Hey. My brother is trying to make the trees in his map regrow after a while, provided they aren't too close to buildings or units. However his attempt at this lags. I cannot show you what he tried, as it is on his computer, but it was made in GUI, and doesn't work anyway, due to the lag. Anyway, how would you recommend doing this without it lagging really badly? |
| 02-22-2007, 07:36 PM | #2 |
JASS:function Trig_Doodad_Ressurection takes nothing returns nothing call DestructableRestoreLife(<the tree>,0.00,true) endfunction To revive it, and if you need conditions : JASS:function Trig_Doodad_Ressurection takes nothing returns nothing if //conditions then call DestructableRestoreLife(<the tree>,0.00,true) endif endfunction |
| 02-22-2007, 07:39 PM | #3 |
Should it be a periodical event or only happen once? |
| 02-22-2007, 07:52 PM | #4 |
Sorry, forgot to specify, periodically. However, he doesn't want it to look like a load regrow at once, then a wait, then repeat. The main problem is that it seems to involve enuming through the maps destructables, and there are a -LOT- of those... |
| 02-22-2007, 08:00 PM | #5 |
I think i got a solution, i'll finish it and send it, but my wc3 is bugged so i'm unable to test it. |
| 02-22-2007, 08:05 PM | #6 |
Thanks. =) I'll test it when you do, and get back to you. |
| 02-22-2007, 08:25 PM | #7 | |
Alright, you'll need 2 triggers. 1. Add all events to the target trigger. Trigger:
How to do: 1. create a game cache variable called gc 2. Make new Trigger call it however you want to 3. copy H2I and I2Des into the Custom Script Code Section (The Map icon in the trigger editor) 4. copy the 2 constant functions and LoopReviveDestructables into your new trigger (have to be above the beginning function) 5. now copy all actions from StartReviveDestructables into your trigger and it should work, at least if i didn't make something wrong, so try it first in a test map. Description: The function StartReviveDestructables creates a Timer and stores the destructable as integer into the gamecach, then it call the Loop function which checks if there are any units in range, if there are none it'll revive the destructable, pause and destroy the timer to prevent further runnings. The 2 constant functions set the Duration between each pick and range is obviously the range in which units will be picked. |
| 02-22-2007, 09:36 PM | #8 |
I couldn't actually get that to work, no trees seemed to be reviving at all... If I add those events to a simple trigger to PolledWait() X seconds then revive the dying destructable, that works... As I'm not very experienced in JASS, I can't say as to why it isn't working, though... |
| 02-23-2007, 11:51 AM | #9 |
I think i know what you've forgotten, you forgot to init the game cache, i attached a working test map so you can check your triggers. |
| 02-23-2007, 09:27 PM | #10 |
Doesn't a Destructible group have a limit to 64 destructibles? |
