Les animaux eux doivent avoir un ResRef et un Tag similaire.
Enfin, pour tous les animaux j'ai mis comme début de Tag (Et ResRef donc) "ct_dres_" qui signifie Créature dressée. par exemple ct_dres_loup ou ct_dres_chien, etc.
Ok, pour ça, j'avais compris juste après avoir posté ^^
Donc, si je comprend bien, en créant ce script, tu avais pour but qu'on le modifie a notre manière ?
si c'est le cas alors, j'ai créé le mien il permet d'invoquer un chien lorsque tu active le pouvoir spécial d'une laisse de chien, un chat lorsque tu active le pouvoir spécial d'une laisse de chat et un loup lorsque tu active le pouvoir spécial d'une laisse de loup ...
/*----------------------------------------------------------------------------*\
| le script suivant sert a avoir un animal ... |
| attention, c'est un animal de compagnie pas de combat ! |
\*----------------------------------------------------------------------------*/
void main ()
{
if(GetTag(oItem)== "PIERRE_CHIENT")
{
string sAnimal = GetLocalString(oItem,"ct_dres_Chien");
int nActif = GetLocalInt(oItem,"Actif");
int nNth;
if(nActif == 0)
{
for(nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oSuiv = GetHenchman(oPC,nNth);
string sTag = GetTag(oSuiv);
string sLeftTag = GetStringLeft(sTag,8);
if(sLeftTag == "ct_dres_")
{
SendMessageToPC(oPC,
"Vous ne pouvez avoir qu'un animal dressé a la fois");
return;
}
}
location lLoc = GetLocation(oPC);
object oMerc = CreateObject(OBJECT_TYPE_CREATURE, sAnimal, lLoc);
AddHenchman(oPC,oMerc);
SetLocalInt(oItem,"Actif",2);
}
else
if(nActif == 1)
{
for(nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oSuiv = GetHenchman(oPC,nNth);
string sTag = GetTag(oSuiv);
string sLeftTag = GetStringLeft(sTag,8);
if(sLeftTag == "ct_dres_")
{
SendMessageToPC(oPC,
"Vous ne pouvez avoir qu'un animal dressé a la fois");
return;
}
}
location lLoc = GetLocation(oPC);
object oMerc = CreateObject(OBJECT_TYPE_CREATURE, sAnimal, lLoc);
int nMaxHP = GetMaxHitPoints(oMerc);
int nHP = GetLocalInt(oItem,"HP");
effect eEff = EffectDamage(nMaxHP-nHP);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEff, oMerc);
AddHenchman(oPC,oMerc);
SetLocalInt(oItem,"Actif",2);
}
else
if(nActif == 2)
{
for (nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oMerc = GetHenchman(oPC,nNth);
if(GetTag(oMerc) == sAnimal)
{
int nHP = GetCurrentHitPoints(oMerc);
SetLocalInt(oItem,"HP",nHP);
DestroyObject(oMerc);
}
}
SetLocalInt(oItem,"Actif",1);
}
}
if(GetTag(oItem)== "PIERRE_CHAT")
{
string sAnimal = GetLocalString(oItem,"ct_dres_Chat");
int nActif = GetLocalInt(oItem,"Actif");
int nNth;
if(nActif == 0)
{
for(nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oSuiv = GetHenchman(oPC,nNth);
string sTag = GetTag(oSuiv);
string sLeftTag = GetStringLeft(sTag,8);
if(sLeftTag == "ct_dres_")
{
SendMessageToPC(oPC,
"Vous ne pouvez avoir qu'un animal dressé a la fois");
return;
}
}
location lLoc = GetLocation(oPC);
object oMerc = CreateObject(OBJECT_TYPE_CREATURE, sAnimal, lLoc);
AddHenchman(oPC,oMerc);
SetLocalInt(oItem,"Actif",2);
}
else
if(nActif == 1)
{
for(nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oSuiv = GetHenchman(oPC,nNth);
string sTag = GetTag(oSuiv);
string sLeftTag = GetStringLeft(sTag,8);
if(sLeftTag == "ct_dres_")
{
SendMessageToPC(oPC,
"Vous ne pouvez avoir qu'un animal dressé a la fois");
return;
}
}
location lLoc = GetLocation(oPC);
object oMerc = CreateObject(OBJECT_TYPE_CREATURE, sAnimal, lLoc);
int nMaxHP = GetMaxHitPoints(oMerc);
int nHP = GetLocalInt(oItem,"HP");
effect eEff = EffectDamage(nMaxHP-nHP);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEff, oMerc);
AddHenchman(oPC,oMerc);
SetLocalInt(oItem,"Actif",2);
}
else
if(nActif == 2)
{
for (nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oMerc = GetHenchman(oPC,nNth);
if(GetTag(oMerc) == sAnimal)
{
int nHP = GetCurrentHitPoints(oMerc);
SetLocalInt(oItem,"HP",nHP);
DestroyObject(oMerc);
}
}
SetLocalInt(oItem,"Actif",1);
}
}
if(GetTag(oItem)== "PIERRE_LOUP")
{
string sAnimal = GetLocalString(oItem,"ct_dres_loup");
int nActif = GetLocalInt(oItem,"Actif");
int nNth;
if(nActif == 0)
{
for(nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oSuiv = GetHenchman(oPC,nNth);
string sTag = GetTag(oSuiv);
string sLeftTag = GetStringLeft(sTag,8);
if(sLeftTag == "ct_dres_")
{
SendMessageToPC(oPC,
"Vous ne pouvez avoir qu'un animal dressé a la fois");
return;
}
}
location lLoc = GetLocation(oPC);
object oMerc = CreateObject(OBJECT_TYPE_CREATURE, sAnimal, lLoc);
AddHenchman(oPC,oMerc);
SetLocalInt(oItem,"Actif",2);
}
else
if(nActif == 1)
{
for(nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oSuiv = GetHenchman(oPC,nNth);
string sTag = GetTag(oSuiv);
string sLeftTag = GetStringLeft(sTag,8);
if(sLeftTag == "ct_dres_")
{
SendMessageToPC(oPC,
"Vous ne pouvez avoir qu'un animal dressé a la fois");
return;
}
}
location lLoc = GetLocation(oPC);
object oMerc = CreateObject(OBJECT_TYPE_CREATURE, sAnimal, lLoc);
int nMaxHP = GetMaxHitPoints(oMerc);
int nHP = GetLocalInt(oItem,"HP");
effect eEff = EffectDamage(nMaxHP-nHP);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEff, oMerc);
AddHenchman(oPC,oMerc);
SetLocalInt(oItem,"Actif",2);
}
else
if(nActif == 2)
{
for (nNth=1; nNth<=GetMaxHenchmen(); nNth++)
{
object oMerc = GetHenchman(oPC,nNth);
if(GetTag(oMerc) == sAnimal)
{
int nHP = GetCurrentHitPoints(oMerc);
SetLocalInt(oItem,"HP",nHP);
DestroyObject(oMerc);
}
}
SetLocalInt(oItem,"Actif",1);
}
}
je l'ai mis dans le OnActivateItem de mon module ... mais je ne peux pas tester, mon jeu déconne ...
Sachant que j'ai créé les trois laisse et les trois animaux ...