Aantioch_Infernum/_module/nss/69_hench_pickup.nss
EpicValor 3811a4f205 Updates areas, spawns, items, mobs
and fixed typos in convos up to convo_cashan
2023-09-21 19:10:12 -05:00

85 lines
3.2 KiB
Plaintext

//Contributed by Mike Daneman aka. Mishenka
//Modified: 69MEH69 Added more items to pick up
//Modified by EpicValor for party loot
#include "69_inc_henai"
void main()
{
ClearAllActions();
SetAssociateState(NW_ASC_IS_BUSY);
int bFound = FALSE;
string sName;
location lCenter = GetLocation(OBJECT_SELF);
object oThing = GetFirstObjectInShape(SHAPE_SPHERE,60.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);
object oMaster = GetMaster(OBJECT_SELF);
while(GetIsObjectValid(oThing))
{
if(GetObjectType(oThing)==OBJECT_TYPE_ITEM)
{
bFound = TRUE;
{
object oParty = GetFirstFactionMember(oMaster, TRUE);
while (GetIsObjectValid(oParty))
{
// Check if it's a player character
if (GetIsPC(oParty))
{
sName = GetName(oThing);
ActionDoCommand (SendMessageToPC(oParty, GetName(oMaster)+"'s golem"+" picked up "+sName+"."));
ActionPickUpItem(oThing);
}
oParty = GetNextFactionMember(oMaster, TRUE);
}
}
}
else // oThing is a placeable
{
if(GetHasInventory(oThing)) // Containers (including corpses)
{
// Don't search locked containers
// Only search trapped containers if you can't see the trap
if(!GetLocked(oThing) && (!GetIsTrapped(oThing)
|| (GetIsTrapped(oThing) && !GetTrapDetectedBy(oThing,OBJECT_SELF))))
{
bFound = TRUE;
ActionMoveToObject (oThing, TRUE, 1.0f);
ActionDoCommand(AssignCommand(oThing,PlayAnimation(ANIMATION_PLACEABLE_OPEN)));
ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,3.0,0.5);
object oItem = GetFirstItemInInventory(oThing);
object oMaster = GetMaster(OBJECT_SELF);
while(GetIsObjectValid(oItem))
{
string iName = GetName(oItem);
object oParty = GetFirstFactionMember(oMaster, TRUE);
while (GetIsObjectValid(oParty))
{
// Check if it's a player character
if (GetIsPC(oParty))
{
ActionDoCommand (SendMessageToPC(oParty, GetName(oMaster)+"'s golem"+" picked up "+GetName(oItem)+" from "+GetName(oThing)+"."));
ActionTakeItem(oItem,oThing);
}
oParty = GetNextFactionMember(oMaster, TRUE);
oItem = GetNextItemInInventory(oThing);
}
ActionDoCommand(AssignCommand(oThing,PlayAnimation(ANIMATION_PLACEABLE_CLOSE)));
}
}
}
}
oThing = GetNextObjectInShape(SHAPE_SPHERE,60.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);
}
ActionDoCommand(SetAssociateState(NW_ASC_IS_BUSY,FALSE));
if(!bFound)
ActionSpeakString("I don't see where I can find any around here.", TALKVOLUME_PARTY);
}