Sitelet https://github.com/fifengine/fifengine/issues/239
Skip to content

event triggers #239

Description

@prock-fife

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions