Greetings,
I'm looking into making my Warcraft plugin more of an API style (after being told, quite literally, that using callfunc was shit), where each race is an entirely new plugin.
Each race needs to have several event-based actions. Many races will contain code that needs to be executed on a spawn event, for instance.
In order to execute a public function in every plugin at once (a function called, for instance, "event_spawn"), can I do something like...
neowarcraft.sma
PHP Code:
new spawnEvent;
public plugin_init()
{
register_plugin("MF Test", "1.0", "PreDominance");
RegisterHam("Ham_Spawn", "player", "event_spawn", "1");
spawnEvent = CreateMultiForward("event_spawn", ET_IGNORE, FP_CELL);
}
public event_spawn(id)
{
new ret;
if (!ExecuteForward(spawnEvent, ret, id))
return log_amx("Spawn forward execute error.");
return ret;
}
public plugin_end()
{
DestroyForward(spawnEvent);
}
Undead Scourge.sma
PHP Code:
public plugin_init()
{
register_plugin("Race: Undead Scourge", "1.0", "PreDominance");
}
public event_spawn(id)
{
//Stuff
return PLUGIN_CONTINUE;
}
My next question is, what happens to those plugins that do not have a public event_spawn (i.e. races that do not need a spawn event)? That's fine to not have, right?