2025/12/15 Update

Updated PEPS
Hooked up new PRC8 GUI event.
Updated nim tools.
Updated readme.
This commit is contained in:
Jaysyn904
2025-12-15 21:37:12 -05:00
parent d897e0c598
commit e0803385be
1191 changed files with 139110 additions and 35267 deletions

View File

@@ -52,6 +52,8 @@ void ai_OnRested(object oCreature);
// Increments/Decrements the following distance of associates.
void ai_FollowIncrement(object oPC, object oAssociate, float fIncrement, string sAssociateType);
// Increments/Decrements the delay when casting each auto buff spell.
void ai_DelaySpellSpeed(object oPC, object oAssociate, float fIncrement, string sAssociateType);
// Turns on/off Ranged combat for oAssociate.
void ai_Ranged(object oPC, object oAssociate, string sAssociateType);
// Turns on/off Ignore enemy associates for oAssociate.
@@ -115,7 +117,7 @@ void ai_Philos_SetStealth(object oMaster, object oCreature, string sAssociateTyp
// Button action for giving commands to associates.
void ai_DoCommand(object oPC, object oAssociate, int nCommand);
// Button action to have associate do an action based on the target via OnPlayer Target event.
void ai_Action(object oPC, object oAssociate);
void ai_Action(object oPC, object oAssociate, int bPCAI = FALSE);
// Toggles between normal ai script and special tactic ai scripts.
void ai_AIScript(object oPC, object oAssociate, string sAssociate, int nToken);
// Has the PC select a Trap and then place it on the ground from an associate.
@@ -130,6 +132,10 @@ void ai_ChangeCameraView(object oPC, object oAssociate);
void ai_OpenInventory(object oAssociate, object oPC);
// Executes an installed plugin.
void ai_Plugin_Execute(object oPC, string sElem, int bUser = 0);
// Turns on oAssociate AI, Setting all event scripts.
void ai_TurnOn(object oPC, object oAssociate, string sAssociateType);
// Turns off oAssociate AI, Setting all event scripts.
void ai_TurnOff(object oPC, object oAssociate, string sAssociateType);
int ai_CanIAttack(object oCreature)
{
@@ -161,7 +167,7 @@ object ai_GetNearestLockedObject(object oCreature)
void ai_FindTheEnemy(object oCreature, object oSpeaker, object oTarget, int bMonster)
{
if(GetLocalInt(oCreature, AI_AM_I_SEARCHING)) return;
if(oSpeaker == oTarget && d100() < 34)
if(oSpeaker == oTarget && d100() < 16)
{
// Let them know we heard something in the distance!.
if(!ai_GetAIMode(oCreature, AI_MODE_DO_NOT_SPEAK))
@@ -232,7 +238,7 @@ void ai_FindTheEnemy(object oCreature, object oSpeaker, object oTarget, int bMon
if(AI_DEBUG) ai_Debug("0i_associates", "176", "Moving and searching for " + GetName(oTarget));
SetActionMode(oCreature, ACTION_MODE_DETECT, TRUE);
ActionMoveToLocation(GetLocation(oTarget), FALSE);
//ActionMoveToObject(oTarget, FALSE, AI_RANGE_MELEE);
//ActionMoveToObject(oTarget, FALSE, AI_RANGE_MELEE);
AssignCommand(oCreature, ActionDoCommand(DeleteLocalInt(oCreature, AI_AM_I_SEARCHING)));
return;
}
@@ -519,6 +525,24 @@ void ai_SelectAssociateCommand(object oCreature, object oCommander, int nCommand
ai_FireHenchman (GetPCSpeaker(), oCreature);
PlayVoiceChat (VOICE_CHAT_GOODBYE, oCreature);
}
else if(AI_PATROL_AHEAD_RADIAL_OPTION)
{
if(ai_GetAIMode(oCreature, AI_MODE_SCOUT_AHEAD))
{
ai_ClearCreatureActions();
ai_HaveCreatureSpeak(oCreature, 6, ":29:35:46:10");
ai_SetAIMode(oCreature, AI_MODE_SCOUT_AHEAD, FALSE);
ai_SendMessages(GetName(oCreature) + " has stopped patrolling ahead.", AI_COLOR_YELLOW, oMaster);
}
else
{
ai_ClearCreatureActions();
ai_HaveCreatureSpeak(oCreature, 6, ":29:35:46:22:");
ai_SetAIMode(oCreature, AI_MODE_SCOUT_AHEAD, TRUE);
ai_SendMessages(GetName(oCreature) + " is now patrolling ahead.", AI_COLOR_YELLOW, oMaster);
ai_ScoutAhead(oCreature);
}
}
}
}
}
@@ -769,7 +793,7 @@ void ai_AssociateEvaluateNewThreat(object oCreature, object oLastPerceived, stri
if(sPerception == AI_I_SEE_AN_ENEMY || GetObjectSeen(oLastPerceived, oCreature))
{
// We are not in combat and we see the enemy so alert our allies!
ai_HaveCreatureSpeak(oCreature, 5, ":0:1:2:3:6:");
ai_HaveCreatureSpeak(oCreature, 10, ":0:1:2:3:6:");
SetLocalObject (oCreature, AI_MY_TARGET, oLastPerceived);
SpeakString(sPerception, TALKVOLUME_SILENT_TALK);
ai_StartAssociateCombat(oCreature);
@@ -832,10 +856,10 @@ void ai_MonsterEvaluateNewThreat(object oCreature, object oLastPerceived, string
if(d100() < 34)
{
// We are not in combat so alert our allies!
ai_HaveCreatureSpeak(oCreature, 5, ":0:1:2:3:6:");
ai_HaveCreatureSpeak(oCreature, 10, ":0:1:2:3:6:");
}
SetLocalObject(oCreature, AI_MY_TARGET, oLastPerceived);
SpeakString(sPerception, TALKVOLUME_SILENT_TALK);
SpeakString(AI_I_SEE_AN_ENEMY, TALKVOLUME_SILENT_TALK);
ai_StartMonsterCombat(oCreature);
}
else ai_FindTheEnemy(oCreature, oLastPerceived, oLastPerceived, TRUE);
@@ -919,6 +943,23 @@ void ai_FollowIncrement(object oPC, object oAssociate, float fIncrement, string
ai_UpdateToolTipUI(oPC, sAssociateType + AI_COMMAND_NUI, sAssociateType + AI_WIDGET_NUI, "btn_follow_target_tooltip", " " + GetName(oAssociate) + " following " + sTarget + " [" + sRange + " meters]");
}
}
void ai_DelaySpellSpeed(object oPC, object oAssociate, float fIncrement, string sAssociateType)
{
float fAdjustment = GetLocalFloat(oAssociate, AI_DELAY_BUFF_CASTING) + fIncrement;
if(fAdjustment > 6.0) fAdjustment = 6.0;
else if(fAdjustment < 0.1) fAdjustment = 0.1;
SetLocalFloat(oAssociate, AI_DELAY_BUFF_CASTING, fAdjustment);
json jAIData = ai_GetAssociateDbJson(oPC, sAssociateType, "aidata");
jAIData = JsonArraySet(jAIData, 11, JsonFloat(fAdjustment));
ai_SetAssociateDbJson(oPC, sAssociateType, "aidata", jAIData);
string sDelay = FloatToString(fAdjustment, 0, 1);
ai_UpdateToolTipUI(oPC, sAssociateType + AI_COMMAND_NUI, sAssociateType + AI_WIDGET_NUI,
"btn_buff_long_tooltip", " Buff the party with long duration spells. Cast speed [" + sDelay + "]");
ai_UpdateToolTipUI(oPC, sAssociateType + AI_COMMAND_NUI, sAssociateType + AI_WIDGET_NUI,
"btn_buff_short_tooltip", " Buff the party with short duration spells. Cast speed [" + sDelay + "]");
ai_UpdateToolTipUI(oPC, sAssociateType + AI_COMMAND_NUI, sAssociateType + AI_WIDGET_NUI,
"btn_buff_all_tooltip", " Buff the party with all spells. Cast speed [" + sDelay + "]");
}
void ai_Ranged(object oPC, object oAssociate, string sAssociateType)
{
//ai_ClearCreatureActions();
@@ -1903,18 +1944,20 @@ void ai_DoCommand(object oPC, object oAssociate, int nCommand)
}
}
}
void ai_Action(object oPC, object oAssociate)
void ai_Action(object oPC, object oAssociate, int bPCAI = FALSE)
{
if(oPC == oAssociate)
{
DeleteLocalObject(oPC, "NW_ASSOCIATE_COMMAND");
SetLocalString(oPC, AI_TARGET_MODE, "ASSOCIATE_ACTION_ALL");
ai_SendMessages("Select an action for the party.", AI_COLOR_YELLOW, oPC);
}
else
{
SetLocalObject(oPC, AI_TARGET_ASSOCIATE, oAssociate);
SetLocalObject(oPC, AI_TARGET_MODE_ASSOCIATE, oAssociate);
SetLocalString(oPC, AI_TARGET_MODE, "ASSOCIATE_ACTION");
SetLocalInt(oPC, AI_TARGET_MODE_ON, TRUE);
if(!GetLocalInt(GetModule(), AI_USING_PRC) && bPCAI) ai_TurnOn(oPC, oPC, "pc");
ai_SendMessages("Select an action for " + GetName(oAssociate) + ".", AI_COLOR_YELLOW, oPC);
}
EnterTargetingMode(oPC, OBJECT_TYPE_ALL, MOUSECURSOR_ACTION, MOUSECURSOR_NOWALK);
@@ -2139,6 +2182,7 @@ void ai_ChangeCameraView(object oPC, object oAssociate)
{
SetLocalObject(oPC, "AI_CAMERA_ON_ASSOCIATE", oAssociate);
AttachCamera(oPC, oAssociate);
if(!ai_GetIsCharacter(oAssociate)) ai_Action(oPC, oAssociate, TRUE);
}
}
void ai_SelectCameraView(object oPC)
@@ -2190,3 +2234,47 @@ void ai_Plugin_Execute(object oPC, string sElem, int bUser = 0)
ExecuteScript(sScript, oPC);
}
}
void ai_TurnOn(object oPC, object oTarget, string sAssociateType)
{
ai_UpdateToolTipUI(oPC, sAssociateType + AI_NUI, sAssociateType + AI_WIDGET_NUI, "btn_ai_tooltip", " AI On");
ai_SendMessages("AI turned on for " + GetName(oTarget) + ".", AI_COLOR_YELLOW, oPC);
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, "xx_pc_1_hb");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_NOTICE, "xx_pc_2_percept");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_END_COMBATROUND, "xx_pc_3_endround");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_DIALOGUE, "xx_pc_4_convers");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_MELEE_ATTACKED, "xx_pc_5_phyatked");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_DAMAGED, "xx_pc_6_damaged");
//SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_DEATH, "");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_DISTURBED, "xx_pc_8_disturb");
//SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_SPAWN_IN, "");
//SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_RESTED, "");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_SPELLCASTAT, "xx_pc_b_castat");
SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_BLOCKED_BY_DOOR, "xx_pc_e_blocked");
//SetEventScript(oTarget, EVENT_SCRIPT_CREATURE_ON_USER_DEFINED_EVENT, "");
// This sets the script for the PC to run AI based on class.
ai_SetAssociateAIScript(oTarget, FALSE);
// Set so PC can hear associates talking in combat.
ai_SetListeningPatterns(oTarget);
}
void ai_TurnOff(object oPC, object oAssociate, string sAssociateType)
{
ai_UpdateToolTipUI(oPC, sAssociateType + AI_NUI, sAssociateType + AI_WIDGET_NUI, "btn_ai_tooltip", " AI Off");
ai_SendMessages("AI Turned off for " + GetName(oAssociate) + ".", AI_COLOR_YELLOW, oPC);
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_NOTICE, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_END_COMBATROUND, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_DIALOGUE, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_MELEE_ATTACKED, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_DAMAGED, "");
//SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_DEATH, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_DISTURBED, "");
//SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_SPAWN_IN, "");
//SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_RESTED, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_SPELLCASTAT, "");
SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_BLOCKED_BY_DOOR, "");
//SetEventScript(oAssociate, EVENT_SCRIPT_CREATURE_ON_USER_DEFINED_EVENT, "");
DeleteLocalInt(oAssociate, "AI_I_AM_BEING_HEALED");
DeleteLocalString(oAssociate, "AIScript");
ai_ClearCreatureActions();
}