PoA_PRC8/_module/nss/strip_guild_oe.nss

94 lines
2.2 KiB
Plaintext
Raw Permalink Normal View History

2022-10-07 14:20:31 -04:00
//strip_guild_oe
//this script goes in the OnEnter Event of a Tracks Trigger in an area
//were ALL of the PCs do not enter at once, like the tent area for example..
void main()
{
object o = GetEnteringObject();
object oItem, oGuild, oPass;
string sGuild, sPass;
//Stop here if it's not a PC or it's a DM
if(!GetIsPC(o)) {return;}
if(GetIsDM(o)) {return;}
//If they have a guild pass stop here...
oPass = GetItemPossessedBy(o, "guildpass");
if(oPass != OBJECT_INVALID) {return;}
oItem = GetFirstItemInInventory(o);
while(GetIsObjectValid(oItem))
{
//Check Item Name for the word "Guild"
sGuild = GetName(oItem);
if(GetStringLeft(sGuild, 5)=="Guild")
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
//Check Tagname of item for "guild"
sPass = GetTag(oItem);
if(sPass == "guild") //Change "guild" to the tagname you use for all guild items
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
//Double Check Tagname for "guild"
if(GetStringLeft(sPass, 5)=="guild")
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
//Finally, check resref name as well...
sGuild = GetResRef(oItem);
if(GetStringLeft(sGuild, 5)=="guild")
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
oItem = GetNextItemInInventory(o);
}
int nSlot;
object oPC = o;
for (nSlot=0; nSlot<NUM_INVENTORY_SLOTS; nSlot++)
{
oItem=GetItemInSlot(nSlot, oPC);
//Check Item Name for the word "Guild"
sGuild = GetName(oItem);
if(GetStringLeft(sGuild, 5)=="Guild")
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
//Check Tagname of item for "guild"
sPass = GetTag(oItem);
if(sPass == "guild") //Change "guild" to the tagname you use for all guild items
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
//Double Check Tagname for "guild"
if(GetStringLeft(sPass, 5)=="guild")
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
//Finally, check resref name as well...
sGuild = GetResRef(oItem);
if(GetStringLeft(sGuild, 5)=="guild")
{
SetPlotFlag(oItem, FALSE);
DestroyObject(oItem, 0.0f);
}
}
}