Sarum City enhancements

Adjusted commoner type npc behavior scripts.
This commit is contained in:
EpicValor
2023-09-11 17:11:52 -05:00
parent c369af5071
commit 24b959be8b
38 changed files with 13082 additions and 656 deletions

View File

@@ -397,7 +397,8 @@ void sp_CheckVars(object oNearest, string sCurrentName)
GetLocalInt(oNearest, "ReturnHome") ||
GetLocalInt(oNearest, "RandomFacing") ||
GetLocalInt(oNearest, "ForceAttack") ||
GetLocalInt(oNearest, "PlayAnim"))
GetLocalInt(oNearest, "PlayAnim") ||
GetLocalInt(oNearest, "PickupItems"))
SetLocalInt(oNearest, "DoActions", 1);
}
@@ -780,7 +781,8 @@ int sp_CheckObjects(object oNearest)
// TEST
// ActionDoCommand(sp_PerformActions(oNearest, oCurrent));
sp_PerformActions(oNearest, oCurrent);
}
}
}
else if (oCurrent != OBJECT_INVALID && GetIsDead(oCurrent)) {
DeleteLocalObject(oNearest, "Creature" + IntToString(iCreature));
@@ -1314,11 +1316,12 @@ void sp_TagObject(object oNearest, string sTagType, object oNewObject) {
}
}
if (GetLocalInt(oNearest, "ForceAttack")) {
object oPC = GetLocalObject(oNearest, "NearestPC");
object oPC = GetLocalObject(oNearest, "NearestPC");
if (oPC != OBJECT_INVALID) {
AssignCommand(oNewObject, ClearAllActions());
AssignCommand(oNewObject, ActionAttack(oPC));
}
}
// Debug
if (iDebug == 1) {
@@ -1583,6 +1586,20 @@ location sp_RandomLocation(object oNearest, int iRandArea)
}
void sp_PerformActions(object oNearest, object oCurrent) {
if (GetLocalInt(oNearest, "PickupItems"))
{
object oPickup = GetNearestObject(OBJECT_TYPE_ITEM, oCurrent);
if (GetDistanceBetweenLocations(GetLocation(oCurrent),
GetLocation(oPickup)) < 8.0)
{
object oCurrent = GetNearestCreatureToLocation(CREATURE_TYPE_PLAYER_CHAR, FALSE, GetLocation(oPickup), 1, CREATURE_TYPE_IS_ALIVE, TRUE);
AssignCommand(oCurrent, ClearAllActions());
AssignCommand(oCurrent, ActionForceMoveToObject(oPickup, FALSE, 1.0f, 10.0f));
AssignCommand(oCurrent, ActionPickUpItem(oPickup));
AssignCommand(oCurrent, SpeakString("Ooo, a piece of candy!"));
}
}
// Debug
if (iDebug == 3) {
sp_Debug("sp_PerformActions");
@@ -2122,5 +2139,7 @@ void sp_Main(object oNearest) {
if (iIsValid && iToSpawn) {
AssignCommand(OBJECT_SELF, sp_CreateObject(oNearest, sBluePrint, iToSpawn));
}
}