Auto Follow Widget
0po0ia
Member Posts: 13
#include "x2_inc_switches"
void AutoFollow()
{
int nEvent = GetUserDefinedItemEventNumber();
object oTarget = GetItemActivatedTarget();
object oPC = GetItemActivator();
if(GetLocalInt(oPC, "AutoFollow")==1)
{
ActionMoveToObject(oTarget, TRUE);
string sMessage = "You are following your target.";
SendMessageToPC(oPC, sMessage);
DelayCommand(3.0, AutoFollow());
}
}
#include "x2_inc_switches"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
object oPC;
object oItem;
object oTarget;
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
oPC = GetItemActivator();
oItem = GetItemActivated();
oTarget = GetItemActivatedTarget();
if(GetLocalInt(oPC, "AutoFollow")!=1)
{
SetLocalInt(oPC, "AutoFollow", 1);
string sMessage = "You are now automatically following your target. Use this widget again to turn off autofollow.";
SendMessageToPC(oPC, sMessage);
AutoFollow();
}
else
{
SetLocalInt(oPC, "AutoFollow", 0);
string sMessage = "You are no longer auto following.";
SendMessageToPC(oPC, sMessage);
}
}
}
I can't seem to get the GetItemActivatedTarget(); to work properly
if anyone has any tips i'd be grateful, or maybe I'm doing this all wrong?
void AutoFollow()
{
int nEvent = GetUserDefinedItemEventNumber();
object oTarget = GetItemActivatedTarget();
object oPC = GetItemActivator();
if(GetLocalInt(oPC, "AutoFollow")==1)
{
ActionMoveToObject(oTarget, TRUE);
string sMessage = "You are following your target.";
SendMessageToPC(oPC, sMessage);
DelayCommand(3.0, AutoFollow());
}
}
#include "x2_inc_switches"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
object oPC;
object oItem;
object oTarget;
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
oPC = GetItemActivator();
oItem = GetItemActivated();
oTarget = GetItemActivatedTarget();
if(GetLocalInt(oPC, "AutoFollow")!=1)
{
SetLocalInt(oPC, "AutoFollow", 1);
string sMessage = "You are now automatically following your target. Use this widget again to turn off autofollow.";
SendMessageToPC(oPC, sMessage);
AutoFollow();
}
else
{
SetLocalInt(oPC, "AutoFollow", 0);
string sMessage = "You are no longer auto following.";
SendMessageToPC(oPC, sMessage);
}
}
}
I can't seem to get the GetItemActivatedTarget(); to work properly
if anyone has any tips i'd be grateful, or maybe I'm doing this all wrong?
0
Comments
AssignCommand(oPC, AutoFollow());