OperationalEvent

From OPU Wiki

OperationalEvent is a counting event simular to OperationalTrigger.

Inherited from OP2Event


Description

It counts the number of operational (=NOT Idled) Buildings and fires when the count is lower, higher or equal to what's been set. It's called in the same manner as OperationalTrigger would be called, so changing existing OperationalTriggers to OperationalEvents should not create any problems.

OperationalEvent uses the same comparison constants as the Trigger system does, as defined in Enums.h:

  • cmpEqual
  • cmpLowerEqual
  • cmpGreaterEqual
  • cmpLower
  • cmpGreater


Constructors

Do NOT call the constructors directly, use the CreateOperationalEvent function instead:

OperationalEvent *CreateOperationalEvent(bool enable,bool norepeat,int playerNum,map_id unitType,map_id weaponType,int refCount,compare_mode compareType,_callbackfunc callback,int id=0);

An id can be supplied. This can be an integer or any other variable type:

void EventFired(OP2Event *event)
{
  // Your code goes here
}
OperationalEvent *event1=CreateOperationalEvent(1,1,0,map_GuardPost,
    map_EMP,2,cmpGreaterEqual,EventFired);

event1 will fire, the moment Player 1 has 2 or more RPG turrets.


Members

type name description
int GetCount( ) returns the number of buildings that was counted, the last time the EventFunction was called. Even if the event does not fire (yet), this count represents the current number of active buildings of the type the event is looking for
Personal tools