HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Useful Trigger for Role Playing Maps

11-28-2002, 03:19 AM#1
Draco
This is a trigger (like the ones used in "Role Playing" maps) to remove your unwanted units.

After spending a long time helping someone with a trigger like this, I thought I should post it here. In the end, I realized a simple way of doing it.

- - -

First make a unit group variable (one for each player; i.e. "ug1")

EVENT - Player 1 types a chat message containing "-remove" as an exact match.

ACTIONS:

Unit Group - Pick all units (units selected by player 1) and do action - Unit Group - Add (picked unit) to "ug1"

Unit Group - Remove Unit Group from Unit Group - Remove units of type (spawner) from "ug1"

Unit Group - Remove Unit Group from Unit Group - Remove units (owned by player 2 from "ug1")***

Unit Group - Pick all units in "ug1" and do action - Unit - Remove (picked unit)

Unit Group - clear "ug1"

- - -

*** NOTE - You must repeat this trigger action for each player also playable in the game.

This trigger can also be repeated for other players by changing some options and using another unit group variable like "ug2" A unit group variable array can also be used.

- - -

There. This may not be THE best trigger for the job, but I am 100% positive that trigger will work (I teseted it myself :ggani: )

Later.

P.S. Heh, now noone can say that I've never helped around here.
11-30-2002, 11:04 AM#2
Wakeman
Well, honestly this is definitely not the best trigger for the action. You can do the same thing with only 1 action without using any variable.....You should try again.
11-30-2002, 02:37 PM#3
The_Cyberdemon1
Quote:
P.S. Heh, now noone can say that I've never helped around here.


I've said that a million times and everyone just says: "No, you haven't helped. I'm sure of it." I give them like 8 threads i made HUGE triggers for, and they still say "so what?" Its not worth it. I just said "Okay, i've never helped anyone, so get off my case" although that is completely untrue.
11-30-2002, 05:19 PM#4
Draco
Oh well, it gets the job done. I'm not too concerned about finding that one trigger that everyone likes because it's small.

[edit] Sweet, I'm a Dragon Slayer.
12-03-2002, 02:00 AM#5
dataangel
Draco, don't use a unit group variable and manually remove everything. Just make a unit group with conditions and have the units match those conditions. Alot less clicking ;)
12-03-2002, 02:24 AM#6
Draco
Make a unit group with conditions eh? And what would the event be, a periodic trigger because I want to avoid too many of those events. :)

If anyone's got a simpler solution I'll edit my above post ;)
12-07-2002, 04:01 AM#7
Wakeman
Sorry Draco, if you thought that I was rude. My English is poor. :P Of course your trigger would work. As this section is talking about the technique of writing triggers, I just tried to point out there is a better way to do the thing.

If I interpret what you want to do correctly, this trigger should work:

E: player1 enter whatever chat message
C:
A: pick all unit selected by player1 and do (if (picked unit is NOT owned by player2) AND (unit type of picked unit is NOT "spawner")) then remove picked unit from game.

I haven't actually tested it but I think it should work.
12-07-2002, 06:30 PM#8
Draco
Some of the times, the AND(s) and OR(s) do not work correctly though in conditions.
12-12-2002, 10:27 PM#9
Guest
On the topic of removing units, and easy trigger to remove unused selector units would look like this:

E:Map initialization
C:Player 2 slot status equal to unused
A:Unit-Remove (selector unit) from the game

Do that for every player and you don't have worthless selectors hanging around.
12-14-2002, 09:16 AM#10
Wakeman
Quote:
Originally posted by Cold_Hawaiian
On the topic of removing units, and easy trigger to remove unused selector units would look like this:

E:Map initialization
C:Player 2 slot status equal to unused
A:Unit-Remove (selector unit) from the game

Do that for every player and you don't have worthless selectors hanging around.


:Heh: :bangH:
12-15-2002, 03:57 AM#11
Wakeman
Ok, if your game has 10 players, rather than making 10 copies of Cold's trigger, use the following:

E: map initialization
C:
A: for integer A = 1 to 10 do (if player (integer A)'s slot is unused then remove all units owned by player (integer A))

Of course both ways give the same result, but it is always good to save time!