HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Remove 1 Unit of type

04-16-2007, 11:19 AM#1
Radament
OK...I know u all had enought of me...but I really need help with my map.

QUESTION: How to make trigger like this.

Event: Unit Dies
Condition: Dying unit equal to TempleOfTides
Action: (THIS PART I DUNNO BUT IT MUST LOOK SOMETHING LIKE THIS) Remove 1 unit of type Necropolis and remove it from triggering player.

This is idea i got so i cant cheat system so he thinks that my TempleOfTides is TownHall (coz i already tried classification ang gameplay constants.....nothing worked).

Trigger idea is when TempleOfTides dies, Necropolis is removed from game too.

PLEASE HELP........BEG BEG
04-16-2007, 12:23 PM#2
iNfraNe
unit group - pick all units of type necropolis and do
if owner of picked unit = owner of dying unit then
unit remove picked unit

woohoo. Not that hard.
04-16-2007, 09:35 PM#3
Radament
Well Much THX :D

EIDT: Can u maybe modify this trigger so it doesn't remove all units of type, only 1 random unit of that type.
04-16-2007, 10:38 PM#4
Radament
Bump
04-16-2007, 11:38 PM#5
Daxtreme
Like I posted on TheHiveWorkshop.com,

Trigger:
Remove Necropolis
Collapse Events
Unit - A unit dies
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Temple of Tides
Collapse Actions
Set Leak_Group = (Random 1 units from (Units of type Necropolis))
Collapse Unit Group - Pick every units in Leak_Group and do (Actions)
Collapse Loop - Actions
If ((Owner of (Dying unit)) Equal to (Owner of (Picked unit))) then do (Unit - Kill (Picked unit)) else do (Do nothing)
Custom script: call DestroyGroup(udg_Leak_Group)

Took the actions from iNfraNe's input.

EDIT: Oops. You want 1 random Necropolis. Edited the trigger.
04-16-2007, 11:51 PM#6
PsycoMarauder
Trigger:
Very Simple Trigger
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Temple of Tides
Collapse Actions
Unit - Remove (Random unit from (Units owned by (Owner of (Dying unit)) of type Temple of Tides)) from the game

Pretty easy to do, even for a total beginner. Next time don't give up so easily.
04-16-2007, 11:52 PM#7
Ammorth
That won't work if the unit picked is not owned by the player. Instead, change it to:
Trigger:
Set Leak_Group = (Random 1 units from (Units of type Necropolis owned by (Owner of (Triggering Unit))))

Edit: Referring to Daxtreme's post
04-16-2007, 11:52 PM#8
PsycoMarauder
Weird...I didn't see Dax's post until RIGHT after I posted...
04-16-2007, 11:54 PM#9
PsycoMarauder
Btw why would you make the trigger so long..doesn't mine work too?
04-16-2007, 11:55 PM#10
Daxtreme
Your triggers achieve the same results, but without the leak removal.
04-17-2007, 01:40 AM#11
PsycoMarauder
So wait. Omg if that leaks then do all triggers leak unless I put that in them? Oh my lord. :O
04-17-2007, 02:07 AM#12
Pyrogasm
Triggers themselves don't leak, but their actions might. Let's analyze the leak there:
Trigger:
Unit - Remove (Random unit from (Units owned by (Owner of (Dying unit)) of type Temple of Tides)) from the game
(Units owned by (Owner of (Dying unit)) of type Temple of Tides) is a group, is it not? Well, after we're done picking that unit from that group... where does the group go?

The answer is that it goes nowhere. The group exists, but we're NEVER going to use it again. Thus, it leaks.




On a side note: is it possible to create enough leaks that all the handle indexes would be used? Would the game just crash, or is that even possible?
04-17-2007, 03:03 AM#13
Ammorth
Quote:
Originally Posted by Pyrogasm
On a side note: is it possible to create enough leaks that all the handle indexes would be used? Would the game just crash, or is that even possible?
I thought so, and I created over 5000 units and no errors, except my fps dropped to 10. So I think the game would lagged-out before it "handled-out". Also, think of all the TDs created before the notice of leaks. 300 points to create units * 40 waves + 5 waypoints * 300 units * 40 waves = 72000 locations leaked = handles (not to mention groups, forces and units).

Also, to destroy a group, you can do this:
Trigger:
Remove Necropolis
Collapse Events
Unit - A unit dies
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Temple of Tides
Collapse Actions
Custom Script: set bj_wantDestroyGroup = true
Unit - Remove (Random unit from (Units owned by (Owner of (Dying unit)) of type Temple of Tides)) from the game
That line of custom script will destroy the next group created within the GUI picking scheme. Be careful though, cause if you call that and don't create a group, you may destroy a group you never intended to.
04-17-2007, 01:12 PM#14
blu_da_noob
Radament: Please read our rules regarding bumping of threads and double posting.

PsycoMarauder: Ditto about the double posting.
04-17-2007, 04:19 PM#15
iNfraNe
Quote:
Originally Posted by Daxtreme
Like I posted on TheHiveWorkshop.com,

Trigger:
Remove Necropolis
Collapse Events
Unit - A unit dies
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Temple of Tides
Collapse Actions
Set Leak_Group = (Random 1 units from (Units of type Necropolis))
Collapse Unit Group - Pick every units in Leak_Group and do (Actions)
Collapse Loop - Actions
If ((Owner of (Dying unit)) Equal to (Owner of (Picked unit))) then do (Unit - Kill (Picked unit)) else do (Do nothing)
Custom script: call DestroyGroup(udg_Leak_Group)

Took the actions from iNfraNe's input.

EDIT: Oops. You want 1 random Necropolis. Edited the trigger.
this leaks too.