[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Problem with unit destruction trigger



On Thursday 18 January 2007 20:01, Jens Granseuer wrote:
> > Would it be a huge change to make another flag for the unit destruction
> > trigger that meant "any unit of type X"?
>
> Because of the way event triggers work (an early design flaw if you wish),
> this would not work well. Trigger in CF do not test for events, they always
> test for conditions. Therefore you can check "has unit X been destroyed"
> or "have all units of type Y been destroyed", but not "has any unit
> been destroyed" (unless all units have been destroyed...). The trigger
> would have to check for an event ("unit of type Z destroyed"), but since
> the trigger runs at some time after the event has occured, it cannot
> check for the absence of something unless it is completely absent.
> Or, trying to phrase it a little differently: If the trigger finds 2
> scouts, does that mean a scout has been destroyed? You can't tell if
> you don't know about the game state when the trigger last ran. Since
> triggers do not keep such state, they cannot check for these things.

Perhaps the trigger could also check for number of units of certain type. 
Suppose that at the beginning there are three scouts on a map. If, at a 
certain point, there are less than three scouts, do something.