As mentioned in my previous posts, I've already resumed building my module for Neverwinter Nights 2. Last night, I created various characters that will inhabit the fictional world of my module. I also started writing the conversations for some of these characters, and some basic conversation scripts such as conditions, item reward, and alignment change. So far, I've encountered minor bumps and potholes with all those things indicated above. However, I did reach an impasse when I was trying to figure out a faction change/attack script through a conversation.
I was trying to let these guys, these two factions (pictured above), duke it out after a plot revealing conversation using this script:
#include "nw_i0_generic"
void main()
{
object oBloodrose = GetObjectByTag("npc_bloodrose");
object oPrisoner1 = GetObjectByTag("thug_orcprison1");
object oPrisoner2 = GetObjectByTag("thug_orcprison2");
object oPrisoner3 = GetObjectByTag("thug_humanprison");
object oPrisoner4 = GetObjectByTag("thug_archerprison1");
object oPrisoner5 = GetObjectByTag("thug_archerprison2");
ChangeToStandardFaction(oBloodrose, STANDARD_FACTION_HOSTILE);
ChangeToStandardFaction(oPrisoner1, STANDARD_FACTION_HOSTILE);
ChangeToStandardFaction(oPrisoner2, STANDARD_FACTION_HOSTILE);
ChangeToStandardFaction(oPrisoner3, STANDARD_FACTION_HOSTILE);
ChangeToStandardFaction(oPrisoner4, STANDARD_FACTION_HOSTILE);
ChangeToStandardFaction(oPrisoner5, STANDARD_FACTION_HOSTILE);
{
It did change the prisoner faction (the group with the dwarven leader on its front) into the hostile faction but they all (including the defender faction) just stood there instead of attacking everyone in sight. What's worse is that even if the player character beat the crap out of the hostile faction, they still did nothing. Since I'm not a scripter this thing became a huge roadblock in my progress.
But I was determined to break through the stop sign. So I stayed up till the morning hours searching for various scripts at
NWN2 scripting forums, the
NWN Lexicon, and even from the original campaign's modules. Finally, after hours of digging and searching, I found a faction change script that is similar to mine, except it also assigns an NPC to start its combat round (at least, that's what I think). So I edited my original script and included this:
AssignCommand(oBloodrose, DetermineCombatRound());
AssignCommand(oPrisoner1, DetermineCombatRound());
AssignCommand(oPrisoner2, DetermineCombatRound());
AssignCommand(oPrisoner3, DetermineCombatRound());
AssignCommand(oPrisoner4, DetermineCombatRound());
AssignCommand(oPrisoner5, DetermineCombatRound());
Now, the script turns the prisoner faction into hostile, and also starts its combat rounds. So the opposite factions duke it out at each other the way I wanted. Solving this problem removed a really deep thron from my side. I just hope I don't encounter something big like this in the future. But, being a greenhorn at module building, that is highly unlikely.