Updated Jasperre's AI

Updated Jasperre's AI to 1.4, fixed a few other coding bugs & fully compiled module.
This commit is contained in:
Jaysyn904
2021-08-30 17:31:44 -04:00
parent 2e0b5b615b
commit 1c1c90e986
404 changed files with 11239 additions and 7881 deletions

View File

@@ -1,28 +1,27 @@
/************************ [Debug] **********************************************
/*/////////////////////// [Include - Debugging] ////////////////////////////////
Filename: J_Inc_Debug
************************* [Debug] **********************************************
///////////////////////// [Include - Debugging] ////////////////////////////////
This contains DebugActionSpeak, the debug function.
Makes it easier to uncomment debug lines.
************************* [History] ********************************************
///////////////////////// [History] ////////////////////////////////////////////
1.3 - Added
************************* [Workings] *******************************************
- In beta, changed it so this file controls all debug strings. Just
uncomment them and recompile to turn it on/off.
1.4 - TO DO: Added some more debug strings I use
///////////////////////// [Workings] ///////////////////////////////////////////
DebugActionSpeak normally writes a timestamped log entry, and speak a silent
string Server Admins can hear.
To Do: Might make it more generic debug lines, where you can uncomment all
"XX" lines HERE, not in the files, so it compiles without them, and only
need an integer to speak one.
1.3 added:
- DebugActionSpeakByInt(int iInteger);
- Removes many strings into this file
- Can easily comment out all string so they are not added to compiled
scripts if debugging unused (This saves space on compiled files :-D )
- Always uncomment the right bits if not using any debugging.
************************* [Arguments] ******************************************
///////////////////////// [Arguments] //////////////////////////////////////////
Arguments: N/A
************************* [Debug] *********************************************/
///////////////////////// [Include - Debugging] //////////////////////////////*/
// This will speak a cirtain integer number string (similar to a dialog reference).
// - I (Jass) have just moved all strings I used all the time into here, so
@@ -30,7 +29,7 @@
// - The numbers have no reference to much really.
// - Calls DebugActionSpeak!
// - See J_INC_DEBUG to uncomment/recomment in
void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int iInput = FALSE, string sInput = "");
void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int nInput = FALSE, string sInput = "");
// Speaks and stamps a debug string.
// - See J_INC_DEBUG to uncomment/recomment the debug strings.
@@ -43,13 +42,13 @@ void DebugActionSpeak(string sString);
// - The numbers have no reference to much really.
// - Calls DebugActionSpeak!
// - See J_INC_DEBUG to uncomment/recomment in
void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int iInput = FALSE, string sInput = "")
void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int nInput = FALSE, string sInput = "")
{
// TO UNCOMMENT/COMMENT:
// - Add/Remove in "//" before the next lines "/*"
// - Recompile all files
/*
///*
string sDebug;
switch(iInteger)
@@ -58,22 +57,22 @@ void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int iIn
case 1: sDebug = "[DCR:Melee] Most Damaging Weapon. Target: " + GetName(oInput); break;
case 2: sDebug = "[DCR:Melee] Most Damaging as Not Effective"; break;
case 3: sDebug = "[DCR:Melee] Melee Code. No valid melee target/Dead. Exiting"; break;
case 4: sDebug = "[DCR:Melee] Melee attack. [Target] " + GetName(oInput) + " [Feat/Attack] " + IntToString(iInput); break;
case 4: sDebug = "[DCR:Melee] Melee attack. [Target] " + GetName(oInput) + " [Feat/Attack] " + IntToString(nInput); break;
case 5: sDebug = "[DCR:Caster] Defensive Casting Mode ON [Enemy] " + GetName(oInput); break;
case 6: sDebug = "[DCR:Caster] Moving away from AOO's. [Enemy] " + GetName(oInput); break;
case 7: sDebug = "[DCR:Casting] Talent(item) [TalentID] " + IntToString(iInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 8: sDebug = "[DCR:Casting] Workaround for Spontaeous [SpellID] " + IntToString(iInput) + " [Target] " + GetName(oInput); break;
case 9: sDebug = "[DCR:Casting] NormalSpell [ID] " + IntToString(iInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 10: sDebug = "[DCR:Casting] TalentSpell. [ID] " + IntToString(iInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 11: sDebug = "[DCR:Casting] SubSpecialSpell. [ID] " + IntToString(iInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 12: sDebug = "[DCR:Casting] NormalRandomSpell. [ID] " + IntToString(iInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 13: sDebug = "[DCR:Casting] Backup spell caught: " + IntToString(iInput); break;
case 14: sDebug = "[DCR:Feat] [ID] " + IntToString(iInput) + " [Enemy] " + GetName(oInput); break;
case 15: sDebug = "[DCR:Casting] Grenade [ID] " + IntToString(iInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 7: sDebug = "[DCR:Casting] Talent(item) [TalentID] " + IntToString(nInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 8: sDebug = "[DCR:Casting] Workaround for Spontaeous [SpellID] " + IntToString(nInput) + " [Target] " + GetName(oInput); break;
case 9: sDebug = "[DCR:Casting] NormalSpell [ID] " + IntToString(nInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 10: sDebug = "[DCR:Casting] TalentSpell. [ID] " + IntToString(nInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 11: sDebug = "[DCR:Casting] SubSpecialSpell. [ID] " + IntToString(nInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 12: sDebug = "[DCR:Casting] NormalRandomSpell. [ID] " + IntToString(nInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 13: sDebug = "[DCR:Casting] Backup spell caught: " + IntToString(nInput); break;
case 14: sDebug = "[DCR:Feat] [ID] " + IntToString(nInput) + " [Enemy] " + GetName(oInput); break;
case 15: sDebug = "[DCR:Casting] Grenade [ID] " + IntToString(nInput) + " [Target] " + GetName(oInput) + " [Location] " + sInput; break;
case 16: sDebug = "[AOE Call] Moving out of/Dispeling an AOE. [Tag] " + GetTag(oInput); break;
case 17: sDebug = "[DCR:Special] Darkness + Caster. No seen enemy. Dispel/Move."; break;
case 18: sDebug = "[DRC:Talent] Using Talent (Healing). [TalentID] " + IntToString(iInput) + " [Target] " + GetName(oInput); break;
case 19: sDebug = "[DCR:Healing] (Should) Healing [Target]" + GetName(oInput) + " [CurrentHP|Max|ID|Rank|Power] " + IntToString(iInput); break;
case 18: sDebug = "[DRC:Talent] Using Talent (Healing). [TalentID] " + IntToString(nInput) + " [Target] " + GetName(oInput); break;
case 19: sDebug = "[DCR:Healing] (Should) Healing [Target]" + GetName(oInput) + " [CurrentHP|Max|ID|Rank|Power] " + IntToString(nInput); break;
case 20: sDebug = "[DCR Healing] Boss Action, create Critical Wounds potion"; break;
case 21: sDebug = "[DCR:Casting] Healing self with healing kit, [Kit] " + GetName(oInput); break;
case 22: sDebug = "[DCR:Feat] Summoning my familiar"; break;
@@ -86,18 +85,18 @@ void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int iIn
case 29: sDebug = "[DCR:Bard Song] Using"; break;
case 30: sDebug = "[DCR:Bard Curse Song] Using"; break;
case 31: sDebug = "[DCR:All Spells] Error! No casting (No spells, items, target Etc)."; break;
case 32: sDebug = "[DCR:All Spells] [Modifier|BaseDC|SRA] " + IntToString(iInput); break;
case 33: sDebug = "[DCR:Casting] Cheat Spell. End of Spells. [Spell] " + IntToString(iInput) + "[Target]" + GetName(oInput); break;
case 32: sDebug = "[DCR:All Spells] [Modifier|BaseDC|SRA] " + IntToString(nInput); break;
case 33: sDebug = "[DCR:Casting] Cheat Spell. End of Spells. [Spell] " + IntToString(nInput) + "[Target]" + GetName(oInput); break;
case 34: sDebug = "[DCR:All Spells] Ranged Spells. Should use closer spells/move nearer"; break;
case 35: sDebug = "[DCR:Dragon] Breath weapon & attacking [Breath ID] " + IntToString(iInput) + " [Target] " + GetName(oInput); break;
case 35: sDebug = "[DCR:Dragon] Breath weapon & attacking [Breath ID] " + IntToString(nInput) + " [Target] " + GetName(oInput); break;
case 36: sDebug = "[DCR:Dragon] Wing Buffet [Target] " + GetName(oInput); break;
case 37: sDebug = "[DCR:Beholder] Teleport"; break;
case 38: sDebug = "[DCR:Beholder] Rays"; break;
case 39: sDebug = "[DCR:Targeting] No valid enemies in sight, moving to allies target's. [Target] " + GetName(oInput); break;
case 40: sDebug = "[DCR:Targeting] Override Target Seen. [Name]" + GetName(oInput); break;
case 41: sDebug = "[DCR:Targeting] No seen in LOS, Attempting to MOVE to something [Target]" + GetName(oInput); break;
case 42: sDebug = "[DCR:Skill] Using agressive skill (+Attack). [Skill] " + IntToString(iInput) + " [Enemy]" + GetName(oInput); break;
case 43: sDebug = "[DCR:Pre-Melee Spells] All Potions Using. [Spell ID] " + IntToString(iInput); break;
case 42: sDebug = "[DCR:Skill] Using agressive skill (+Attack). [Skill] " + IntToString(nInput) + " [Enemy]" + GetName(oInput); break;
case 43: sDebug = "[DCR:Pre-Melee Spells] All Potions Using. [Spell ID] " + IntToString(nInput); break;
case 44: sDebug = "[DCR:Pre-Melee Spells] True Strike Emptive attack [Target] " + GetName(oInput); break;
case 45: sDebug = "[DCR:CounterSpell] Counterspelling. [Target] " + GetName(oInput); break;
case 46: sDebug = "[DRC] START [Intruder]" + GetName(oInput); break;
@@ -119,26 +118,26 @@ void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int iIn
case 59: sDebug = "[Phisically Attacked] Attacking back. [Attacker(enemy)] " + GetName(oInput); break;
case 60: sDebug = "[Phisically Attacked] Not same area. [Attacker(enemy)] " + GetName(oInput); break;
// Damaged
case 61: sDebug = "[Damaged] Morale Penalty for 600 seconds [Penalty]" + IntToString(iInput); break;
case 61: sDebug = "[Damaged] Morale Penalty for 600 seconds [Penalty]" + IntToString(nInput); break;
case 62: sDebug = "[Damaged] Not in combat: DCR [Damager]" + GetName(oInput); break;
case 63: sDebug = "[Damaged] Not in combat: DCR. Ally hit us. [Damager(Ally?)]" + GetName(oInput); break;
// Death
case 64: sDebug = "[Death] Checking corpse status in " + IntToString(iInput) + " [Killer] " + GetName(oInput) + " [Times Died Now] " + sInput; break;
case 64: sDebug = "[Death] Checking corpse status in " + IntToString(nInput) + " [Killer] " + GetName(oInput) + " [Times Died Now] " + sInput; break;
// Disturbed
case 65: sDebug = "[Disturbed] (pickpocket) Attacking Enemy [Disturber] " + GetName(oInput) + " [Type] " + IntToString(iInput); break;
case 65: sDebug = "[Disturbed] (pickpocket) Attacking Enemy [Disturber] " + GetName(oInput) + " [Type] " + IntToString(nInput); break;
// Rest
case 66: sDebug = "[Rested] Resting. [Type(should be invalid)] " + IntToString(iInput); break;
case 66: sDebug = "[Rested] Resting. [Type(should be invalid)] " + IntToString(nInput); break;
// Spell Cast at
case 67: sDebug = "[Spell] Caster isn't a creature! May look for target [Caster] " + GetName(oInput); break;
case 68: sDebug = "[Spell:Enemy/Hostile] Not in combat. Attacking: [Caster] " + GetName(oInput); break;
case 69: sDebug = "[Spell] (ally). Not in combat. May Attack/Move [Caster] " + GetName(oInput); break;
// Spell Other AI
// - Shouts
case 70: sDebug = "[Shout] Reacting To Shout. [ShoutNo.] " + IntToString(iInput) + " [Shouter] " + GetName(oInput); break;
case 70: sDebug = "[Shout] Reacting To Shout. [ShoutNo.] " + IntToString(nInput) + " [Shouter] " + GetName(oInput); break;
// Constants
// - Search
case 71: sDebug = "[Search] Resting"; break;
case 72: sDebug = "[Search] Searching, No one to attack. [Time] " + sInput; break;
case 72: sDebug = "[Search] Searching, No one to attack. [Rounds Remaining] " + IntToString(nInput) + ". [Possible target] " + GetName(oInput); break;
// - DCR
case 73: sDebug = "[Call for DCR] Default AI [Pre-Set Target]" + GetName(oInput); break;
case 74: sDebug = "[Call for DCR] Custom AI [" + sInput + "] [Pre-Set Target]" + GetName(oInput); break;
@@ -160,14 +159,14 @@ void DebugActionSpeakByInt(int iInteger, object oInput = OBJECT_INVALID, int iIn
void DebugActionSpeak(string sString)
{
// You MUST uncomment this line, IF you use either of the below things
//string sNew = "[Debug]" + GetName(OBJECT_SELF) + "[ObjectID]" + ObjectToString(OBJECT_SELF) + " [Debug] " + sString;
string sNew = "[Debug]" + GetName(OBJECT_SELF) + "[ObjectID]" + ObjectToString(OBJECT_SELF) + " [Debug] " + sString;
// Note, uncomment this, so that DM's can hear the debug speaks, normally it is
// only server admins who can hear the debug. If you are not testing, it might
// be best to keep this uncommented.
// Futher: - Must have debug mode set to 1
// - Only the server admin can seem to see this.
//SpeakString(sNew, TALKVOLUME_SILENT_TALK);
// SpeakString(sNew, TALKVOLUME_TALK);
// Note, uncomment this line to send a message to the first PC in the module.
// - Useful for singleplayer testing
@@ -176,13 +175,13 @@ void DebugActionSpeak(string sString)
// This writes the entry to the log, very important, if debugging
// Futher: - If left up for a long time, logs can get very big with the AI
// - Use to find problems in the AI and report to me :-D (Jasperre)
//WriteTimestampedLogEntry(sNew);
WriteTimestampedLogEntry(sNew);
}
// Debug: To compile this script full, uncomment all of the below.
/*
/* - Add two "/"'s at the start of this line
void main()
{
DebugActionSpeak("Test");
return;
}
*/
//*/