So I have managed to do Combat AI on PC character at NWN:EE where you still have control on your PC but if it sees enemies he starts to attack them and use spells/feats just like normal AI vs AI. I’m trying to do something at NWN2 too. One of the members on discord made a script for NWN:EE but obviously it doesn’t work for NWN2. So maybe someone is familiar with a code and maybe with some changes would be possible to do the same thing for NWN2? It should be a compiledscript where you just use a console command ‘‘dm_runscript xxx’’ and Combat AI should be on. Any ideas what needs to be changed to make it work? Here is a code:
void main()
{
// Toggle AI scripts
object oPC = GetFirstPC();
if(GetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_BLOCKED_BY_DOOR) == "x2_def_onblocked")
{
SendMessageToPC(oPC, "Turning AI off");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_BLOCKED_BY_DOOR, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DAMAGED, "");
//SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DEATH, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DIALOGUE, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DISTURBED, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_END_COMBATROUND, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_MELEE_ATTACKED, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_NOTICE, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_RESTED, "");
//SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_SPAWN_IN, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_SPELLCASTAT, "");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_USER_DEFINED_EVENT, "");
}
else
{
SendMessageToPC(oPC, "Turning AI on");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_BLOCKED_BY_DOOR, "x2_def_onblocked");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DAMAGED, "x2_def_ondamage");
//SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DEATH, "x2_def_ondeath");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DIALOGUE, "x2_def_onconv");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_DISTURBED, "x2_def_ondisturb");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_END_COMBATROUND, "x2_def_endcombat");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, "x2_def_heartbeat");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_MELEE_ATTACKED, "x2_def_attacked");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_NOTICE, "x2_def_percept");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_RESTED, "x2_def_rested");
//SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_SPAWN_IN, "x2_def_spawn");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_SPELLCASTAT, "x2_def_spellcast");
SetEventScript(oPC, EVENT_SCRIPT_CREATURE_ON_USER_DEFINED_EVENT, "x2_def_userdef");
}
}