This script is straight out of my module and does pretty much what you want - stick it OnClientEnter:
void main ()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
object oItem;oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem)) { if (GetPlotFlag(oItem)) SetPlotFlag(oItem, FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC); }
int nInt;for (nInt=0; nInt<NUM_INVENTORY_SLOTS; nInt++) { oItem = GetItemInSlot(nInt, oPC);
if (GetPlotFlag(oItem)) SetPlotFlag(oItem, FALSE);
DestroyObject(oItem); }
AssignCommand(oPC, TakeGoldFromCreature(GetGold(oPC), oPC, TRUE));
//Give PC Properties item and dressing gown
CreateItemOnObject("renaarisignetrin", oPC);
CreateItemOnObject("dressinggown", oPC);
AssignCommand(oPC, ActionEquipItem(GetItemPossessedBy(OBJECT_SELF, "dressinggown"), INVENTORY_SLOT_CHEST));
AssignCommand(oPC, ActionEquipItem(GetItemPossessedBy(OBJECT_SELF, "renaarisignetrin"), INVENTORY_SLOT_RIGHTRING));
}
Of course, you'll need to change some of the tags to fit your module, but that works just perfectly for me. Start the conversation through a generic trigger, that way you can be sure that the loading screen has gone away and that the player is in control of their character.
Modifié par Mr. Versipellis, 03 juillet 2012 - 02:11 .