Problème pour donner un don

Répondre
Partager Rechercher
Actuellement, je suis confronter à un problème relativement inexplicable.
Via script je souhaite ajouter un don à un PJ, le don se trouve ligne 2150 de mon feat.2da.
La fonction en question:
Code:
// Set the PC as a Lycanthrope
void iniPC( object oPC, string sAnimal, int nInnate )
{
	string sPCName = GetBicFileName( oPC );
	int nRace = GetAppearanceType( oPC );
	int nPCHD = GetHitDice( oPC );
	
	string sSQL = "INSERT INTO polymorph_player (playername, baserace, animal, innate)" +
				" VALUES ( '" + sPCName + "', '"+ IntToString( nRace ) +"', '"+ sAnimal +"', '"+ IntToString(nInnate) +"' )";

	SQLExecDirect( sSQL );
	
	sSQL = "SELECT dv" +
		" FROM polymorph_animal, polymorph_player" +
		" WHERE playername = '" + sPCName +"'" +
		" AND polymorph_animal.animal = polymorph_player.animal ";
		
	SQLExecDirect( sSQL );
	
	//Give x Level of Animal classe to oPC, without his/her consent
	if( SQLFetch() )
	{	
		// SpeakString( "Niveau visé: " + IntToString( StringToInt( SQLGetData( 1 ) )+nPCHD), TALKVOLUME_SHOUT );
		while( LevelUpHenchman( oPC, CLASS_TYPE_ANIMAL, TRUE, PACKAGE_ANIMAL ) < (StringToInt( SQLGetData( 1 ) )+nPCHD) )
		{} // Don't try this at home, or at school !
		
	}
	// Add free Feat and bonus stat a Lycanthrope gain as a base creature
	FeatAdd( oPC, 22, FALSE, TRUE, TRUE ); // Iron Will
	FeatAdd( oPC, 228, FALSE, TRUE, TRUE ); // Darkvision
	FeatAdd( oPC, 2150, FALSE, TRUE, TRUE ); // Lycan
	ApplyEffectToObject( DURATION_TYPE_PERMANENT, SupernaturalEffect( EffectACIncrease( 2, AC_NATURAL_BONUS ) ), oPC );
	adjustAbilityPos( oPC, ABILITY_WISDOM, 2 ); // +2 at Wisdom
	
	FeatRemove( oPC, 289 ); // Creature Weapon Profiency
}
Le don en question est un copier/coller/modifier du don de Forme Animal du Druide.
Lorsque je fais tourner le module sur mon PC (Nwn2 + MotB + SoZ) aucun problème, le personnage reçoit bien tous ces dons, ces niveaux de classes, peut se transformer sous forme animal/hybrid/normal à volonté, le monde est beau.
Mais lorsque je fais tourner le module sur le serveur (Nwn2 + MotB) qui sera destiné à accueillir au final le module avec cette fonctionnalité, et bien le joueur reçoit tout, sauf le don de Lycan (ligne 2150 du feat.2da). La ligne "FeatAdd( oPC, 2150, FALSE, TRUE, TRUE ); // Lycan" semble totalement ignorée. Et impossible de lui faire entendre raison.
Sur les deux machines, les .hak sont les même, le module est le même, la base de donnée est la même, la ligne 2150 du feat.2da existe bien sur le serveur...

Donc avez vous une idée de ce qui clocherait ? Je ne crois pas que le problème puisse être imputé à l'absence de SoZ sur le serveur.
Voulant contourner le problème passablement agaçant ci-dessus, j'ai donc tenter d'user d'objets pour gérer les transformations.
Pour se faire j'use de ces fonctions:
Code PHP:

#include "nwnx_include"
#include "nwnx_sql"

const string sRFBiteG "nw_it_crewps010";
const 
string sRFClawG "nw_it_crewpsp005";

const 
string sRFBite "nw_it_crewps005";
const 
string sRFClaw "nw_it_crewpsp026";

const 
string sRFCArmourInnate "duk_carmor_innate";
const 
string sRFCArmour "duk_carmor";

/* =============================================================================== */

// Add nModifier to nAbility of oCreature
void adjustAbilityPosobject oCreatureint nAbilityint nModifier )
{
    
SetBaseAbilityScoreoCreaturenAbilityGetAbilityScoreoCreaturenAbilityTRUE ) + nModifier );
}

// Sub nModifier to nAbility of oCreature
void adjustAbilityNegobject oCreatureint nAbilityint nModifier )
{
    
SetBaseAbilityScoreoCreaturenAbilityGetAbilityScoreoCreaturenAbilityTRUE ) - nModifier );
}

// Rise the HitPoint of oCreature when morphing into hybrid or animal form
void pseudoHealingobject oCreatureint nConMod )
{
    
int nHD GetHitDiceoCreature );
    
    
ApplyEffectToObjectDURATION_TYPE_INSTANTEffectHealnHD nConMod /), oCreature );
}

// Lower the HitPoint of oCreature when morphing back to normal form
void pseudoHurtingobject oCreatureint nConMod )
{
    
int nHD GetHitDiceoCreature );
    
int nDamage nConMod /nHD;
    
    
// SpeakString( "Damage: " + IntToString( nDamage ), TALKVOLUME_SHOUT );
    
    // It will not kill oCreature this way
    
if( GetCurrentHitPointsoCreature ) < nDamage )
        
nDamage GetCurrentHitPointsoCreature ) -1;
    
    
ApplyEffectToObjectDURATION_TYPE_INSTANTEffectDamagenDamageDAMAGE_TYPE_MAGICALDAMAGE_POWER_NORMAL ), oCreature );
}

// Add nModifier to nSkill of oCreature
void adjustSkillPosobject oCreatureint nSkillint nModifier )
{
    
SetBaseSkillRankoCreaturenSkill, ( GetSkillRanknSkilloCreatureTRUE ) + nModifier ) );
}

// Sub nModifier to nSkill of oCreature
void adjustSkillSubobject oCreatureint nSkillint nModifier )
{
    
SetBaseSkillRankoCreaturenSkill, ( GetSkillRanknSkilloCreatureTRUE ) - nModifier ) );
}

// Set the Appearance, weapons, and ability to oCreature transformed in sAnimal
void setPCobject oCreaturestring sAnimalint nAppearanceint nInnate )
{
    
// SpeakString( "Set the PC form !", TALKVOLUME_SHOUT );

    
string sSQL "SELECT size, bonusfor, bonusdex, bonuscon" 
                
" FROM polymorph_animal" +
                
" WHERE animal = '" sAnimal "'";

    
SQLExecDirectsSQL );
    
    
// Do almost nothing if oCreature is already in Hybrid or Animal form
    
if( SQLFetch() && !GetLocalIntoCreature"morphed" ) )
    {
        
// Add to oCreature its bonus in Strength, Dexterity, and Constitution
        
adjustAbilityPosoCreatureABILITY_STRENGTHStringToIntSQLGetData) ) );
        
adjustAbilityPosoCreatureABILITY_DEXTERITYStringToIntSQLGetData) ) );
        
adjustAbilityPosoCreatureABILITY_CONSTITUTIONStringToIntSQLGetData) ) );
        
        
FeatAddoCreature289TRUE ); // Creature Weapon Profiency
        
        // Create and equip Bite, Claws, and Creature Armour
        
object oBite;
        
object oClaw;
        
        if( 
StringToIntSQLGetData) ) == CREATURE_SIZE_LARGE )
        {
            
oBite CreateItemOnObjectsRFBiteGoCreature1""FALSE );
            
oClaw CreateItemOnObjectsRFClawGoCreature1""FALSE );;
        }
        else
        {
            
oBite CreateItemOnObjectsRFBiteoCreature1""FALSE );
            
oClaw CreateItemOnObjectsRFClawoCreature1""FALSE );
        }
        
        
// SpeakString( "Equip Start !", TALKVOLUME_SHOUT );
        
ActionEquipItemoBiteINVENTORY_SLOT_CWEAPON_B );
        
ActionEquipItemoClawINVENTORY_SLOT_CWEAPON_R );
        
ActionEquipItemoClawINVENTORY_SLOT_CWEAPON_L );
        
// SpeakString( "Equip End !", TALKVOLUME_SHOUT );
        
        
object oCArmour;
        if( 
nInnate )
            
oCArmour CreateItemOnObjectsRFCArmourInnateoCreature1""FALSE );
        else
            
oCArmour CreateItemOnObjectsRFCArmouroCreature1""FALSE );
            
        
ActionEquipItemoCArmourINVENTORY_SLOT_CARMOUR );
        
        
pseudoHealingoCreatureStringToIntSQLGetData) ) );
        
        
// Add the bonus skill point from the hybrid and animal form
        
sSQL "SELECT skill, skillpoint" +
            
" FROM polymorph_skill" +
            
" WHERE animal = '" sAnimal "'";
        
        
SQLExecDirectsSQL );
        
        while( 
SQLFetch() )
            
adjustSkillPosoCreatureStringToIntSQLGetData) ), StringToIntSQLGetData) ) );
        
        
// Add the bonus feat from the hybrid and animal form
        
sSQL "SELECT bonusfeat" +
            
" FROM polymorph_feat " +
            
" WHERE animal = '" sAnimal "'";
            
        
SQLExecDirectsSQL );
        
        while( 
SQLFetch() )
            
FeatAddoCreatureStringToIntSQLGetData) ), FALSE );
        
        
SetLocalIntoCreature"morphed");
    }
    
    
// Give the expected nAppearance to oCreature
    
SetCreatureAppearanceTypeoCreaturenAppearance );
}

// Change the caller in an hybrid form
void changeToHybridobject oTarget )
{
    if( 
GetLocalIntoTarget"DM_Morph" ) )
        return;

    
// SpeakString( "Hybrid Form !", TALKVOLUME_SHOUT );
    
    
string sPC GetBicFileNameoTarget );
    
    
string sSQL "SELECT appearance_hybrid, innate, polymorph_player.animal" 
                
" FROM polymorph_appearance, polymorph_player" +
                
" WHERE playername = '" sPC "'" +
                
" AND polymorph_player.animal = polymorph_appearance.animal";
                
    
SQLExecDirectsSQL );
    
    if( 
SQLFetch() )
    {
        
// SpeakString( SQLGetData( 1 ), TALKVOLUME_SHOUT );
        
setPCoTargetSQLGetData), StringToIntSQLGetData) ), StringToIntSQLGetData) ) );
    }
}

// Change the caller in an animal form
void changeToAnimalobject oTarget )
{
    if( 
GetLocalIntoTarget"DM_Morph" ) )
        return;

    
// SpeakString( "Animal Form !", TALKVOLUME_SHOUT );

    
string sPC GetBicFileNameoTarget );
    
    
string sSQL "SELECT appearance_animal, innate, polymorph_player.animal" 
                
" FROM polymorph_appearance, polymorph_player" +
                
" WHERE playername = '" sPC "'" +
                
" AND polymorph_player.animal = polymorph_appearance.animal";
                
    
SQLExecDirectsSQL );
    
    if( 
SQLFetch() )
    {
        
// SpeakString( SQLGetData( 1 ), TALKVOLUME_SHOUT );
        
setPCoTargetSQLGetData), StringToIntSQLGetData) ), StringToIntSQLGetData) ) );
    }
    
int i 0;
    for( 
i6; ++)
        
ActionUnequipItemGetItemInSlotioTarget ) );

Les objets en question, quand ils sont utilisés (activés) font appel au fonction changeToAnimal() et changeToHybrid(), selon le cas.
Le problème rencontré est qu'en faisant ainsi, le personnage change bien d'apparence, gagne les dons, les points de compétences et de stats, mais refuse d'équiper l'une des griffes, la morsures, et la peau de créature, alors que cela fonctionne parfaitement quand j'utilise le don plutôt qu'un objet !

Ça en devient désespérant, alors auriez vous une idée pour m'aider ?
Citation :
Publié par C.DuK
Le problème rencontré est qu'en faisant ainsi, le personnage change bien d'apparence, gagne les dons, les points de compétences et de stats, mais refuse d'équiper l'une des griffes, la morsures, et la peau de créature, alors que cela fonctionne parfaitement quand j'utilise le don plutôt qu'un objet !

Ça en devient désespérant, alors auriez vous une idée pour m'aider ?
Peux-tu être plus clair quand au refus du personnage ? :)
Citation :
Publié par Lv4
Peux-tu être plus clair quand au refus du personnage ?
C'était une tournure de phrase, en fait, c'est juste que l'équipement ne s'équipe pas est reste dans l'inventaire, quand bien même j'use de la fonction ActionEquipItem().
Je ne comprend pas du tout pourquoi en usant d'un objet qui appel la fonction ça ne marche pas, alors que via le don ça fonctionne parfaitement.
As-tu essayé d'assigner l'action au personnage spécifiquement ?
Code PHP:

AssignCommand(oCreatureActionEquipItem(oBiteINVENTORY_SLOT_CWEAPON_B)); 

Malheureusement je ne connais pas bien ces emplacements d'inventaire, il doit y avoir des spécificités que je ne connais pas. As-tu trouvé des exemples de script utilisant ces constantes sur le net ?
De mémoire, j'avais essayé cette fonction ainsi que toutes les variantes liées aux actions. Et ça n'avait rien donner, mais dans le doute je vais essayer tout de même.

Pour les emplacements d'inventaires, ils sont bien existant pour toutes les créatures (pas de différentiations entre PJ et PNJ/Monstres), ils ne sont juste pas apparent dans l'UI de l'inventaire sur le jeu.
J'avoue, je n'ai pas regardé si ces emplacements avaient déjà été utilisés sur d'autres scripts, les constantes existent bien dans l'éditeur, et les Créatures ont bien les emplacements de disponibles.

Edit: Bon et bien merci Lv4, ça fonctionne avec AssignCommand(). Finalement je ne l'avais pas testé.
Je vais pouvoir passer à l'étape suivante.
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés