[Trigger] Delete all creeps from one player, except building

This is a forum where you can ask our code monkeys for assistance. Questions on technical help belong here.
Wolf_Guard
Posts: 4
Joined: Sat Nov 23, 2013 12:00 am

[Trigger] Delete all creeps from one player, except building

Postby Wolf_Guard » Sat Nov 23, 2013 8:07 pm

Well, just recently, I've decided to become the newest editor of a really old map that I used to enjoy a few years ago on WC3. Every time I hosted it, or joined someone else's version of this game, there would be a full-house within a few minutes... That's how good it was. I want to bring this map back, so people can experience and make a lot of good memories from this map, just like I have...

Jesse told me to post here, so he can better help and explain with my current situation. This map gets flooded with creeps very easily if there are too little players. I want to prevent that by having Red type -clearcreeps, so that the creeps will all be deleted off of the map. However, I do not want neutral-hostile's buildings deleted.

I already know where to begin with this. I just don't know what to put under 'Actions'. :X If you could explain it in great detail, I will worship the ground you walk on. It has been a couple years since I've messed with the World Editor to a real good extent.
User avatar
Tonex
Posts: 822
Joined: Sat Oct 29, 2011 12:00 am
Location: California Bay Area

[Trigger] Delete all creeps from one player, except building

Postby Tonex » Sat Nov 23, 2013 10:20 pm

The crudest version would be to use "Pick all units matching Condition" with the required conditions, then removing those units. However, this will leak, but you should look up leaks anyways to get rid of other leaks you may come across.
Wolf_Guard
Posts: 4
Joined: Sat Nov 23, 2013 12:00 am

[Trigger] Delete all creeps from one player, except building

Postby Wolf_Guard » Sat Nov 23, 2013 11:00 pm

Tonex wrote:The crudest version would be to use "Pick all units matching Condition" with the required conditions, then removing those units. However, this will leak, but you should look up leaks anyways to get rid of other leaks you may come across.
Alright, thank you for letting me know.

Edit: I think I'm not thinking right. :/ Can't seem to set this trigger up correctly.
Last edited by Wolf_Guard on Sat Nov 23, 2013 11:22 pm, edited 1 time in total.
User avatar
Tonex
Posts: 822
Joined: Sat Oct 29, 2011 12:00 am
Location: California Bay Area

[Trigger] Delete all creeps from one player, except building

Postby Tonex » Sun Nov 24, 2013 12:52 am

Screenshot the current trigger?
Wolf_Guard
Posts: 4
Joined: Sat Nov 23, 2013 12:00 am

[Trigger] Delete all creeps from one player, except building

Postby Wolf_Guard » Sun Nov 24, 2013 3:46 pm

Tonex wrote:Screenshot the current trigger?
I had gotten tired of staying awake and decided to just delete the trigger and restart fresh when I woke up. Right now, here is my current trigger that I am building from:

Events:
Player - Player 1 (Red) types a chat message containing -clearcreeps as An exact match

Conditions:
((Picked Unit) is A ground unit) Equal to True

Actions:
---- NO ACTIONS YET ----

However, I just noticed the trigger that removes a player's units when they leave uses a similar action, so I'm going to try to base the action off of that one before I do anything else. (also, two different computers I use to surf the web and play games on... Sorry. :/)

EDIT: Trigger works after basing it off of the Player Leaves trigger. Thank you for your advice/help, Tonex.
Last edited by Wolf_Guard on Sun Nov 24, 2013 4:17 pm, edited 1 time in total.
User avatar
Jesse James
Posts: 692
Joined: Sun Oct 11, 2009 12:00 am
Location: The Frozen Tundra of Siberia
Contact:

[Trigger] Delete all creeps from one player, except building

Postby Jesse James » Sun Nov 24, 2013 10:45 pm

Post up your final trigger anyways and we can assess it and let you know if there is any problems with it you might encounter later. :]
User avatar
Tonex
Posts: 822
Joined: Sat Oct 29, 2011 12:00 am
Location: California Bay Area

[Trigger] Delete all creeps from one player, except building

Postby Tonex » Mon Nov 25, 2013 1:05 am

Yeah, make sure to look up leaks.
Wolf_Guard
Posts: 4
Joined: Sat Nov 23, 2013 12:00 am

[Trigger] Delete all creeps from one player, except building

Postby Wolf_Guard » Mon Nov 25, 2013 6:56 am

It's basically what Tonex said, but I finally understood because I had gotten sleep. Before I had gotten sleep, I was deprived of it for about a day, so I wasn't at my best. Anyway, I've just made my first protected version (and yes, I've backed up the non-protected one, don't want a little mishap to happen... xD).

Here's the trigger:

Events:
Player - Player 1 (Red) types a chat message containing -clearcreeps as An exact match

Conditions:
---- NO CONDITIONS ----

Actions:
Unit Group - Pick every unit in (Units owned by Neutral Hostile) matching (((Picked unit) is A structure) Equal to False)) and do (Unit - Remove (Picked unit) from the game)

So yes, basically what Tonex told me to do.
User avatar
Jesse James
Posts: 692
Joined: Sun Oct 11, 2009 12:00 am
Location: The Frozen Tundra of Siberia
Contact:

Re: [Trigger] Delete all creeps from one player, except buil

Postby Jesse James » Fri Jan 17, 2014 7:03 am

That trigger contains memory leaks and will contribute to an unstable map. You should really look up memory leaks and how to fix them, blizzard did a bad job with the tools they gave us. :wink: