2025/12/15 Update
Updated PEPS Hooked up new PRC8 GUI event. Updated nim tools. Updated readme.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "nw_inc_gff"
|
||||
#include "x0_i0_assoc"
|
||||
#include "0i_menus"
|
||||
#include "0i_module"
|
||||
#include "0i_player_target"
|
||||
// Save a window ID to the database.
|
||||
void ai_SaveWindowLocation(object oPC, int nToken, string sAssociateType, string sWindowID);
|
||||
@@ -32,10 +33,6 @@ void ai_RulePercDistInc(object oPC, object oModule, int nIncrement, int nToken);
|
||||
// Adds a spell to a json AI restricted spell list then returns jRules.
|
||||
// bRestrict = TRUE will add to the list FALSE will remove it from the list.
|
||||
json ai_AddRestrictedSpell(json jRules, int nSpell, int bRestrict = TRUE);
|
||||
// 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);
|
||||
// Adds a henchman back into the players party.
|
||||
object ai_AddHenchman(object oPC, json jHenchman, location lLocation, int nFamiliar, int nCompanion);
|
||||
|
||||
@@ -94,10 +91,20 @@ void main()
|
||||
json jData = NuiGetUserData(oPC, nToken);
|
||||
object oAssociate = StringToObject(JsonGetString(JsonArrayGet(jData, 0)));
|
||||
string sAssociateType = ai_GetAssociateType(oPC, oAssociate);
|
||||
if(ai_GetIsDungeonMaster(oPC))
|
||||
{
|
||||
if(!NuiFindWindow(oPC, "dm" + AI_WIDGET_NUI))
|
||||
{
|
||||
ai_SendMessages(GetName(oPC) + " is now a Dungeon Master! Loading Dungeon Master widget.", AI_COLOR_YELLOW, oPC);
|
||||
ai_CheckDMStart(oPC);
|
||||
}
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nToken));
|
||||
return;
|
||||
}
|
||||
if(!ai_GetIsCharacter(oAssociate) && !GetLocalInt(oPC, "AI_IGNORE_NO_ASSOCIATE") &&
|
||||
(oAssociate == OBJECT_INVALID || GetMaster(oAssociate) != oPC))
|
||||
{
|
||||
ai_SendMessages("This creature is no longer in your party!", AI_COLOR_RED, oPC);
|
||||
ai_SendMessages(GetName(oAssociate) + " is no longer in your party!", AI_COLOR_RED, oPC);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nToken));
|
||||
return;
|
||||
}
|
||||
@@ -196,57 +203,6 @@ void main()
|
||||
aiSaveAssociateModesToDb(oPC, oPC);
|
||||
}
|
||||
}
|
||||
else if(sElem == "btn_toggle_assoc_widget")
|
||||
{
|
||||
int bWidgetOff = !ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oPC, "pc");
|
||||
string sAssocType;
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oPC, "pc", bWidgetOff);
|
||||
object oAssoc = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
int nIndex;
|
||||
object oHenchman;
|
||||
for(nIndex = 1; nIndex <= AI_MAX_HENCHMAN; nIndex++)
|
||||
{
|
||||
oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC, nIndex);
|
||||
if(oHenchman != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oHenchman);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oHenchman, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oHenchman);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sElem == "btn_effect_icon")
|
||||
{
|
||||
if(ai_GetMagicMode(oPC, AI_MAGIC_EFFECT_ICON_REPORT))
|
||||
@@ -280,10 +236,10 @@ void main()
|
||||
{
|
||||
int nMaxHenchmen = StringToInt(sText);
|
||||
if(nMaxHenchmen < 1) nMaxHenchmen = 1;
|
||||
if(nMaxHenchmen > 12)
|
||||
if(nMaxHenchmen > AI_MAX_HENCHMAN)
|
||||
{
|
||||
nMaxHenchmen = 12;
|
||||
ai_SendMessages("The maximum henchmen for this mod is 12!", AI_COLOR_RED, oPC);
|
||||
nMaxHenchmen = AI_MAX_HENCHMAN;
|
||||
ai_SendMessages("The maximum henchmen for this mod is " + IntToString(AI_MAX_HENCHMAN) + "!", AI_COLOR_RED, oPC);
|
||||
}
|
||||
SetMaxHenchmen(nMaxHenchmen);
|
||||
SetLocalInt(oModule, AI_RULE_MAX_HENCHMAN, nMaxHenchmen);
|
||||
@@ -318,7 +274,7 @@ void main()
|
||||
{
|
||||
int nNumber = StringToInt(sText);
|
||||
if(nNumber < 0) nNumber = 0;
|
||||
else if(nNumber > 100) nNumber = 100;
|
||||
else if(nNumber > 500) nNumber = 500;
|
||||
SetLocalInt(oModule, AI_INCREASE_MONSTERS_HP, nNumber);
|
||||
jRules = JsonObjectSet(jRules, AI_INCREASE_MONSTERS_HP, JsonInt(nNumber));
|
||||
}
|
||||
@@ -354,6 +310,12 @@ void main()
|
||||
{
|
||||
SetLocalInt(oModule, AI_RULE_BUFF_MONSTERS, bCheck);
|
||||
jRules = JsonObjectSet(jRules, AI_RULE_BUFF_MONSTERS, JsonInt(bCheck));
|
||||
NuiSetBind(oPC, nToken, "chbx_full_buff_event", JsonBool(bCheck));
|
||||
}
|
||||
else if(sElem == "chbx_full_buff_check")
|
||||
{
|
||||
SetLocalInt(oModule, AI_RULE_FULL_BUFF_MONSTERS, bCheck);
|
||||
jRules = JsonObjectSet(jRules, AI_RULE_FULL_BUFF_MONSTERS, JsonInt(bCheck));
|
||||
}
|
||||
else if(sElem == "chbx_buff_summons_check")
|
||||
{
|
||||
@@ -579,6 +541,60 @@ void main()
|
||||
else if(sElem == "btn_familiar_name") ai_SetCompanionName(oPC, oAssociate, nToken, ASSOCIATE_TYPE_FAMILIAR);
|
||||
else if(sElem == "btn_companion_name") ai_SetCompanionName(oPC, oAssociate, nToken, ASSOCIATE_TYPE_ANIMALCOMPANION);
|
||||
else if(GetStringLeft(sElem, 11) == "btn_plugin_") ai_Plugin_Execute(oPC, sElem);
|
||||
else if(sElem == "btn_toggle_assoc_widget")
|
||||
{
|
||||
int bWidgetOff = !ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oPC, "pc");
|
||||
string sAssocType, sText;
|
||||
if(bWidgetOff) sText = " Associate Widgets [Off]";
|
||||
else sText = " Associate Widgets [On]";
|
||||
ai_UpdateToolTipUI(oPC, sAssociateType + AI_COMMAND_NUI, sAssociateType + AI_WIDGET_NUI, "btn_toggle_assoc_widget_tooltip", sText);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oPC, "pc", bWidgetOff);
|
||||
object oAssoc = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
int nIndex;
|
||||
object oHenchman;
|
||||
for(nIndex = 1; nIndex <= AI_MAX_HENCHMAN; nIndex++)
|
||||
{
|
||||
oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC, nIndex);
|
||||
if(oHenchman != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oHenchman);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oHenchman, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oHenchman);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sEvent == "watch")
|
||||
{
|
||||
@@ -597,10 +613,14 @@ void main()
|
||||
jPlugin = JsonArraySet(jPlugin, 1, JsonBool(bCheck));
|
||||
jPlugins = JsonArraySet(jPlugins, nIndex, jPlugin);
|
||||
ai_SetAssociateDbJson(oPC, "pc", "plugins", jPlugins);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
}
|
||||
}
|
||||
else if(sElem == "chbx_buff_rest_check") ai_SetWidgetButtonToCheckbox(oPC, BTN_BUFF_REST, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "chbx_toggle_assoc_widget_check") ai_SetWidgetButtonToCheckbox(oPC, BTN_ASSOC_WIDGETS_OFF, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "chbx_cmd_action_check") ai_SetWidgetButtonToCheckbox(oPC, BTN_CMD_ACTION, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "chbx_cmd_guard_check") ai_SetWidgetButtonToCheckbox(oPC, BTN_CMD_GUARD, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "chbx_cmd_hold_check") ai_SetWidgetButtonToCheckbox(oPC, BTN_CMD_HOLD, oAssociate, sAssociateType, nToken, sElem);
|
||||
@@ -623,8 +643,11 @@ void main()
|
||||
else if(sElem == "chbx_companion_check") ai_SetWidgetButtonToCheckbox(oPC, BTN_CMD_COMPANION, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "cmb_familiar_selected") ai_SetCompanionType(oPC, oAssociate, nToken, ASSOCIATE_TYPE_FAMILIAR);
|
||||
else if(sElem == "cmb_companion_selected") ai_SetCompanionType(oPC, oAssociate, nToken, ASSOCIATE_TYPE_ANIMALCOMPANION);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, sAssociateType + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, sAssociateType + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
}
|
||||
}
|
||||
else if(sEvent == "mousescroll")
|
||||
{
|
||||
@@ -635,6 +658,9 @@ void main()
|
||||
if(sElem == "btn_cmd_follow" &&
|
||||
oPC != oAssociate) ai_FollowIncrement(oPC, oAssociate, 1.0, sAssociateType);
|
||||
else if(sElem == "btn_follow_target") ai_FollowIncrement(oPC, oAssociate, 1.0, sAssociateType);
|
||||
else if(sElem == "btn_buff_long") ai_DelaySpellSpeed(oPC, oAssociate, 0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_short") ai_DelaySpellSpeed(oPC, oAssociate, 0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_all") ai_DelaySpellSpeed(oPC, oAssociate, 0.1, sAssociateType);
|
||||
}
|
||||
else if(nMouseScroll == -1.0) // Scroll down
|
||||
{
|
||||
@@ -642,6 +668,9 @@ void main()
|
||||
if(sElem == "btn_cmd_follow" &&
|
||||
oPC != oAssociate) ai_FollowIncrement(oPC, oAssociate, -1.0, sAssociateType);
|
||||
else if(sElem == "btn_follow_target") ai_FollowIncrement(oPC, oAssociate, -1.0, sAssociateType);
|
||||
else if(sElem == "btn_buff_long") ai_DelaySpellSpeed(oPC, oAssociate, -0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_short") ai_DelaySpellSpeed(oPC, oAssociate, -0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_all") ai_DelaySpellSpeed(oPC, oAssociate, -0.1, sAssociateType);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -722,8 +751,11 @@ void main()
|
||||
else if(sElem == "chbx_ignore_traps_check") ai_SetAIButtonToCheckbox(oPC, BTN_AI_IGNORE_TRAPS, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "chbx_perc_range_check") ai_SetAIButtonToCheckbox(oPC, BTN_AI_PERC_RANGE, oAssociate, sAssociateType, nToken, sElem);
|
||||
else if(sElem == "cmb_ai_script_selected") ai_SetAIScript(oPC, oAssociate, nToken);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, sAssociateType + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, sAssociateType + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
}
|
||||
}
|
||||
else if(sEvent == "mousescroll")
|
||||
{
|
||||
@@ -863,6 +895,60 @@ void main()
|
||||
else if(sElem == "btn_update_widget") ai_UpdateAssociateWidget(oPC, oAssociate);
|
||||
else if(GetStringLeft(sElem, 15) == "btn_exe_plugin_") ai_Plugin_Execute(oPC, sElem);
|
||||
else if(GetStringLeft(sElem, 11) == "btn_widget_") ai_SelectWidgetSpellTarget(oPC, oAssociate, sElem);
|
||||
else if(sElem == "btn_toggle_assoc_widget")
|
||||
{
|
||||
int bWidgetOff = !ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oPC, "pc");
|
||||
string sAssocType, sText;
|
||||
if(bWidgetOff) sText = "Associate Widgets [Off]";
|
||||
else sText = "Associate Widgets [On]";
|
||||
ai_UpdateToolTipUI(oPC, sAssociateType + AI_COMMAND_NUI, sAssociateType + AI_WIDGET_NUI, "btn_toggle_assoc_widget_tooltip", sText);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oPC, "pc", bWidgetOff);
|
||||
object oAssoc = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
oAssoc = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC);
|
||||
if(oAssoc != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oAssoc);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oAssoc, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oAssoc);
|
||||
}
|
||||
int nIndex;
|
||||
object oHenchman;
|
||||
for(nIndex = 1; nIndex <= AI_MAX_HENCHMAN; nIndex++)
|
||||
{
|
||||
oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC, nIndex);
|
||||
if(oHenchman != OBJECT_INVALID)
|
||||
{
|
||||
sAssocType = ai_GetAssociateType(oPC, oHenchman);
|
||||
ai_SetWidgetButton(oPC, BTN_WIDGET_OFF, oHenchman, sAssocType, bWidgetOff);
|
||||
if(bWidgetOff) IsWindowClosed(oPC, sAssocType + AI_WIDGET_NUI);
|
||||
else ai_CreateWidgetNUI(oPC, oHenchman);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sEvent == "mousescroll")
|
||||
{
|
||||
@@ -881,6 +967,9 @@ void main()
|
||||
else if(sElem == "btn_heal_in") ai_Heal_Button(oPC, oAssociate, 5, AI_HEAL_IN_COMBAT_LIMIT, sAssociateType);
|
||||
else if(sElem == "btn_loot") ai_LootRangeIncrement(oPC, oAssociate, 1.0, sAssociateType);
|
||||
else if(sElem == "btn_perc_range") ai_PercRangeIncrement(oPC, oAssociate, 1, sAssociateType, -1);
|
||||
else if(sElem == "btn_buff_long") ai_DelaySpellSpeed(oPC, oAssociate, 0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_short") ai_DelaySpellSpeed(oPC, oAssociate, 0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_all") ai_DelaySpellSpeed(oPC, oAssociate, 0.1, sAssociateType);
|
||||
}
|
||||
if(nMouseScroll == -1.0) // Scroll down
|
||||
{
|
||||
@@ -897,6 +986,9 @@ void main()
|
||||
else if(sElem == "btn_heal_in") ai_Heal_Button(oPC, oAssociate, -5, AI_HEAL_IN_COMBAT_LIMIT, sAssociateType);
|
||||
else if(sElem == "btn_loot") ai_LootRangeIncrement(oPC, oAssociate, -1.0, sAssociateType);
|
||||
else if(sElem == "btn_perc_range") ai_PercRangeIncrement(oPC, oAssociate, -1, sAssociateType, -1);
|
||||
else if(sElem == "btn_buff_long") ai_DelaySpellSpeed(oPC, oAssociate, -0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_short") ai_DelaySpellSpeed(oPC, oAssociate, -0.1, sAssociateType);
|
||||
else if(sElem == "btn_buff_all") ai_DelaySpellSpeed(oPC, oAssociate, -0.1, sAssociateType);
|
||||
}
|
||||
}
|
||||
if(sEvent == "mousedown")
|
||||
@@ -1174,9 +1266,10 @@ void main()
|
||||
{
|
||||
json jPlugins = ai_GetAssociateDbJson(oPC, "pc", "plugins");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_buffing");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_forcerest");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_henchmen");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_crafting");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_forcerest");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_fast_travel");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_henchmen");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_mod_set");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_debug");
|
||||
jPlugins = ai_Plugin_Add(oPC, jPlugins, "pi_test");
|
||||
@@ -1209,8 +1302,11 @@ void main()
|
||||
ai_SetAssociateDbJson(oPC, "pc", "plugins", jPlugins);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nToken));
|
||||
DelayCommand(0.1, ai_CreatePluginNUI(oPC));
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
}
|
||||
}
|
||||
if(sElem == "btn_clear_plugins")
|
||||
{
|
||||
@@ -1229,8 +1325,11 @@ void main()
|
||||
ai_SetAssociateDbJson(oPC, "pc", "plugins", jPlugins);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nToken));
|
||||
DelayCommand(0.1, ai_CreatePluginNUI(oPC));
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
}
|
||||
}
|
||||
else if(sElem == "btn_add_plugin")
|
||||
{
|
||||
@@ -1249,8 +1348,11 @@ void main()
|
||||
ai_SetAssociateDbJson(oPC, "pc", "plugins", jPlugins);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nToken));
|
||||
DelayCommand(0.1, ai_CreatePluginNUI(oPC));
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
}
|
||||
}
|
||||
else if(GetStringLeft(sElem, 11) == "btn_plugin_") ai_Plugin_Execute(oPC, sElem);
|
||||
}
|
||||
@@ -1265,8 +1367,11 @@ void main()
|
||||
jPlugin = JsonArraySet(jPlugin, 1, JsonBool(bCheck));
|
||||
jPlugins = JsonArraySet(jPlugins, nIndex, jPlugin);
|
||||
ai_SetAssociateDbJson(oPC, "pc", "plugins", jPlugins);
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, NuiFindWindow(oPC, "pc" + AI_WIDGET_NUI)));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oPC));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1348,11 +1453,14 @@ void main()
|
||||
}
|
||||
else if(sEvent == "close")
|
||||
{
|
||||
int nUIToken = NuiFindWindow(oPC, sAssociateType + AI_QUICK_WIDGET_NUI);
|
||||
if(nUIToken)
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nUIToken));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
int nUIToken = NuiFindWindow(oPC, sAssociateType + AI_QUICK_WIDGET_NUI);
|
||||
if(nUIToken)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nUIToken));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1435,11 +1543,14 @@ void main()
|
||||
}
|
||||
else if(sEvent == "close")
|
||||
{
|
||||
int nUIToken = NuiFindWindow(oPC, sAssociateType + AI_QUICK_WIDGET_NUI);
|
||||
if(nUIToken)
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nUIToken));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
int nUIToken = NuiFindWindow(oPC, sAssociateType + AI_QUICK_WIDGET_NUI);
|
||||
if(nUIToken)
|
||||
{
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nUIToken));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1615,6 +1726,7 @@ void main()
|
||||
if(GetLocalInt(oAssociate, "AI_KNOWN_SPELL_CHANGE"))
|
||||
{
|
||||
RemoveHenchman(oPC, oAssociate);
|
||||
ChangeToStandardFaction(oAssociate, STANDARD_FACTION_DEFENDER);
|
||||
json jHenchman = ObjectToJson(oAssociate, TRUE);
|
||||
json jClassList = GetLocalJson(oAssociate, AI_CLASS_LIST_JSON);
|
||||
jHenchman = GffReplaceList(jHenchman, "ClassList", jClassList);
|
||||
@@ -1627,8 +1739,12 @@ void main()
|
||||
AssignCommand(oAssociate, SetIsDestroyable(TRUE, FALSE, FALSE));
|
||||
DestroyObject(oAssociate);
|
||||
oAssociate = ai_AddHenchman(oPC, jHenchman, lLocation, nFamiliar, nCompanion);
|
||||
DeleteLocalJson(oAssociate, AI_CLASS_LIST_JSON);
|
||||
DeleteLocalInt(oAssociate, "AI_KNOWN_SPELL_CHANGE");
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1698,7 +1814,11 @@ void ai_AddAssociate(object oPC, int nToken, json jAssociate, location lLocation
|
||||
AddHenchman(oPC, oAssociate);
|
||||
DeleteLocalInt(oPC, "AI_IGNORE_NO_ASSOCIATE");
|
||||
DelayCommand(0.0, NuiDestroy(oPC, nToken));
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
string sAssociateType = ai_GetAssociateType(oPC, oAssociate);
|
||||
if(!ai_GetWidgetButton(oPC, BTN_WIDGET_OFF, oAssociate, sAssociateType) || oPC == oAssociate)
|
||||
{
|
||||
DelayCommand(0.1, ai_CreateWidgetNUI(oPC, oAssociate));
|
||||
}
|
||||
if(nRange) SetLocalInt(oAssociate, AI_ASSOCIATE_PERCEPTION, nRange);
|
||||
if(nFamiliar) SummonFamiliar(oAssociate);
|
||||
if(nCompanion) SummonAnimalCompanion(oAssociate);
|
||||
@@ -1816,12 +1936,12 @@ void ai_Perc_Range(object oPC, object oAssociate, int nToken, string sAssociateT
|
||||
SetLocalInt(oPC, "AI_IGNORE_NO_ASSOCIATE", TRUE);
|
||||
int nBtnPercRange = GetLocalInt(oAssociate, AI_ASSOCIATE_PERCEPTION + "_MENU");
|
||||
string sText, sText2;
|
||||
float fRange = 20.0;
|
||||
float fRange = 25.0;
|
||||
if(nBtnPercRange == 8)
|
||||
{
|
||||
sText = "short";
|
||||
sText2 = " Perception Range Short [10 meters Sight / 10 meters Listen]";
|
||||
fRange = 10.0;
|
||||
fRange = 15.0;
|
||||
}
|
||||
else if(nBtnPercRange == 9)
|
||||
{
|
||||
@@ -1832,7 +1952,7 @@ void ai_Perc_Range(object oPC, object oAssociate, int nToken, string sAssociateT
|
||||
{
|
||||
sText = "long";
|
||||
sText2 = " Perception Range Long [35 meters Sight / 20 meters Listen]";
|
||||
fRange = 35.0;
|
||||
fRange = 40.0;
|
||||
}
|
||||
else if(nBtnPercRange == 11)
|
||||
{
|
||||
@@ -1914,49 +2034,6 @@ json ai_AddRestrictedSpell(json jRules, int nSpell, int bRestrict = TRUE)
|
||||
SetLocalJson(oModule, AI_RULE_RESTRICTED_SPELLS, jRSpells);
|
||||
return JsonObjectSet(jRules, AI_RULE_RESTRICTED_SPELLS, jRSpells);
|
||||
}
|
||||
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();
|
||||
}
|
||||
object ai_AddHenchman(object oPC, json jHenchman, location lLocation, int nFamiliar, int nCompanion)
|
||||
{
|
||||
jHenchman = GffReplaceResRef(jHenchman, "ScriptSpawn", "");
|
||||
|
||||
Reference in New Issue
Block a user