I can't seem to get it to work. Has anyone sucessfully used it? I didn't find it in the broken function thread.
GetCasterclassSpellSchool() is it a broken function?
Débuté par
M. Rieder
, nov. 01 2011 01:14
#1
Posté 01 novembre 2011 - 01:14
#2
Posté 01 novembre 2011 - 01:32
Its broken, i have a workaround using a gui hack in the csl library. ( CSL library doxygen lists all the nwscript functions for the base game and which are broken )
#3
Posté 06 novembre 2011 - 02:16
I looked and couldn't find it, what is the function called?
#4
Posté 06 novembre 2011 - 10:27
Its not really a function, its a gui callback script, a variable and its built into the hkspell include for handling spells, and also the AI with the library that figures out the casters levels and DC's.
This is how i use it for getting the red wizard bonus.
SC_iSpellSchool is set in code by the following - this is the caching routine i run when building up the characters or monsters stats.
the following is the xml xml _scgui_data.XML
gui_getchardata.nss is the function the callback runs.
This is how i use it for getting the red wizard bonus.
{
if ( iclass == -1 )
{
iclass = GetLocalInt( oCaster, "HKTEMP_class" )-1;
}
if (iclass == class_TYPE_WIZARD && GetHasFeat( FEAT_RED_WIZARD_SPELLCASTING_WIZARD, oCaster ) )
{
// now check for the school of the spell
if ( iCurrentSchool == -1 )
{
iCurrentSchool = GetLocalInt( oCaster, "HKTEMP_School" );
}
int iCasterSchool = GetLocalInt( oCaster, "SC_iSpellSchool"); // this is the casters school
//int iclassPosition = CSLGetPositionByclass( class_TYPE_WIZARD, oCaster );
//int iCasterSchool = GetCasterclassSpellSchool(oCaster, iclassPosition );
if ( iCurrentSchool == iCasterSchool )
{
return GetLevelByclass( class_TYPE_RED_WIZARD, oCaster )/2;
}
}
return 0;
}
SC_iSpellSchool is set in code by the following - this is the caching routine i run when building up the characters or monsters stats.
DisplayGuiScreen(oChar, SCREEN_CHARACTERDATA, FALSE, XML_CHARACTERDATA);
the following is the xml xml _scgui_data.XML
<?xml version="1.0" encoding="utf-8"> <!-- local:0 - Stores the value. (use additional variables if you want to extract multiple fields) --> <UIScene name="SCREEN_CHAR_DATA" x="ALIGN_LEFT" y="ALIGN_TOP" width="200" height="40" idleexpiretime="1.0" scriptloadable="true" backoutkey="false" priority="SCENE_SCRIPT" modal="false" OnAdd="UIObject_Misc_RequestCharacterUpdates(0,true,STATS)" OnRemove="UIObject_Misc_RequestCharacterUpdates(0,false)" /> <UIPane width="200" height="40" hidden="true" focusable="false" > <UIText width="PARENT_WIDTH" height="PARENT_HEIGHT" update="true" hidden="true" OnUpdate0="UIObject_OnUpdate_GetCharacterData(PARTY,SCHOOL)" OnUpdate1="UIObject_Misc_SetLocalVarString(local:0)" OnUpdate2="UIObject_Misc_ExecuteServerScript(gui_getchardata,SCHOOL,local:0)" /> </UIPane>Which does the callback, its run prior to needing this generally.
gui_getchardata.nss is the function the callback runs.
void main(string sField, string sValue)
{
//Trim the value string.
sValue = GetStringRight(sValue, GetStringLength(sValue) - 17);
object oChar = OBJECT_SELF;
//SendMessageToPC(oChar, "Running Script School");
//SpeakString("Running Script School");
// Categorize and store the character data for easier retrieval.
// Assign feats (as Raelius Archmannon suggested) or store in your DB.
//SendMessageToPC(OBJECT_SELF, sField + " = " + sValue);
if ( sField == "SCHOOL" ) // don't even bother if the field returned is not school, possibly make this fire once for each field desired
{
int iTargetSchool = -1;
// Lets do some validation, this should already be set up correctly, but checking for monkey business
// If the caster is a specialist some other things should be set as well
// is the caster a wizard
if ( GetLevelByclass( class_TYPE_WIZARD, oChar ) > 0 )
{
if ( sValue == "Abjuration" && GetHasFeat( FEAT_SPELL_FOCUS_ABJURATION ) )
{
iTargetSchool = SPELL_SCHOOL_ABJURATION;
}
else if ( sValue == "Conjuration" && GetHasFeat( FEAT_SPELL_FOCUS_CONJURATION ) )
{
iTargetSchool = SPELL_SCHOOL_CONJURATION;
}
else if ( sValue == "Divination" && GetHasFeat( FEAT_SPELL_FOCUS_DIVINATION ) )
{
iTargetSchool = SPELL_SCHOOL_DIVINATION;
}
else if ( sValue == "Enchantment" && GetHasFeat( FEAT_SPELL_FOCUS_ENCHANTMENT ) )
{
iTargetSchool = SPELL_SCHOOL_ENCHANTMENT;
}
else if ( sValue == "Evocation" && GetHasFeat( FEAT_SPELL_FOCUS_EVOCATION ) )
{
iTargetSchool = SPELL_SCHOOL_EVOCATION;
}
else if ( sValue == "Illusion" && GetHasFeat( FEAT_SPELL_FOCUS_ILLUSION ) )
{
iTargetSchool = SPELL_SCHOOL_ILLUSION;
}
else if ( sValue == "Necromancy" && GetHasFeat( FEAT_SPELL_FOCUS_NECROMANCY ) )
{
iTargetSchool = SPELL_SCHOOL_NECROMANCY;
}
else if ( sValue == "Transmutation" && GetHasFeat( FEAT_SPELL_FOCUS_TRANSMUTATION ) )
{
iTargetSchool = SPELL_SCHOOL_TRANSMUTATION;
}
else
{
iTargetSchool = SPELL_SCHOOL_GENERAL;
if ( GetLevelByclass( class_TYPE_RED_WIZARD, oChar ) > 0 )
{
// log message to dms now, we hve an issue, red wizards have to have a speciality.
// set up benefits so it does not matter too much
}
}
//iTargetSchool = 100;
SetLocalInt(oChar, "SC_iSpellSchool", iTargetSchool );
}
}
//SetLocalInt(oChar, "SC_iSpellSchool", 99 );
CloseGUIScreen(OBJECT_SELF, "SCREEN_CHAR_DATA");
}
#5
Posté 09 novembre 2011 - 06:23
Oh, I think I see. There is an XML function that will properly retrieve the school and then you put that into NWScript?





Retour en haut






