| 04-14-2006, 10:50 AM | #2 |
Use a pick every unit in (group) matching (condition) loop and set your condition to exclude units of whatever type. An if/then/else in the loop actions would also work. |
| 04-14-2006, 11:12 AM | #3 | |
Quote:
Problem solved. Nevermind. |
| 04-14-2006, 11:27 AM | #4 |
Sorry, I haven't used GUI in ages, so I wasn't aware that you couldn't use a filter for Unit Selected :/ |
| 04-14-2006, 11:46 AM | #6 |
I thought nested group loops don't work? You are over complicating it anyway. Trigger: Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
|
| 04-14-2006, 12:05 PM | #7 |
I'm making it so if it is selected, it doesn't remove spawner, and continues removal. It's not an overcomplication. |
| 04-14-2006, 08:26 PM | #8 |
So, looping through the group and removing a unit if it's a certain one, then looping through the group again to remove the others is not more process intensive than looping through once and removing units only if they are not a specific one? |
| 04-14-2006, 08:32 PM | #9 |
Yeah, your way is very overcomplicated Eternal_Dread. What's more is it won't even work, because you're looping through the unit group again in every iteration of the original loop. It will only check the first item to see if it's a spawner, and then it will remove everything; it'll then drop out of both loops, since the group is now empty. If the spawner's not the first item, it will get removed. It would work if you move the second loop out, but it's still very inefficient. Iterating unit groups are a very intensive process, which should really be avoided when unneccessary. Just do it blu's way. |
| 04-14-2006, 09:17 PM | #10 |
JASS:function checkUnit takes unit U returns boolean return GetUnitTypeId(U) != 'e000' and GetOwningPlayer(U) == GetTriggerPlayer() endfunction Theres my check unit function for the RP map im making. (put it in the non-trigger script thingy part of your map) JASS:function Trig_remove_Func002A takes nothing returns nothing if ( checkUnit( GetEnumUnit() ) ) then call RemoveUnit( GetEnumUnit() ) endif endfunction function Trig_remove_Actions takes nothing returns nothing local group tempGroup = GetUnitsSelectedAll(GetTriggerPlayer()) call ForGroupBJ( tempGroup, function Trig_remove_Func002A ) call DestroyGroup( tempGroup ) endfunction //=========================================================================== function InitTrig_remove takes nothing returns nothing set gg_trg_remove = CreateTrigger( ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(0), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(1), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(2), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(3), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(4), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(5), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(6), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(7), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(8), "remove", true ) call TriggerRegisterPlayerChatEvent( gg_trg_remove, Player(9), "remove", true ) call TriggerAddAction( gg_trg_remove, function Trig_remove_Actions ) endfunction and the remove trigger. I have a bunch of RP Triggers you welcome to, they are leak free and jass. Or you could just help me on my RP map =) |
| 04-14-2006, 09:26 PM | #11 |
It's pointless to check whether the owner of the unit is the triggering player, because when you use GetUnitsSelectedAll, it only returns those units which are owned in the first place. It won't even return selected units of players who have given shared control. I know this because in my D&D, I wanted the DM to be able to use 'kill' and 'remove' commands on hero-owned or shared-control units, but it doesnt work. I had to get the unit group of every unit on the map, and check each one to see if it's selected by the player. And personally, I find it much simpler to lump all commands into one single trigger. Just have the trigger fire on "contains <empty string>", and then check if the string is each one of your commands. That way you don't need to have all these events and triggers for every single command; adding new commands takes seconds with very little overhead. I can send you my D&D map if you want to see how it works. |
| 04-14-2006, 09:50 PM | #12 | |
Quote:
But then, every message sent is presumed to be a command. This produces overhead when not typing commands. =) and overhead of checkign every string for every command. I think there is less overhead in making new triggers ^^ |
| 04-14-2006, 09:56 PM | #13 | |
Quote:
Lol... Every string is checked for every command anyway. If you register a player chat message matching "remove", obviously it's going to check every message entered for "remove"! So you've got exactly the same overhead too. So if you have 40 commands, you've got 40 triggers all separately checking every single chat message entered for their respecting commands. Much more overhead than a single trigger doing it all at once. |
| 04-14-2006, 10:13 PM | #14 | |
Quote:
Ah, but wouldnt the WC3 engine be optamised to deal with the string events, as opposed to using the scripting language built ON the engine to do it?! =) |
| 04-14-2006, 11:42 PM | #15 |
Possibly, but I'd consider the overhead of 40 triggers with 12 events each being handled separately for every chat message as outweighing that of having to do the checking myself. In any case, I hide player chat messages and only game-message (as OOC) those that aren't commands. This means I have to amalgamate them all in one trigger anyway, so that I can tell when a message isn't a command. I prefer it this way. |
