PDA

View Full Version : ArcEmu C++ Functions and Guide



Pedregon
18-04-10, 05:46 AM
Artificial Intelligence;

AI Templage -


class TemplateAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(TemplateAI);
TemplateAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
}

protected:

};


AI Functions -


void OnCombatStart(Unit* mTarget)
{

}


void OnCombatStop(Unit *mTarget)
{

}

void OnDied(Unit * mKiller)
{
}

void AIUpdate()
{
}

void SpellCast(uint32 val)
{

}



AI Example Combat_OnStart_ExampleSay


void OnCombatStart(Unit* mTarget)
{
int chatMessage;
randAnnounce=rand()%4;
switch (randAnnounce)
{
case 0:///Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Intruder!!!!!!!!!!!!!");
break;

case 1://Edit this message
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "They're After the Jewels Stop them");
break;

}



GameObjectAI;


class TutorialPortal : public GameObjectAIScript
{
public:
TutorialPortal(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
void OnActivate(Player * Plr)
{
Plr->SafeTeleport(1, 0, 4627.442383, -3831.523438, 943.386353, 1.220509);
}
static GameObjectAIScript *Create(GameObject * GO) { return new TutorialPortal(GO); }
};
GameObjectAIScript * create_go[GOID](GameObject * GO) { return new TutorialPortal(GO); }
void SetupPortalHandler(ScriptMgr * mgr)
{
mgr->register_gameobject_script([GOID], &TutorialPortal::Create);
}



Server Hooks;


*SERVER_HOOK_EVENT_ON_NEW_CHARACTER
*SERVER_HOOK_EVENT_ON_KILL_PLAYER
*SERVER_HOOK_EVENT_ON_FIRST_ENTER_WORLD
*SERVER_HOOK_EVENT_ON_ENTER_WORLD
*SERVER_HOOK_EVENT_ON_GUILD_JOIN
*SERVER_HOOK_EVENT_ON_DEATH
*SERVER_HOOK_EVENT_ON_REPOP
*SERVER_HOOK_EVENT_ON_EMOTE
*SERVER_HOOK_EVENT_ON_ENTER_COMBAT
*SERVER_HOOK_EVENT_ON_CAST_SPELL
*SERVER_HOOK_EVENT_ON_TICK
*SERVER_HOOK_EVENT_ON_LOGOUT_REQUEST
*SERVER_HOOK_EVENT_ON_LOGOUT
*SERVER_HOOK_EVENT_ON_QUEST_ACCEPT
*SERVER_HOOK_EVENT_ON_ZONE
*SERVER_HOOK_EVENT_ON_CHAT
*SERVER_HOOK_EVENT_ON_LOOT
*SERVER_HOOK_EVENT_ON_GUILD_CREATE
*SERVER_HOOK_EVENT_ON_ENTER_WORLD_2
*SERVER_HOOK_EVENT_ON_CHARACTER_CREATE
*SERVER_HOOK_EVENT_ON_QUEST_CANCELLED
*SERVER_HOOK_EVENT_ON_QUEST_FINISHED
*SERVER_HOOK_EVENT_ON_HONORABLE_KILL
*SERVER_HOOK_EVENT_ON_ARENA_FINISH
*SERVER_HOOK_EVENT_ON_OBJECTLOOT
*SERVER_HOOK_EVENT_ON_AREATRIGGER
*SERVER_HOOK_EVENT_ON_POST_LEVELUP
*SERVER_HOOK_EVENT_ON_PRE_DIE - general unit die, not only based on players
*SERVER_HOOK_EVENT_ON_ADVANCE_SKILLLINE


Server Hooks Example -


void OnLoginForFirstTime(Player* plr)
{
plr->BroadcastMessage(" Welcome to [Server name] %s", plr->GetName()
}