2025/09/06 Update
Fixed damaged baseitems.2da Updated PEPS. Full compile.
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))
|
||||
@@ -579,6 +535,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 +607,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 +637,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")
|
||||
{
|
||||
@@ -722,8 +739,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 +883,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")
|
||||
{
|
||||
@@ -1209,8 +1283,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 +1306,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 +1329,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 +1348,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 +1434,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 +1524,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 +1707,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 +1720,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 +1795,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 +1917,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 +1933,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 +2015,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