PDA

View Full Version : Enemy Divination spell (Enemy character sheet)


WRFan
06-19-2009, 04:07 PM
I wrote a spell script for Kotor that will divine important information about an enemy in Kotor. It will display the following info:

http://i467.photobucket.com/albums/rr40/WRFan/kotor_info.jpg

I wrote a similar script for NWN2, but that one is much more complicated, it will also display enemy turn resistance, spell resistance, saves against specific SAVING_THROW_TYPEs, alignment on both good-evil and law-chaos axes, consider Arcane Defense feats for saving throw adjustment etc. But all this info is not necessary for Kotor, so this is just a basic script that will provide the most relevant info.

Beware that unless you cast real invisibility on yourself, casting this spell will cancel standard Kotor stealth mode. It will not cancel real invisibility though.

I don't know how to get an enemy's Force Resistance in Kotor through scripting. I think the function is missing. The only way to find this out is to actually do a Force Resistance check, if you fail to break through the enemy's spell resistance, the message window will display the force resistance.

The Kotor script is below, but if you are interested in comparing the NWN2 script with the Kotor script, you can download my NWN2 script here:

http://home.arcor.de/wrfan/files/nwn2/deathwatch/nw_s0_deathwtch.nss
It supports all NWN2 official campaigns, including the recently released MoW.

Kotor 1 FORCE_POWER_DIVINATION:


case 136: //FORCE_POWER_DIVINATION
{

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));

int Fort = GetFortitudeSavingThrow(oTarget);
int Will = GetWillSavingThrow(oTarget);
int Reflex = GetReflexSavingThrow(oTarget);
int currentHP = GetCurrentHitPoints(oTarget);
int MaxHP = GetMaxHitPoints(oTarget);
int AC = GetAC(oTarget);
string Name = GetName(oTarget);

int Race1 = GetRacialType(oTarget);
string Race2 = IntToString(Race1);

int nClass1 = GetClassByPosition(1, oTarget);
int nClass2 = GetClassByPosition(2, oTarget);
int nClass3 = GetClassByPosition(3, oTarget);

string Class1 = IntToString(nClass1);
string Class2 = IntToString(nClass2);
string Class3 = IntToString(nClass3);

int nLevel1 = GetLevelByClass(nClass1, oTarget);
int nLevel2 = GetLevelByClass(nClass2, oTarget);
int nLevel3 = GetLevelByClass(nClass3, oTarget);
string Level1 = IntToString(nLevel1);
string Level2 = IntToString(nLevel2);
string Level3 = IntToString(nLevel3);

int CurrentHD = nLevel1 + nLevel2 + nLevel3;

///////////////////////////////////////////////////////
if (Class1 == "0")
{
Class1 = "Soldier";
}
else if (Class1 == "1")
{
Class1 = "Scout";
}
else if (Class1 == "2")
{
Class1 = "Scoundrel";
}
else if (Class1 == "3")
{
Class1 = "JediGuardian";
}
else if (Class1 == "4")
{
Class1 = "JediConsular";
}
else if (Class1 == "5")
{
Class1 = "JediSentinel";
}
else if (Class1 == "6")
{
Class1 = "CombatDroid";
}
else if (Class1 == "7")
{
Class1 = "ExpertDroid";
}
else if (Class1 == "8")
{
Class1 = "Minion";
}
////////////////////////////////////////////////////
if (Class2 == "0")
{
Class2 = "Soldier";
}
else if (Class2 == "1")
{
Class2 = "Scout";
}
else if (Class2 == "2")
{
Class2 = "Scoundrel";
}
else if (Class2 == "3")
{
Class2 = "JediGuardian";
}
else if (Class2 == "4")
{
Class2 = "JediConsular";
}
else if (Class2 == "5")
{
Class2 = "JediSentinel";
}
else if (Class2 == "6")
{
Class2 = "CombatDroid";
}
else if (Class2 == "7")
{
Class2 = "ExpertDroid";
}
else if (Class2 == "8")
{
Class2 = "Minion";
}
////////////////////////////////////////////////////
if (Class3 == "0")
{
Class3 = "Soldier";
}
else if (Class3 == "1")
{
Class3 = "Scout";
}
else if (Class3 == "2")
{
Class3 = "Scoundrel";
}
else if (Class3 == "3")
{
Class3 = "JediGuardian";
}
else if (Class3 == "4")
{
Class3 = "JediConsular";
}
else if (Class3 == "5")
{
Class3 = "JediSentinel";
}
else if (Class3 == "6")
{
Class3 = "CombatDroid";
}
else if (Class3 == "7")
{
Class3 = "ExpertDroid";
}
else if (Class3 == "8")
{
Class3 = "Minion";
}
////////////////////////////////////////////////////
if (Race2 == "5")
{
Race2 = "Droid";
}
else if (Race2 == "6")
{
Race2 = "Human";
}

////////////////////////////////////////////////////
int Str = GetAbilityScore(oTarget, ABILITY_STRENGTH);
int Dex = GetAbilityScore(oTarget, ABILITY_DEXTERITY);
int Con = GetAbilityScore(oTarget, ABILITY_CONSTITUTION);
int Int = GetAbilityScore(oTarget, ABILITY_INTELLIGENCE);
int Wis = GetAbilityScore(oTarget, ABILITY_WISDOM);
int Char = GetAbilityScore(oTarget, ABILITY_CHARISMA);

int StrM = GetAbilityModifier(ABILITY_STRENGTH, oTarget);
int DexM = GetAbilityModifier(ABILITY_DEXTERITY, oTarget);
int ConM = GetAbilityModifier(ABILITY_CONSTITUTION, oTarget);
int IntM = GetAbilityModifier(ABILITY_INTELLIGENCE, oTarget);
int WisM = GetAbilityModifier(ABILITY_WISDOM, oTarget);
int CharM = GetAbilityModifier(ABILITY_CHARISMA, oTarget);
////////////////////////////////////////////////////
int TargetSize = GetCreatureSize(oTarget);
string TargetSize2;

if (TargetSize == CREATURE_SIZE_TINY)
{
TargetSize2 = "Tiny";
}
else if (TargetSize == CREATURE_SIZE_SMALL)
{
TargetSize2 = "Small";
}
else if (TargetSize == CREATURE_SIZE_MEDIUM)
{
TargetSize2 = "Medium";
}
else if (TargetSize == CREATURE_SIZE_LARGE)
{
TargetSize2 = "Large";
}
else if (TargetSize == CREATURE_SIZE_HUGE)
{
TargetSize2 = "Huge";
}
else
{
TargetSize2 = "Invalid";
}
////////////////////////////////////////////////////////////////////////
SendMessageToPC(OBJECT_SELF, "Name: " + Name);
SendMessageToPC(OBJECT_SELF, "Race: " + Race2);
SendMessageToPC(OBJECT_SELF, "Classes: " + Class1 + " (" + Level1 + "), " + Class2 + " (" + Level2 + "), " + Class3 + " (" + Level3 + ")");
SendMessageToPC(OBJECT_SELF, "CurrentHD: " + IntToString(CurrentHD));
SendMessageToPC(OBJECT_SELF, "HP: " + IntToString(currentHP) + "/" + IntToString(MaxHP));
SendMessageToPC(OBJECT_SELF, "AC/Size: " + IntToString(AC) + " (AC) / " + TargetSize2 + " (Size)");
SendMessageToPC( OBJECT_SELF, "Abilities / Modifiers: " + IntToString(Str) + "/" + IntToString(StrM) + " (Str), " + IntToString(Dex) + "/" + IntToString(DexM) + " (Dex), " + IntToString(Con) + "/" + IntToString(ConM) + " (Con), " + IntToString(Int) + "/" + IntToString(IntM) + " (Int), " + IntToString(Wis) + "/" + IntToString(WisM) + " (Wis), " + IntToString(Char) + "/" + IntToString(CharM) + " (Char)");
SendMessageToPC( OBJECT_SELF, "Fort/Will/Reflex: " + IntToString(Fort) + " (Fort) / " + IntToString(Will) + " (Will) / " + IntToString(Reflex) + " (Reflex)" );

}
break;