HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Easier Method?

01-28-2007, 06:25 AM#1
WNxCryptic
The following code (GUI) is for checking for neutral creeps in regions and generating creeps if there are none already present.

Trigger:
NeutralRed
Collapse Events
Time - Every 100.00 seconds of game time
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Units in NeutralRed1 <gen> owned by Neutral Hostile) is empty) Equal to True
Collapse Then - Actions
Set loc = (Center of NeutralRed1 <gen>)
Unit - Create 1 Enraged Jungle Stalker for Neutral Hostile at loc facing Default building facing degrees
Unit - Create 2 Elder Jungle Stalker for Neutral Hostile at loc facing Default building facing degrees
Custom script: call RemoveLocation( udg_loc )
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Units in NeutralRed2 <gen> owned by Neutral Hostile) is empty) Equal to True
Collapse Then - Actions
Set loc = (Center of NeutralRed2 <gen>)
Unit - Create 1 Enraged Jungle Stalker for Neutral Hostile at loc facing Default building facing degrees
Unit - Create 2 Elder Jungle Stalker for Neutral Hostile at loc facing Default building facing degrees
Custom script: call RemoveLocation( udg_loc )
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Units in NeutralRedAlliance <gen> owned by Neutral Hostile) is empty) Equal to True
Collapse Then - Actions
Set loc = (Center of NeutralRedAlliance <gen>)
Unit - Create 1 Dragon Turtle for Neutral Hostile at loc facing Default building facing degrees
Unit - Create 2 Giant Sea Turtle for Neutral Hostile at loc facing Default building facing degrees
Custom script: call RemoveLocation( udg_loc )
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Units in NeutralRedAncients <gen> owned by Neutral Hostile) is empty) Equal to True
Collapse Then - Actions
Set loc = (Center of NeutralRedAncients <gen>)
Unit - Create 1 Dragon Turtle for Neutral Hostile at loc facing Default building facing degrees
Unit - Create 2 Giant Sea Turtle for Neutral Hostile at loc facing Default building facing degrees
Custom script: call RemoveLocation( udg_loc )
Else - Actions

Now, that's a bit lengthy...and I'm not sure how well its actually executing (the creeps are being created alright..but I'm not sure how much memory is being used for it). If there is not a significantly better way to code it, are there any leaks in my above gui code?
01-28-2007, 10:39 AM#2
Themerion
It leaks unit groups, I think.

"(Units in NeutralRed1 <gen> owned by Neutral Hostile)"

Is a unit group which you have to destroy, afaik.
01-28-2007, 01:27 PM#3
iNfraNe
Correct, it leaks 4 groups.
01-28-2007, 02:14 PM#4
Themerion
Trigger:
Actions
Set TempGroup = (Units in Creep Region 00h <gen> owned by Neutral Hostile)
--- If TempGroup is empty, etc... ---
Custom script: call DestroyGroup(udg_TempGroup)

---


Now, I'd like to do some advertisment. :P

The backside with your function is that the creeps can leave the region, for instance when they are chasing player units. IF the trigger runs when they have run away, a new set of units will spawn, despite the fact that the old ones weren't dead.

I've created a system which automatically handles most stuff for you. It's called the Creep Respawn System.
01-28-2007, 04:41 PM#5
WNxCryptic
Yea after I put up this thread...I transfered over to a system that actually works amazingly well, and its tiny..only 25 lines of total code or so, and it works on every single neutral hostile creep in the map..

Thanks for the assistance though.