Do you get a certain amount of xp based on the item you have or is it just one item and anyone who has it gets the xp?
If it is just one item you could use my AFK/RP XP system. I altered this one from the one on the vault to accomidate you. If it is more a multiple item system with different amounts of XP you could sill alter this further for your needs.
//////////////////////////////GOGS AutoAFK System///////////////////////////////
//Name: "gogs_afk_inc"
//Date: 8-4-2010
//Type: include
////////////////////////////////////////////////////////////////////////////////
#include "x3_inc_string"
/////////////////////////////CONFIGURABLE OPTIONS///////////////////////////////
//!!!IMPORTANT!!//
//!!Be sure to "Build" you module after making any changes to this script!!
//Set timer for chat check and movement detection. After this time has expired
//for both checks then the AFK effect type will be applied.
//Default: 600 seconds(10 minutes)
const int TIMER = 600;//Seconds
//If using the RP XP option, decreasing the chat timer will mean that players
//will have to chat more often to recieve the XP reward.
const int CHAT_TIMER = 600;//Seconds
//Available AFK types:
//1 = Repeating floating text on player.
//2 = A visual effect will be applied to the player.
//3 = Transport player to an object in AFK area.
//4 = Boot player.
//5 = Play Animation(looping type only).
//6 = Do nothing.
const int AFK_TYPE = 6;
//Options for AFK_TYPE 1:
//Enter message that you want to float over the players head when he/she is AFK.
//Default: "AFK"
const string AFK_FLOATING_MESSAGE = "AFK";
//Change the color of the floating text. Options for colors:
//STRING_COLOR_BLACK
//STRING_COLOR_BLUE
//STRING_COLOR_GREEN
//STRING_COLOR_PINK
//STRING_COLOR_RED
//STRING_COLOR_ROSE
//STRING_COLOR_WHITE
const string FLOATY_COLOR = STRING_COLOR_RED;
//Allow floaty text with all AFK types. Default: FALSE
const int FLOATY_TEXT_ALWAYS = FALSE;
//Option for AFK_TYPE 2:
//Enter desired VFX number or constant. Default: VFX_DUR_FLAG_GOLD
const int AFK_EFFECT = VFX_DUR_FLAG_GOLD;
//AFK OBJECT. This object is used for AFK_TYPE 2 and AFK_TYPE 3.
//Simply pick any placeable of your choosing and give it the tag below.
//Also make sure the object is checked "plot".If using the object for TYPE 2 you
//can put it in any area. If using it for TYPE 3 place it in the AFK area that
//players will be teleported to.
//Note for AFK_TYPE 3: This option sets a location on the player that they can
//be auto-ported back to. However should the player log out and log back in or
//if the server crashes, this location will be lost. Therefore you should have
//an alternate way of leaving the AKF area.
//Default: "GOGS_AFK_OBJECT"
const string AFK_OBJECT = "GOGS_AFK_OBJECT";
//Additional note for AFK type 3: I have made it so that a player who is in the
//AFK area must type something/anything in the chat bar for them to return to
//their stored location. This is to prevent other players from simply pushing
//the player around and causing a change in location which would teleport them.
//A repeating message is sent to the player until they type something.
//Message:
const string AFK_AREA_MESSAGE = "Type anything in the chat bar to be ported back to saved location.";
//Select color of message. Same color options as above apply.
const string AREA_MESSAGE_COLOR = STRING_COLOR_RED;
//Option for AFK_TYPE 5:
//Enter desired looping animation constant for the AFK animation.
//Default: ANIMATION_LOOPING_SIT_CROSS
const int AFK_ANIMATION = ANIMATION_LOOPING_SIT_CROSS;
//Send a message to the party members of the player that is AFK. This will
//display a message once when the player has gone AFK and once when the player
//is no longer AFK.
//If TRUE, message will be displayed to all party members. DEFAULT: TRUE
const int SEND_FACTION_MESSAGE = TRUE;
//Select color of message. Same color options as above apply.
const string FACTION_MESSAGE_COLOR = STRING_COLOR_PINK;
//Options for awarding RP XP. Basically, if the player is not AFK and has
//chatted within the last timer delay, the player will receive XP.
//Set to TRUE to give RP XP.
const int RP_XP_REWARD = FALSE;
//Set desired amount of XP to give every cycle.
const int XP_AMOUNT = 100;
//Set TRUE if you want to require that the player have an RP item to get the XP.
const int RP_ITEM_REQUIRED = TRUE;
//Tag of your required RP item.
const string RP_ITEM_TAG = "Your item tag here";
////////////////////////////END CONFIGURABLE OPTIONS////////////////////////////
////////////////////////////////////////////////////////////////////////////////
void SendAFKFactionMessage(object oPC)
{
int iActive = GetLocalInt(oPC, "AFK_ACTIVE");
string sName = GetName(oPC);
string sMessage;
if (iActive == TRUE) sMessage = sName + " has gone AFK.";
else sMessage = sName + " is no longer AFK.";
object oMember = GetFirstFactionMember(oPC);
while (GetIsObjectValid(oMember))
{
SendMessageToPC(oMember, StringToRGBString(sMessage, FACTION_MESSAGE_COLOR));
oMember = GetNextFactionMember(oPC);
}
}
////////////////////////////////////////////////////////////////////////////////
void CheckNoAFK(object oPC)
{
location lPC = GetLocation(oPC);
location lCheck = GetLocalLocation(oPC, "AFK_LOC_CHECK");
int iChatty = GetLocalInt(oPC, "CHATTY");
if (iChatty == TRUE || lPC != lCheck)
{
if (AFK_TYPE == 1)
{
SetLocalInt(oPC, "AFK_ACTIVE", FALSE);
if (SEND_FACTION_MESSAGE == TRUE) SendAFKFactionMessage(oPC);
}
if (AFK_TYPE == 2)
{
effect eEffect = GetFirstEffect(oPC);
while (GetIsEffectValid(eEffect))
{
if (GetEffectCreator(eEffect)== GetObjectByTag("GOGS_AFK_OBJECT"))
{
RemoveEffect(oPC, eEffect);
}
eEffect = GetNextEffect(oPC);
}
SetLocalInt(oPC, "AFK_ACTIVE", FALSE);
if (SEND_FACTION_MESSAGE == TRUE) SendAFKFactionMessage(oPC);
}
if (AFK_TYPE == 3)
{
location lLoc = GetLocalLocation(oPC, "AFK_RETURN_LOC");
if (iChatty == TRUE)
{
SetLocalInt(oPC, "AFK_ACTIVE", FALSE);
if (SEND_FACTION_MESSAGE == TRUE) SendAFKFactionMessage(oPC);
DelayCommand(2.0, AssignCommand(oPC, ActionJumpToLocation(lLoc)));
}
else
{
SendMessageToPC(oPC, StringToRGBString(AFK_AREA_MESSAGE, AREA_MESSAGE_COLOR));
DelayCommand(3.0, CheckNoAFK(oPC));
}
}
if (AFK_TYPE == 5)
{
SetLocalInt(oPC, "AFK_ACTIVE", FALSE);
if (SEND_FACTION_MESSAGE == TRUE) SendAFKFactionMessage(oPC);
}
if (AFK_TYPE == 6)
{
SetLocalInt(oPC, "AFK_ACTIVE", FALSE);
}
}
else
{
DelayCommand(3.0, CheckNoAFK(oPC));
if (AFK_TYPE == 1 || FLOATY_TEXT_ALWAYS == TRUE)
{
string sAFK = StringToRGBString(AFK_FLOATING_MESSAGE, FLOATY_COLOR);
FloatingTextStringOnCreature(sAFK, oPC);
}
}
}
////////////////////////////////////////////////////////////////////////////////
void RunAFKType(object oPC)
{
if (AFK_TYPE == 1)
{
//
}
if (AFK_TYPE == 2)
{
object oAFKObject = GetObjectByTag(AFK_OBJECT);
AssignCommand(oAFKObject, ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(AFK_EFFECT)), oPC));
}
if (AFK_TYPE == 3)
{
SetLocalLocation(oPC, "AFK_RETURN_LOC", GetLocation(oPC));
AssignCommand(oPC, ActionJumpToObject(GetObjectByTag(AFK_OBJECT)));
}
if (AFK_TYPE == 4)
{
//SendMessageToPC(oPC, "Boot!");//Used for testing in single player.
BootPC(oPC);
}
if (AFK_TYPE == 5)
{
AssignCommand(oPC, ActionPlayAnimation(AFK_ANIMATION, 1.0, 10000.0));
}
if (AFK_TYPE == 6)
{
//Do nothing
}
SetLocalInt(oPC, "AFK_ACTIVE", TRUE);
if (SEND_FACTION_MESSAGE == TRUE) SendAFKFactionMessage(oPC);
CheckNoAFK(oPC);
}
////////////////////////////////////////////////////////////////////////////////
void ChatCheck(object oPC)
{
int iChatty = GetLocalInt(oPC, "CHATTY");
if (iChatty != TRUE)
{
SetLocalInt(oPC, "CHATTY", TRUE);
DelayCommand(IntToFloat(CHAT_TIMER), SetLocalInt(oPC, "CHATTY", FALSE));
}
}
////////////////////////////////////////////////////////////////////////////////
void RunAFKDetection(object oPC)
{
location lPC = GetLocation(oPC);
location lCheck = GetLocalLocation(oPC, "AFK_LOC_CHECK");
int iAFKActive = GetLocalInt(oPC, "AFK_ACTIVE");
int iChatty = GetLocalInt(oPC, "CHATTY");
if (lPC == lCheck && iChatty != TRUE && iAFKActive != TRUE)
{
RunAFKType(oPC);
}
SetLocalLocation(oPC, "AFK_LOC_CHECK", lPC);
if (RP_ITEM_REQUIRED == TRUE)
{
object oRPItem = GetItemPossessedBy(oPC, RP_ITEM_TAG);
if (GetIsObjectValid(oRPItem) && iChatty == TRUE && RP_XP_REWARD == TRUE)
{
GiveXPToCreature(oPC, XP_AMOUNT);
}
}
else if (iChatty == TRUE && RP_XP_REWARD == TRUE)
{
GiveXPToCreature(oPC, XP_AMOUNT);
}
DelayCommand(IntToFloat(TIMER), RunAFKDetection(oPC));
}
////////////////////////////////////////////////////////////////////////////////
void GOGsAFKDetector(object oPC)
{
DelayCommand(10.0, RunAFKDetection(oPC));
}
/*
Example "OnPlayerChat" script:
//::////////////////////////////////////////////////////////////////////////////
//::A bunch of stuff here.....
//:://///////////////////////////////////////////////////////////////////////////
#include "?
?"
#include "gogs_afk_inc" <------Add this line to your script!
void main()
{
object oPC = GetPCChatSpeaker();
ChatCheck(oPC) <------Add this line to your script!
OtherStuff.......
Ect........
Ect...........
}
Example "OnClientEnter" script:
//::////////////////////////////////////////////////////////////////////////////
//::A bunch of stuff here.....
//:://///////////////////////////////////////////////////////////////////////////
#include "?
?"
#include "gogs_afk_inc" <------Add this line to your script!
void main()
{
object oPC = GetEnteringObject();
GOGsAFKDetector(oPC) <------Add this line to your script!
OtherStuff.......
Ect........
Ect...........
}
*/
It uses a pseudo heartbeat to check that the player has been chatting and hasn't remained in the same location if not chatting. If the player appears to be active then they get XP. And if you don't want to use any of the auto afk stuff then just use option 6(nothing), and the xp part will still work. This is an include type script. At the bottom it shows you how to implement it by adding a lines to your OnPlayerChat and OnClientEnter.
Hope this at least gets you going in the right direction. Off to work. Good luck.
Modifié par GhostOfGod, 26 février 2011 - 09:00 .