As most have already said, just checking for 0 xp is the simplest method.
void main()
{
object oPC = GetEnteringObject();
//If xp = 0 then it is the first time logging in. Of course this will only
//work if the players xp can never go back to zero.
if (GetXP(oPC) == 0)
{
SetXP(oPC, 1);
//do other stuff
}
}
You can also do other simple things like check for an item the player will get after they log in. Make it a non drop item. Then just check if the player possesses the item. If they have the item then they have logged in before.
void main()
{
object oPC = GetEnteringObject();
//If the rulebook item is not valid, it is the first time logging in.
if (GetItemPossessedBy(oPC, "Rulebook") == OBJECT_INVALID)
{
CreateItemOnObject("rulebook", oPC);
//do other stuff
}
}
Trying to create unique ID to write to to the NWN database often results in problems with strings ending up too long and then getting cut off at the end thus making it so that you can not accurately check for the entry. You have more options if you are using NWNX + database.
Modifié par GhostOfGod, 18 juillet 2011 - 03:24 .