This issue was reported by jwt
We need a proposal for adding “event triggers” to the engine. In general, triggers need to effect some action when certain conditions are satisfied. For example, a trigger might be set that initiates a dialog when the player character comes withing a certain distance.
Issues include: how to integrate triggers into the engine, how to define triggers in map files, what kind of API we provide to the scripts. Also, we should consider how general the support for triggers should be. Here is a very general interface, which would allow any kind of trigger conditions and actions to be defined in scripts:
```
class Trigger {
public:
//Test if this trigger conditions are met.
bool poll() = 0;
// Run this trigger.
void run() = 0;
};
class TriggerManager {
public:
void runTriggers() {
for(i = m_triggers.begin(); i != m_triggers.end(); ++i) {
if((i)→poll())
(i)→run()
}
}
};
```
However, this might result in significant back-and-forth between c++, which might have performance implications. If that is the case, we might want to consider implementing generic types of standard triggers in the engine itself.
Considering the size and complexity of this task, it might be good to do the initial design work on the wiki.
This issue was reported by jwt
We need a proposal for adding “event triggers” to the engine. In general, triggers need to effect some action when certain conditions are satisfied. For example, a trigger might be set that initiates a dialog when the player character comes withing a certain distance.
Issues include: how to integrate triggers into the engine, how to define triggers in map files, what kind of API we provide to the scripts. Also, we should consider how general the support for triggers should be. Here is a very general interface, which would allow any kind of trigger conditions and actions to be defined in scripts:
```
// Run this trigger. void run() = 0; };class Trigger {
public:
//Test if this trigger conditions are met.
bool poll() = 0;
class TriggerManager {
public:
void runTriggers() {
for(i = m_triggers.begin(); i != m_triggers.end(); ++i) {
if((i)→poll())
(i)→run()
}
}
};
```
However, this might result in significant back-and-forth between c++, which might have performance implications. If that is the case, we might want to consider implementing generic types of standard triggers in the engine itself.
Considering the size and complexity of this task, it might be good to do the initial design work on the wiki.