I was having an issue with an afk script getting stuck and not /facing the mob correctly if it was right on top of me so I wrote a little plugin to keep facing until the target is cleared or it's turned off.
/autoface on
/autoface off
It does a simple /squelch /face nolook when on. Might be useful to someone else.
/autoface on
/autoface off
It does a simple /squelch /face nolook when on. Might be useful to someone else.
Rich (BB code):
// MQ2AutoFace.cpp
// v1.0 - 05.26.2011 by Sym
// Keep facing current target
#include "../MQ2Plugin.h"
PreSetup("MQ2AutoFace");
#define SKIP_PULSES 20
long SkipPulse = 0;
bool AutoFace = false;
void AutoFaceCommand(PSPAWNINFO pChar, PCHAR szLine);
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2AutoFace");
AddCommand("/autoface",AutoFaceCommand);
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2AutoFace");
RemoveCommand("/autoface");
}
// This is called every time MQ pulses
PLUGIN_API VOID OnPulse(VOID)
{
if (!AutoFace) return;
if (SkipPulse == SKIP_PULSES) {
SkipPulse = 0;
PSPAWNINFO psTarget = (PSPAWNINFO)pTarget;
if (pTarget) {
DoCommand(GetCharInfo()->pSpawn,"/squelch /face nolook");
} else {
WriteChatColor("MQ2AutoFace::OFF - No Target");
AutoFace=false;
}
}
SkipPulse++;
}
void AutoFaceCommand(PSPAWNINFO pChar, PCHAR szLine)
{
char szTemp[MAX_STRING];
GetArg(szTemp,szLine,1);
if(!strnicmp(szTemp,"on",2)) {
WriteChatColor("MQ2AutoFace::ON");
AutoFace=true;
}
if(!strnicmp(szTemp,"off",3)) {
WriteChatColor("MQ2AutoFace::OFF");
AutoFace=false;
}
}

