2Lex
Спасибо, нашел нужные скрипты, но взникли вопросы
Расковырял архивчик Scripts. Нашел файл nw_s0_crundead.NSS. Насколько понял здесь находится скрипт описывающий заклинания Поднятие нежити. В остальных поднятиях структура та же.
И вопросы по файлу: в скрипте используется 3 метода (функции), это
X2PreSpellCastCode() -- не нашел его объявление в nwscript.NSS и врядли имеет отношение к вопросу, т.к. используется во всех заклах и отменяет их действие при не выполнении (на сколько понял).
effect EffectSummonCreature(string, int, float, int) -- задаются первые два аргумента, остальные по умолчанию, вроде.
void ApplyEffectAtLocation(int, effect, location, float) -- последний аргумент берется по умолчанию.
Последние 2 метода объявлены в nwscript.NSS. Но где их описание? Перерыл весь Scripts и не нашел описания EffectSummonCreature(string, int, float, int). С ApplyEffectAtLocation(int, effect, location, float), наверное, та же история. Где описаны эти функции? Может кто-то знает или предполагает? Вроде эти функции и надо править, т.к. больше и нечего.
Но скорее всего дело в EffectSummonCreature, описание:
// Create a Summon Creature effect. The creature is created and placed into the
// caller's party/faction.
// - sCreatureResref: Identifies the creature to be summoned
// - nVisualEffectId: VFX_*
// - fDelaySeconds: There can be delay between the visual effect being played, and the
// creature being added to the area
// - nUseAppearAnimation: should this creature play it's "appear" animation when it is
// summoned. If zero, it will just fade in somewhere near the target. If the value is 1
// it will use the appear animation, and if it's 2 it will use appear2 (which doesn't exist for most creatures)
effect EffectSummonCreature(string sCreatureResref, int nVisualEffectId=VFX_NONE, float fDelaySeconds=0.0f, int nUseAppearAnimation=0);
Не могу понять за что отвечает последний параметр. Помогите разобраться, пожалуйста.
А что за "вариант с доминированием"? Пробовать готов
Теперь что смог найти.
Вот здесь есть что-то подобное.
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=590809&forum=114&highlight=SummoningТам есть вот этот скрипт, но самому с ним разобраться трудно. И имеются подключаемые библиотеки, созданные автором, а что в них -- загадка. Помогите, пожалуйста, разобраться. В программировании немного разбираюсь, но в NWN2 залез впервые.
Чем лучше занятся: делать с нуля или использовать нижеприведенный скрипт?
CODE
Neverwinter Script Source
#include "x2_inc_itemprop"
#include "x2_i0_spells"
#include "x0_i0_assoc"
#include "x2_inc_switches"
#include "_inc_propertystrings"
#include "_inc_helper_functions"
void DestroyUndead( object oPC ) { // KILLS ALL DOMINATED CREATURES OF A PC
int nCnt = GetLocalInt( oPC, "UNDEADCOUNT" );
if ( nCnt==0 ) return;
object oArea = GetArea( oPC );
object oMinion = GetFirstObjectInArea( oArea );
while ( GetIsObjectValid( oMinion )) {
if ( GetObjectType( oMinion )==OBJECT_TYPE_CREATURE && GetMaster( oMinion )==oPC && GetRacialType( oMinion )==RACIAL_TYPE_UNDEAD ) {
ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectNWN2SpecialEffectFile( "fx_turn_undead.sef", oMinion ), oMinion );
DelayCommand( 0.0, DestroyObject( oMinion ));
}
oMinion = GetNextObjectInArea( oArea );
}
DeleteLocalInt( oPC, "UNDEADCOUNT" );
}
int BuffUndeadItem( object oSum, int nSlot, int nEB, int nDamBonus ) {
object oItem = GetItemInSlot( nSlot, oSum ); // ENCHANT THE CLAWS
if ( oItem!=OBJECT_INVALID ) {
IPSafeAddItemProperty( oItem, ItemPropertyEnhancementBonus( nEB ));
if ( nDamBonus ){
IPSafeAddItemProperty( oItem, ItemPropertyDamageBonus( IP_CONST_DAMAGETYPE_NEGATIVE, nDamBonus ));
} else {
}
return TRUE;
}
return FALSE;
}
void BoostUndeadSummon( object oPC, object oSum = OBJECT_INVALID ) {
if ( oSum==OBJECT_INVALID ) oSum = GetAssociate( ASSOCIATE_TYPE_SUMMONED, oPC );
int nLevel = GetLevelByClass( CLASS_TYPE_PALEMASTER, oPC ); //GetUndeadLevel( oPC );
int nNecro = GetHasFeat( FEAT_GREATER_SPELL_FOCUS_NECROMANCY, oPC ) ? 2 : ( GetHasFeat( FEAT_SPELL_FOCUS_NECROMANCY, oPC ) ? 1 : 0 );
if ( GetHasFeat( FEAT_AUGMENT_SUMMONING, oPC )) {
nNecro++;
effect eAug = EffectAbilityIncrease( ABILITY_STRENGTH, 4 );
eAug = EffectLinkEffects( eAug, EffectAbilityIncrease( ABILITY_CONSTITUTION, 4 ));
ApplyEffectToObject( DURATION_TYPE_INSTANT, ExtraordinaryEffect( eAug ), oSum );
}
if ( nNecro ) {
nNecro++;
nLevel += nNecro;
SendMessageToPC( oPC, "Pale Master Necromancy Boost +" + IntToString( nNecro ));
}
int nBonus = nLevel / 2; // MAX 6
if ( !nBonus ) return;
int nEB = GetMax( 5, nBonus );
int nDamBonus = 0;
if ( nBonus==1 ) nDamBonus = DAMAGE_BONUS_1d4;
else if ( nBonus==2 ) nDamBonus = DAMAGE_BONUS_1d6;
else if ( nBonus==3 ) nDamBonus = DAMAGE_BONUS_1d8;
else if ( nBonus==4 ) nDamBonus = DAMAGE_BONUS_1d10;
else if ( nBonus==5 ) nDamBonus = DAMAGE_BONUS_2d6;
else if ( nBonus==6 ) nDamBonus = DAMAGE_BONUS_2d8;
else if ( nBonus==7 ) nDamBonus = DAMAGE_BONUS_2d10;
else if ( nBonus==8 ) nDamBonus = DAMAGE_BONUS_2d12;
SendMessageToPC( oPC, "Pale Master Necromancy Boost applied: +" + IntToString( nBonus ) + " AC / +" +IntToString( nEB ) + " EB / +" + DamageBonusString( nDamBonus ) + " Negative damage." );
if ( BuffUndeadItem( oSum, INVENTORY_SLOT_RIGHTHAND, nEB, nDamBonus )) BuffUndeadItem( oSum, INVENTORY_SLOT_LEFTHAND, nEB, nDamBonus );
else if ( BuffUndeadItem( oSum, INVENTORY_SLOT_CWEAPON_R, nEB, nDamBonus )) BuffUndeadItem( oSum, INVENTORY_SLOT_CWEAPON_L, nEB, nDamBonus );
ApplyEffectToObject( DURATION_TYPE_PERMANENT, EffectACIncrease( nBonus ), oSum );
}
int CountUndead( object oPC ) {
int nCnt = 0;
if ( GetAssociate( ASSOCIATE_TYPE_DOMINATED, oPC )==OBJECT_INVALID ) return 0;
object oArea = GetArea( oPC );
object oMinion = GetFirstObjectInArea( oArea );
while ( GetIsObjectValid( oMinion )) {
if ( GetObjectType( oMinion )==OBJECT_TYPE_CREATURE ) {
if ( GetMaster( oMinion )==oPC && GetRacialType( oMinion )==RACIAL_TYPE_UNDEAD ) {
nCnt++;
}
}
oMinion = GetNextObjectInArea( oArea );
}
return nCnt;
}
void CreateUndead( object oPC, string sResRef, int nMaxDom = 1, int bRedEyes = FALSE ) {
int nCount = CountUndead( oPC ) + 1;
if ( nCount > nMaxDom ) {
FloatingTextStringOnCreature( "There are too many Undead currently at your service...", oPC, FALSE );
return;
}
location lLocation = GetLocation( oPC );
SetLocalInt( oPC, "UNDEADCOUNT", nCount );
object oMinion = CreateObject( OBJECT_TYPE_CREATURE, sResRef, lLocation, FALSE );
FloatingTextStringOnCreature( "A " + GetName( oMinion ) + " is now at your service.", oPC, FALSE );
SetLastName( oMinion, "of " + GetName( oPC ));//GetName( oMinion )+
SetLocalObject( oMinion, "DOMINATED", oPC );
if ( bRedEyes ) ApplyEffectToObject( DURATION_TYPE_PERMANENT, EffectNWN2SpecialEffectFile( "red_eyes.sef" ), oMinion );
ApplyEffectToObject( DURATION_TYPE_TEMPORARY, ExtraordinaryEffect( EffectCutsceneDominated( ) ), oMinion, HoursToSeconds( 24 ));
ApplyEffectAtLocation( DURATION_TYPE_INSTANT, EffectVisualEffect( VFX_FNF_SUMMON_UNDEAD ), lLocation );
BoostUndeadSummon( oPC, oMinion );
int nDistance = NW_ASC_DISTANCE_6_METERS;
if ( nCount==1 ) nDistance = NW_ASC_DISTANCE_2_METERS;
if ( nCount==2 ) nDistance = NW_ASC_DISTANCE_4_METERS;
SetAssociateState( nDistance, TRUE, oMinion );
int nSpawnInConditions = GetLocalInt( oMinion, "NW_GENERIC_MASTER" );
nSpawnInConditions = nSpawnInConditions | NW_FLAG_STEALTH | NW_FLAG_AMBIENT_ANIMATIONS | NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS | NW_FLAG_FAST_BUFF_ENEMY;
SetLocalInt( oMinion, "NW_GENERIC_MASTER", nSpawnInConditions );
int nCombatConditions = GetLocalInt( oMinion, "X0_COMBAT_CONDITION" );
if ( nCount==1 ) nCombatConditions = nCombatConditions | X0_COMBAT_FLAG_AMBUSHER;
else nCombatConditions = nCombatConditions | X0_COMBAT_FLAG_RANGED;
SetLocalInt( oMinion, "X0_COMBAT_CONDITION", nCombatConditions );
}
void SummonUndead( ) {
object oPC = OBJECT_SELF;
string sResRef = "";
int bRedEyes = FALSE;
int nSpellId = GetSpellId( );
int nLevel = GetLevelByClass( CLASS_TYPE_PALEMASTER, oPC );//GetUndeadLevel( oPC );
int nConjure = GetHasFeat( FEAT_GREATER_SPELL_FOCUS_CONJURATION, oPC ) ? 2 : ( GetHasFeat( FEAT_SPELL_FOCUS_CONJURATION, oPC ) ? 1 : 0 );
nConjure += GetHasFeat( FEAT_AUGMENT_SUMMONING, oPC );
if ( nConjure ) {
nLevel += nConjure;
SendMessageToPC( oPC, "Pale Master Conjuration Boost +" + IntToString( nConjure ));
}
if ( nSpellId==SPELLABILITY_PM_ANIMATE_DEAD ) {
if ( nLevel < 3 ) sResRef = "pm_zombie1";
else if ( nLevel < 5 ) sResRef = "pm_zombie2";
else sResRef = "pm_zombie3";
} else if ( nSpellId==SPELLABILITY_PM_SUMMON_UNDEAD ) {
if ( nLevel < 5 ) sResRef = "pm_skeleton1";
else if ( nLevel < 7 ) sResRef = "pm_skeleton2";
else sResRef = "pm_skeleton3";
} else if ( nSpellId==SPELLABILITY_PM_SUMMON_GREATER_UNDEAD ) {
if ( nLevel < 10 ) sResRef = "pm_ghast1";
else if ( nLevel < 12 ) sResRef = "pm_ghast2";
else sResRef = "pm_ghast3";
}
bRedEyes = ( GetStringRight( sResRef, 1 )=="3" );
CreateUndead( oPC, sResRef, 3, bRedEyes );
}