| 02-10-2006, 07:32 PM | #1 |
I know this is a redundant question, but I'm a beginner. I'm creating a map that includes a large number of creeps that I need to respawn. They pnly need to respawn once but they actually respawn into a different creep. For example, when a centaur drudge dies, it is replaced with a polar furbolg. That part is easy enough, but the catch is that I don't want them to respawn for a considerable amount of time (around 240 seconds). I've tried a few different things but I'm worried about memory leaks and just using too much memory at once (for instance, when you've got 200 creeps that are all counting down to response, the game gets slow and may even crash, especially when there are multiple user or AI players in the game). Does anyone have any suggestions on how I can do this effectively? I'm not very JASS knowledgable, but I'm definitely trying to learn. Thanks! |
| 02-11-2006, 12:24 AM | #5 |
Yes, it is plagged by group leaks. Tons of them actually. |
| 02-14-2006, 07:27 PM | #6 |
Okay, I see them now. I'll be working on it, but I need helo with one thing. What custom script do I make to destroy particular array variables? For instance, if I want to destroy Temp_Type[Custom value of Dying Unit], what would that look like for a custom script? Thanks! |
| 02-14-2006, 09:14 PM | #7 |
Think outside the box once in a while. When the first unit dies, make it spawn a 240 second long spawn with locus ability, no model, etc., and give that an ability to spawn the required creep when it dies. This requires the creation of one unit, two abilities, and has no triggers. Elegent. |
| 02-14-2006, 10:08 PM | #8 |
A great suggestion. If you don't know where to find the ability, it's the one used by the hydra creep to spawn 2 lesser hydras when dying. As for the group leaks in your trigger, they are difficlut to fix, because when waiting for condition, you need to dynamically create the unit group, because if you use the same group all the time the condition will never be true. However, by dynamically creating the group, you leak, because you can't destroy it inside the "wait for condition" function which is the one creating the groups when it calls "units in range of location matching condition". |
| 02-15-2006, 02:49 PM | #9 | |
Quote:
Thanks. |
| 02-15-2006, 06:01 PM | #10 |
I think that it runs a lot faster when done via an ability and a unit, because it is then (correct me if I'm wrong), running using the game engine, rather than a script, which is a lot faster. |
| 02-15-2006, 07:21 PM | #11 |
Guest | It might get slightly complicated, but i would use locals with custom script. It may seem slightly ok now, but you need alot of varibles, and lots of integer to keep track of each varible array. If you use locals for each dying unit, it will respawn when it needs in no time. I could make you a function if you really need it bad. The main problem is varibles like UnitLocAfterDeath[UnitNumber]... You need to set UnitNumber up 1 after each death, and thats just 1 varible. if you use locals it would be something like this Code:
local unit u = GetDyingUnit() local location l = GetUnitLoc(u) call TriggerSleepAction(240) call CreateNUnitsAtLoc( 1, GetUnitTypeId(GroupPickRandomUnit(GetUnitsInRectAll(GetPlayableMapRect()))), Player(PLAYER_NEUTRAL_AGGRESSIVE), GetUnitLoc(u), GetUnitFacing(u) ) This would work fine, but after a long time, all the units would be the same. Unless you made a seprate trigger which removes a random unit and replaces it with a specific unit every, lets say, 140 secs, but only if its not im combat. Hope this is of good help to you :) |
| 02-15-2006, 08:10 PM | #12 |
Having 200 units with their life timers ticking down is hardly any worse than having 200 units without that, and since you would only create a dummy countdown unit whenever one of the original units died, I really don't see a problem why that wouldn't work. |
| 02-17-2006, 01:26 AM | #13 |
Okay, after having tried several different things and having limited success, I've actually abandoned the whole original idea in favor of another one that I like. Tell me if you think this idea sucks, how it could be improved, and if you think it'll even work or just be a pain in the butt. So, I've got groups of creeps scattered around that you fight through as you make your hero levels up and you hunt out your opponents. Instead of having creeps respawn like you typically see, there will be a few wandering neutral flyers that resurrect groups they happen to come across. Corpses will never disappear because they are permanent, so there's no worry about that. The benefit I see here is that it introduces a bit more variability to the game, you never know exactly what's going to happen because the flyers wander and ressurrect aimlessly. Additionally, if you can take them out (there'll be a few of them) you can stop creep respawning altogether and they'll drop useful items as well. What do you think? |
| 02-17-2006, 01:30 AM | #14 |
sounds like a good idea. not good if you're making a RPG though. |
| 02-17-2006, 01:56 AM | #15 |
