This goes Module>OnClientEnter. Strip the Player of all items and gold. Then you can set how much gold, what level you want them to start and which items they have. Its all commented in the script. Cut n' Paste into the toolset script editor makes them easier to read.
//::///////////////////////////////////////////////
//:: RemoveAllItems
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* RemoveAllItems(object oPlayer)
The function removes all items in inventory,
equipped items and gold from oPlayer.
*/
//:://////////////////////////////////////////////
void RemoveAllItems(object oPlayer)
{
if (GetIsPC(oPlayer) == TRUE)
{
// First remove equipped items.
int i;
for (i=0; i<14; i++)
{
object oEquip = GetItemInSlot(i, oPlayer);
if(GetIsObjectValid(oEquip))
{
SetPlotFlag(oEquip, FALSE);
DestroyObject(oEquip);
}
}
// Second remove items in inventory.
object oItem = GetFirstItemInInventory(oPlayer);
while(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPlayer);
}
// Finally remove all gold
int nAmount = GetGold(oPlayer);
if(nAmount > 0)
{
AssignCommand(oPlayer,TakeGoldFromCreature(nAmount, oPlayer, TRUE));
}
}
}
//::///////////////////////////////////////////////
//:: RemoveUberItems
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* RemoveUberItems(object oPlayer)
Remove items whit immunity properties.
*/
//:://////////////////////////////////////////////
//:: Created By: eldbane
//:: Created On: 2003
//:://////////////////////////////////////////////
void RemoveUberItems(object oPlayer)
{
object oUber = GetFirstItemInInventory(oPlayer);
while (GetIsObjectValid(oUber))
{
// Check for immunity items in inventory, remove if present.
if (GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL))
{
SetPlotFlag(oUber, FALSE);
DestroyObject(oUber);
}
oUber = GetNextItemInInventory(oPlayer);
}
int i;
for (i=0; i<14; i++)
{
object oUber = GetItemInSlot(i, oPlayer);
// Check for equipped immunity items, remove if present.
if (GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL) ||
GetItemHasItemProperty(oUber, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL))
{
SetPlotFlag(oUber, FALSE);
DestroyObject(oUber);
}
}
}
//::///////////////////////////////////////////////
//:: SetEnterLevel
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* SetEnterLevel(object oPlayer, int iLevel)
Checks the level of oPlayer and raise it to
iLevel if it is below iLevel.
*/
//:://////////////////////////////////////////////
//:: Created By: eldbane
//:: Created On: 2003
//:://////////////////////////////////////////////
void SetEnterLevel(object oPlayer, int iLevel)
{
int iPClvl = GetHitDice(oPlayer);
int iPCxp = GetXP(oPlayer);
// Check if oPlayer needs to be boosted.
if (iPClvl < iLevel)
{
// Calculate xp requred for iLevel
int iLevelXP = (500*iLevel*(iLevel-1));
// Calculate xp to give.
int iGiveXP = ((iLevelXP - iPCxp)+1);
// Give xp to oPlayer.
GiveXPToCreature(oPlayer, iGiveXP);
}
}
//::///////////////////////////////////////////////
//:: GiveEnterItem
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* GiveEnterItem(object oPlayer, string sItem)
Give Item with ResRef (blueprint) sItem to
oPlayer if oPlayer do not have it.
*/
//:://////////////////////////////////////////////
//:: Created By: eldbane
//:: Created On: 2003
//:://////////////////////////////////////////////
void GiveEnterItem(object oPlayer, string sItem)
{
// Check if oPlayer already have item.
object oItemPC = GetFirstItemInInventory(oPlayer);
int iNoItem = 1;
while (GetIsObjectValid(oItemPC))
{
if ((GetResRef(oItemPC) == sItem) || (GetTag(oItemPC) == sItem))
iNoItem = 0;
oItemPC = GetNextItemInInventory(oPlayer);
}
int i;
for (i=0; i<14; i++)
{
object oEquipPC = GetItemInSlot(i, oPlayer);
if ((GetResRef(oEquipPC) == sItem) || (GetTag(oEquipPC) == sItem))
iNoItem = 0;
}
// Give item and make sure it is identified
if (iNoItem == 1)
{
object oItem = CreateItemOnObject(sItem, oPlayer);
SetIdentified(oItem, TRUE);
}
}
//::///////////////////////////////////////////////
//:: GiveEnterGold
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* GiveEnterGold(object oPlayer, int iAmount)
Check if oPlayer have less then iAmount gold
if so oPlayer gold is set to iAmount.
*/
//:://////////////////////////////////////////////
//:: Created By: eldbane
//:: Created On: 2003
//:://////////////////////////////////////////////
void GiveEnterGold(object oPlayer, int iAmount)
{
int iGoldPC = GetGold(oPlayer);
// Check if oPlayer have enough gold.
if (iGoldPC < iAmount)
{
int iGiveGold = (iAmount - iGoldPC);
// If not give gold
GiveGoldToCreature(oPlayer, iGiveGold);
}
}
//::///////////////////////////////////////////////
//:: EquipEnterItem
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* EquipEnterItem(object oPlayer, string sItemTag)
Checks if oPlayer possesses item with the tag
sItemTag and equip it.
*/
//:://////////////////////////////////////////////
//:: Created By: eldbane
//:: Created On: 2003
//:://////////////////////////////////////////////
void EquipEnterItem(object oPlayer, string sItemTag)
{
object oItem = GetObjectByTag(sItemTag);
// Check if oPlayer have item.
if (GetItemPossessor(oItem) == oPlayer)
{
// Get the item type and equip the item.
int iType = GetBaseItemType(oItem);
int iSlot;
if ((iType == BASE_ITEM_LARGESHIELD) || (iType == BASE_ITEM_SMALLSHIELD)
|| (iType == BASE_ITEM_TOWERSHIELD) || (iType == BASE_ITEM_TORCH))
iSlot = INVENTORY_SLOT_LEFTHAND;
else if (iType == BASE_ITEM_ARMOR)
iSlot = INVENTORY_SLOT_CHEST;
else if ((iType == BASE_ITEM_BRACER) || (iType == BASE_ITEM_GLOVES))
iSlot = INVENTORY_SLOT_ARMS;
else if (iType == BASE_ITEM_ARROW)
iSlot = INVENTORY_SLOT_ARROWS;
else if (iType == BASE_ITEM_AMULET)
iSlot = INVENTORY_SLOT_NECK;
else if (iType == BASE_ITEM_BOLT)
iSlot = INVENTORY_SLOT_BOLTS;
else if (iType == BASE_ITEM_BELT)
iSlot = INVENTORY_SLOT_BELT;
else if (iType == BASE_ITEM_BOOTS)
iSlot = INVENTORY_SLOT_BOOTS;
else if (iType == BASE_ITEM_BULLET)
iSlot = INVENTORY_SLOT_BULLETS;
else if (iType == BASE_ITEM_CLOAK)
iSlot = INVENTORY_SLOT_CLOAK;
else if (iType == BASE_ITEM_HELMET)
iSlot = INVENTORY_SLOT_HEAD;
else if (iType == BASE_ITEM_RING)
iSlot = INVENTORY_SLOT_RIGHTRING;
else
iSlot = INVENTORY_SLOT_RIGHTHAND;
AssignCommand(oPlayer, ActionEquipItem(oItem, iSlot));
}
}
// Here is the main script in which you can customize your
// entering behaviour.
void main()
{
// Get the entering player
object oPlayer = GetEnteringObject();
// Uncomment if you want all items and gold removed.
RemoveAllItems(oPlayer);
// Uncomment if you want all immunity items removed.
RemoveUberItems(oPlayer);
// Uncomment if you want to boost the entering player.
int iLevel = 3; // Change 1 to wanted level.
SetEnterLevel(oPlayer, iLevel);
// Uncomment if you want player to have at least a certain amount
// of gold when entering.
int iAmount = 0; //Change 150 to min. amount gold for player.
GiveEnterGold(oPlayer, iAmount);
{
object oPlayer = GetEnteringObject();
}
// Uncomment if you want the player to receive a item when entering.
// You can give more items by calling the function again with a
// new item ResRef set.
string sItem = "cloth028"; // ResRef (blueprint) name of item to give.
// If NWN-default item use tag instead.
GiveEnterItem(oPlayer, sItem);
// Uncomment if you want the player to equip a item.
// You can equip more items by calling the function again with a
// new item tag set.
string sItemTag = "cloth028"; // Tag of item to equip.
EquipEnterItem(oPlayer, sItemTag);
// Place your own custom content below
{
}
}
Modifié par cyberglum, 30 janvier 2011 - 02:03 .