Personally, I like it and hate it at the same time.
On the negative side: this does mix the two systems in a way that makes deciphering already-hard-to-understand EventAI scripts even harder (you must have knowledge of both systems and C++, and search through database tables and script files)
On the brighter side: it allows for very powerful generic programming; you can make very diverse scripts in EventAI and have them share only one or more complicated functions coded in C++. For example, say you have a bunch of very different mobs in an instance, but on death they need to check if the other mobs are alive and an instance variable is set and act accordingly, this makes it possible without bloating compile time and space with more scripts and C++ code. It also allows for better bridging between EventAI and C++ coders in regards to scripting; EAI coders can request functions from C++ coders, C++ coders can deliver functions, etc.
Whether or not you guys like it, all I can say is I would probably use it.
Also, just saw 2 things:
1st: your new event is never actually called in the EventAI code. I assume it should be called on UpdateAI() for the creature, so this:
//Events that are updated every EVENT_UPDATE_TIME
switch ((*i).Event.event_type)
{
case EVENT_T_TIMER_OOC:
ProcessEvent(*i);
break;
case EVENT_T_TIMER:
case EVENT_T_MANA:
case EVENT_T_HP:
case EVENT_T_TARGET_HP:
case EVENT_T_TARGET_CASTING:
case EVENT_T_FRIENDLY_HP:
if (Combat)
ProcessEvent(*i);
break;
case EVENT_T_RANGE:
if (Combat)
{
if (m_creature->getVictim() && m_creature->IsInMap(m_creature->getVictim()))
if (m_creature->IsInRange(m_creature->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist))
ProcessEvent(*i);
}
break;
}
Should be this:
//Events that are updated every EVENT_UPDATE_TIME
switch ((*i).Event.event_type)
{
case EVENT_T_TIMER_OOC:
[b] case EVENT_T_CUSTOM[/b]
ProcessEvent(*i);
break;
case EVENT_T_TIMER:
case EVENT_T_MANA:
case EVENT_T_HP:
case EVENT_T_TARGET_HP:
case EVENT_T_TARGET_CASTING:
case EVENT_T_FRIENDLY_HP:
if (Combat)
ProcessEvent(*i);
break;
case EVENT_T_RANGE:
if (Combat)
{
if (m_creature->getVictim() && m_creature->IsInMap(m_creature->getVictim()))
if (m_creature->IsInRange(m_creature->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist))
ProcessEvent(*i);
}
break;
}
2nd: you forget the break in the coding for your custom event, it should be:
case EVENT_T_CUSTOM:
{
if (ExtendedCreatureEAI != NULL)
{
if (!ExtendedCreatureEAI->CheckEvent(event))
return false;
}
else
{
sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has Custom Event Type, but ExtendedCreatureEAI is NULL", m_creature->GetEntry(), pHolder.Event.event_id);
}
[b]break;[/b]
}
My apologies if I am wrong on either of these.