I need help with this, iv'e looked all over the vault and forums for one of these, but couldnot find it.
Here is my current OnClientEnter:
//
// UD's Custom OnEnter
//
// Module - OnClientEnter
//
// Catches any 'counted' PCs that reenterthe game. Th OnClientExit routine has
// decounted them, however they seem to be geting restored from some internal
// checkpoint when the player reconnect. That means that all we do in here is
// to clear the counted indicator, which is preventing the player from being
// counted when they reenter their area.
//
#include "spawn_inc"
#include "crp_inc_coinage"
void main() {
object oPC = GetEnteringObject();
PrintString("spawn_modoncliententer: " + GetName(oPC));
// Only react to entering counted things
object area = GetLocalObject(oPC, "spawn_counted_in_area");
if (GetIsObjectValid(area)) {
PrintString("spawn_modoncliententer: " + GetName(oPC) + " sneaking into " + GetName
(area));
// Clear the area record, incase the player object gets recycled...
SetLocalObject(oPC, "spawn_counted_in_area", OBJECT_INVALID);
// Do we have to count them as well?
return;
}
return;
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
if (GetItemPossessedBy(oPC, "coinpouch")!= OBJECT_INVALID)
return;
CreateItemOnObject("coinpouch", oPC);
if (GetItemPossessedBy(oPC, "pouchvalue")!= OBJECT_INVALID)
return;
CreateItemOnObject("pouchvalue", oPC);
if (GetItemPossessedBy(oPC, "coinvalue")!= OBJECT_INVALID)
return;
CreateItemOnObject("coinvalue", oPC);
int nNWNGold = GetGold(oPC);
AssignCommand(oPC, TakeGoldFromCreature(nNWNGold, oPC, TRUE));
CreateItemOnObject("crp_coin_4", oPC, nNWNGold);
}
}
What i need added is:
- Strip entering player of all item in backpack, and equipted stuff.
- Give item 1
- Give item 2
- Give item 3
- Give gold 1000gp
thanks in advance
Please make me an OnClientEnter script!
Débuté par
Ugly_Duck
, août 21 2011 08:40
#1
Posté 21 août 2011 - 08:40
#2
Posté 21 août 2011 - 08:54
put it in pcloaded, not client enter for the first thing
This is taken from the community script library for which you can search for functions you would find useful.
This is taken from the community script library for which you can search for functions you would find useful.
/**
* Destroys all items in inventory except for what is in the creature slots
* @author
* @param
* @see
* @return
*/
void CSLDestroyInventory(object oPC) // LEAVES SKINS AND CLAWS
{
object oItem = GetFirstItemInInventory( oPC );
while(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
int i;
for (i = 0;i<INVENTORY_SLOT_CWEAPON_L;i++) // this stops it prior to the slots for skins and clasws
{
oItem = GetItemInSlot(i, oPC);
if (GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem);
}
}
}
void main()
{
object oPC = GetEnteringObject();
if (!GetXP(oPC) && !CSLGetIsDM(oPC, FALSE)) // CHECK IF NEW CHARACTER
{
CSLDestroyInventory(oPC)
SetXP(oPC, 1);
GiveGoldToCreature(oPC, 1000);
CreateItemOnObject("item1tag", oPC, 1);
CreateItemOnObject("item2tag", oPC, 1);
object oGuide = CreateItemOnObject("item3tag", oPC, 1); // do this if it's not normally identified
SetIdentified(oGuide, TRUE);
CreateItemOnObject("curepotion", oPC, 5); // more than one item
}
}
#3
Posté 21 août 2011 - 09:17
Thanks, but this script is not compiling & I suck at scripts so I dont know what went wrong
#4
Posté 21 août 2011 - 11:49
- just playin' around ere ( getting in touch w/ CSL )
This compiles but still have to get the hang of what it's doing ...
void CSLDestroyInventory(object oPC)
{
object oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem);
oItem = GetNextItemInInventory(oPC);
}
int i;
// this stops it prior to the slots for skins and claws
for (i = 0; i < INVENTORY_SLOT_CWEAPON_L; i++)
{
oItem = GetItemInSlot(i, oPC);
if (GetIsObjectValid(oItem))
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem);
}
}
}
// * Checks to see if oPC is a DM, includes checks for PC DM's,
// * DMFI DM's, PW Admins and DM Possession.
// Parameters:
// oPC
// bProto being true makes it so those in single player can use the dm tools
int CSLGetIsDM (object oPC, int bProto = TRUE)
{
if (GetIsDM(oPC))
{
return TRUE;
}
if (bProto && GetIsSinglePlayer())
{
if (GetIsPC(oPC) || GetIsOwnedByPlayer(oPC))
{
return TRUE;
}
}
if (GetIsDMPossessed(oPC))
{
return TRUE;
}
// if (GetLocalInt(oPC, DMFI_DM_STATE))
// {
// return TRUE;
// }
// if (GetLocalInt(oPC, DMFI_ADMIN_STATE))
// {
// return TRUE;
// }
if (bProto)
{
if (GetLocalInt(oPC, "SDB_PC_DM"))
{
return TRUE;
}
string sCDKey = GetPCPublicCDKey(oPC);
// seeds key, repeat for more dms, only needed if
// not using database or flagging on enter
if (sCDKey == "KCMG43PP") return TRUE;
}
return FALSE;
}
void main()
{
object oPC = GetEnteringObject();
// CHECK IF NEW CHARACTER
if (!GetXP(oPC) && !CSLGetIsDM(oPC, FALSE))
// if (!GetXP(oPC) && !GetIsDM(oPC))
{
CSLDestroyInventory(oPC);
SetXP(oPC, 1);
GiveGoldToCreature(oPC, 1000);
CreateItemOnObject("item1tag", oPC, 1);
CreateItemOnObject("item2tag", oPC, 1);
// do this if it's not normally identified
object oGuide = CreateItemOnObject("item3tag", oPC, 1);
SetIdentified(oGuide, TRUE);
// more than one item
CreateItemOnObject("curepotion", oPC, 5);
}
}This compiles but still have to get the hang of what it's doing ...
#5
Posté 21 août 2011 - 04:40
thanks!
#6
Posté 21 août 2011 - 11:32
abrcadabra abacadabra - you are now an OnClientEnter Script!!!





Retour en haut






