party loot with henchmen 100% working

some other changes I made last night before bed.
This commit is contained in:
EpicValor
2023-09-19 22:54:03 -05:00
parent 05986aecf7
commit e5f3606cac
33 changed files with 2974 additions and 693 deletions

View File

@@ -12,20 +12,26 @@ void main()
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);
object oParty = GetFirstFactionMember(oMaster, TRUE);
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);
TurnToFaceObject(oThing);
ActionMoveToObject (oThing, TRUE, 1.0f);
ActionDoCommand (SendMessageToPC(oParty, GetName(oMaster)+"'s golem"+" picked up "+sName+"."));
ActionPickUpItem(oThing);
}
oParty = GetNextFactionMember(oMaster, TRUE);
}
}
}
else // oThing is a placeable
{
@@ -39,21 +45,28 @@ void main()
bFound = TRUE;
ActionMoveToObject (oThing, TRUE, 1.0f);
ActionDoCommand(AssignCommand(oThing,PlayAnimation(ANIMATION_PLACEABLE_OPEN)));
TurnToFaceObject(oThing);
ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,3.0,0.5);
object oItem = GetFirstItemInInventory(oThing);
object oMaster = GetMaster(OBJECT_SELF);
object oParty = GetFirstFactionMember(OBJECT_SELF, TRUE);
while(GetIsObjectValid(oItem))
{
ActionDoCommand (SendMessageToPC(oParty, GetName(oMaster)+"'s golem"+" picked up "+GetName(oItem)+" from "+GetName(oThing)+"."));
ActionTakeItem(oItem,oThing);
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)));
}
}
ActionDoCommand(AssignCommand(oThing,PlayAnimation(ANIMATION_PLACEABLE_CLOSE)));
}
}
}
} // else
oThing = GetNextObjectInShape(SHAPE_SPHERE,60.0,lCenter,TRUE,OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);

View File

@@ -0,0 +1,64 @@
#include "69_inc_henai"
void main()
{
object oMaster = GetMaster();
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);
// Create a list of party members
object oPartyMember = GetFirstFactionMember(oMaster, TRUE);
while (GetIsObjectValid(oThing))
{
if (GetObjectType(oThing) == OBJECT_TYPE_ITEM)
{
bFound = TRUE;
sName = GetName(oThing);
{
ActionDoCommand(SendMessageToPC(oPartyMember, GetName(oMaster) +"'s" + " golem picked up " + sName + "."));
ActionPickUpItem(oThing);
//oPartyMember = 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);
ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 3.0, 0.5);
object oItem = GetFirstItemInInventory(oThing);
string sItem = GetName(oItem);
while (GetIsObjectValid(oItem))
{
ActionDoCommand (SendMessageToPC(oPartyMember, GetName(oMaster) +"'s" + " golem picked up " + sItem + "."));
ActionTakeItem(oItem, oThing);
oItem = GetNextItemInInventory(oThing);
}
ActionDoCommand(AssignCommand(oThing, PlayAnimation(ANIMATION_PLACEABLE_CLOSE)));
}
oPartyMember = GetNextFactionMember(oMaster);
}
//}
} // else
oThing = GetNextObjectInShape(SHAPE_SPHERE, 60.0, lCenter, TRUE, OBJECT_TYPE_PLACEABLE | OBJECT_TYPE_ITEM);
} // while(GetIsObjectValid(oThing))
ActionDoCommand(SetAssociateState(NW_ASC_IS_BUSY, FALSE));
if (!bFound)
SpeakString("I don't see where I can find any around here.");
}

View File

@@ -5,10 +5,11 @@ void main()
return;
SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);
object oTarget = OBJECT_SELF;
effect eMind = EffectVisualEffect(VFX_DUR_PROT_BARKSKIN, VFX_DUR_PETRIFY);
effect eGhost = EffectCutsceneGhost();
effect eMind = EffectVisualEffect(VFX_DUR_PROT_BARKSKIN);
effect eGhost = EffectVisualEffect(VFX_DUR_GHOST_TRANSPARENT);
eMind = UnyieldingEffect(eMind);
eGhost = UnyieldingEffect(eGhost);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, OBJECT_SELF);
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, oTarget));
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT, eMind, oTarget));
SetLocalInt(OBJECT_SELF, "X1_L_IMMUNE_TO_DISPEL", 100);

View File

@@ -29,5 +29,5 @@ void main()
// ***** ADD ANY SPECIAL ON-SPAWN CODE HERE ***** //
DelayCommand(5.0, ExecuteScript("random_drop", OBJECT_SELF));
DelayCommand(10.0, ExecuteScript("random_drop", OBJECT_SELF));
}

View File

@@ -8,6 +8,8 @@ void main()
object oTarget = OBJECT_SELF;
effect eMind2 = EffectCutsceneParalyze();
effect eMind = EffectVisualEffect(VFX_DUR_PETRIFY);
eMind = UnyieldingEffect(eMind);
eMind2 = UnyieldingEffect(eMind2);
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT, eMind, oTarget));
DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_PERMANENT, eMind2, oTarget));