La Bibliothèque de Neverwinter Nights
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
La date/heure actuelle est 17/05/2024 07:42:01


  Page 1 sur 1 ¤

Voir le sujet précédent ¤ Voir le sujet suivant 
Auteur Message
Mars
Seigneur
Inscrit le: 31 Mar 2004
Messages: 199
Répondre en citant
Posté le : 05/08/2004 11:00:35 Sujet du message : 2 scripts a fusionner

Bonjour, voila j'ai deux scripts a mettre dans le OnRespawn de mon module, mais je ne sais pas comment les rassembler. Je vous les post ici , si vous pouvez me les mettre ensemble.

Code :
//******************************
//* On_Player_Resp Valprofond *
//******************************
//* Scripteur: Nek Cheitan *
//******************************
#include "nw_i0_plot"
#include "jfv_includes"

void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = nXPPenalite * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;

int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
nNewXP = nMin;
SetXP(oDead, nNewXP);
WriteTimestampedLogEntry("Nouveaux XP de "+GetName(oDead)+ " :" + IntToString(nNewXP));
StripSpells(oDead);
if(bMalusRez)
{
object oBD = GetItemPossessedBy(oDead, "vpbdperso");
int nMalusRez = GetLocalInt(oBD, "Morts");
WriteTimestampedLogEntry(IntToString(nMalusRez)+ "eme mort de "+GetName(oDead));
effect ePerteConstit = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_CONSTITUTION, nMalusRez));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePerteConstit, oDead);
}
}

void main()
{
object oRespawner = GetLastRespawnButtonPresser();
object oBD = GetItemPossessedBy(oRespawner, "vpbdperso");
location lRespawn = GetLocalLocation(oBD, "Respawn_Loc");
object oCorps = GetLocalObject(oRespawner, "Cadavre");
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
ApplyPenalty(oRespawner);
AssignCommand(oRespawner,JumpToLocation(lRespawn));
DestroyObject(oCorps);
DeleteLocalObject(oRespawner, "Cadavre");
}


Code :
////////////////////////////////////////////////////////
//Script cree par Klemmth
//Script remplacant le OnRespawn du module
//Script permettant d'envoyer le joueur en prison si sa tete est mise a prix
//tout en verifiant que la prison ne soit pas deja pleine
//et en lui attribuant un numero de prisonnier et en lui retirant ses objets
//qui sont places dans un coffre cree expres pour l'occasion
////////////////////////////////////////////////////////

#include "nw_i0_plot"


//Script officiel
void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = 50 * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;

int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
nNewXP = nMin;
SetXP(oDead, nNewXP);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));

}




void main()
{
object oRespawner = GetLastRespawnButtonPresser();
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
//fin script officiel


string sDestTag;
string sArea = GetTag(GetArea(oRespawner));

//on verifie que la prison ne soit pas pleine ( peut etre modifier, mais ca incluerai le changement de pas mal de trucs )
if ( GetLocalInt( GetObjectByTag("vi_Prison" ), "nombre_prisonnier" ) < 10 )
{

//ici on va verifie que le joueur tue est sa tete mise a prix
//et qu'il ai ete tue dans une ville ( j'utilise le prefixe "vi" pour cela, a adapter selon les besoins personnels
//ou qu'il ai ete tue par un joueur ( que ce soit dans une ville ou ailleurs )
if ( ( ( GetSubString( GetTag( GetArea( oRespawner ) ), 0, 2 ) == "vi" ) || ( GetIsPC( GetLastKiller() ) ) ) && ( GetLocalInt( oRespawner, "mise_a_prix" ) > 0 ) )
{
//on attribue la recompense
GiveGoldToCreature( GetLastKiller(), GetLocalInt( oRespawner, "mise_a_prix" ) );

//on donne la duree pendant laquelle le joueur va rester en prison ( peut etre modifier )
SetLocalInt( oRespawner, "peine", ( GetLocalInt( oRespawner, "mise_a_prix" ) / 10 ) + 9 );

//on enleve la mise a prix
SetLocalInt( oRespawner, "mise_a_prix", 0 );

//il y a un prisonnier de plus en prison
SetLocalInt( GetObjectByTag( "vi_Prison" ), "nombre_prisonnier", GetLocalInt( GetObjectByTag( "vi_Prison" ), "nombre_prisonnier" ) + 1 );

//serie de condition permettant de donner un numero de prisonnier libre au joueur
if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre1" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 1 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre1", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre2" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 2 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre2", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre3" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 3 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre3", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre4" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 4 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre4", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre5" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 5 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre5", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre6" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 6 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre6", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre7" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 7 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre7", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre8" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 8 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre8", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre9" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 9 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre9", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre10" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 10 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre10", 1 );
}

//cette partie permet de placer les objets qu'il y a dans l'inventaire du PJ dans un coffre ( blueprint et tag du coffre a modifier si besoin est )
object oItem = GetFirstItemInInventory( oRespawner );
int nStack = 0;
CreateObject( OBJECT_TYPE_PLACEABLE, "coffre_des_affai", GetLocation( GetObjectByTag( "pp_Prison" + IntToString( GetLocalInt( oRespawner, "numero_prisonnier" ) ) ) ), FALSE, "coffre_des_affaires" + IntToString( GetLocalInt( oRespawner, "numero_prisonnier" ) ) );

while( GetIsObjectValid( oItem ) )
{
nStack = GetNumStackedItems( oItem );
CreateItemOnObject( GetResRef( oItem ), GetObjectByTag( "coffre_des_affaires" + IntToString( GetLocalInt( oRespawner, "numero_prisonnier" ) ) ), nStack );
DestroyObject( oItem );
oItem = GetNextItemInInventory( oRespawner );
}
//le joueur respawn en prison
sDestTag = "pp_Prison";
}
}

if (GetIsObjectValid(GetObjectByTag(sDestTag)))
{
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
}


}

_________________
Retour de forums d'aide aux créateurs
===> La communauté d'Aurora
===>Le sanctuaire des Scripts
===>Le salon de la 3D
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
Fantome
Ecuyer
Inscrit le: 06 Nov 2002
Messages: 63
Répondre en citant
Posté le : 05/08/2004 23:15:04 Sujet du message :

Bonsoir,

essaye ainsi, c'est sans aucune garantie car j'ai pas testé et j'ai fais ca vite fait :

NWScript :
#include "nw_i0_plot"
#include "jfv_includes"

void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = nXPPenalite * GetHitDice(oDead);
int nHD = GetHitDice(oDead);
// * You can not lose a level with this respawning
int nMin = ((nHD * (nHD - 1)) / 2) * 1000;

int nNewXP = nXP - nPenalty;
if (nNewXP < nMin)
nNewXP = nMin;
SetXP(oDead, nNewXP);

int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));

WriteTimestampedLogEntry("Nouveaux XP de "+GetName(oDead)+ " :" + IntToString(nNewXP));
StripSpells(oDead);
if(bMalusRez)
{
object oBD = GetItemPossessedBy(oDead, "vpbdperso");
int nMalusRez = GetLocalInt(oBD, "Morts");
WriteTimestampedLogEntry(IntToString(nMalusRez)+ "eme mort de "+GetName(oDead));
effect ePerteConstit = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_CONSTITUTION, nMalusRez));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePerteConstit, oDead);
}
}


void main()
{
object oRespawner = GetLastRespawnButtonPresser();
object oBD = GetItemPossessedBy(oRespawner, "vpbdperso");
location lRespawn = GetLocalLocation(oBD, "Respawn_Loc");
object oCorps = GetLocalObject(oRespawner, "Cadavre");
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
ApplyPenalty(oRespawner);
//AssignCommand(oRespawner,Jum pToLocation(lRespawn));
DestroyObject(oCorps);
DeleteLocalObject(oRespawner, "Cadavre");


string sDestTag;
string sArea = GetTag(GetArea(oRespawner));

//on verifie que la prison ne soit pas pleine ( peut etre modifier, mais ca incluerai le changement de pas mal de trucs )
if ( GetLocalInt( GetObjectByTag("vi_Prison" ), "nombre_prisonnier" ) < 10 )
{

//ici on va verifie que le joueur tue est sa tete mise a prix
//et qu'il ai ete tue dans une ville ( j'utilise le prefixe "vi" pour cela, a adapter selon les besoins personnels
//ou qu'il ai ete tue par un joueur ( que ce soit dans une ville ou ailleurs )
if ( ( ( GetSubString( GetTag( GetArea( oRespawner ) ), 0, 2 ) == "vi" ) || ( GetIsPC( GetLastKiller() ) ) ) && ( GetLocalInt( oRespawner, "mise_a_prix" ) > 0 ) )
{
//on attribue la recompense
GiveGoldToCreature( GetLastKiller(), GetLocalInt( oRespawner, "mise_a_prix" ) );

//on donne la duree pendant laquelle le joueur va rester en prison ( peut etre modifier )
SetLocalInt( oRespawner, "peine", ( GetLocalInt( oRespawner, "mise_a_prix" ) / 10 ) + 9 );

//on enleve la mise a prix
SetLocalInt( oRespawner, "mise_a_prix", 0 );

//il y a un prisonnier de plus en prison
SetLocalInt( GetObjectByTag( "vi_Prison" ), "nombre_prisonnier", GetLocalInt( GetObjectByTag( "vi_Prison" ), "nombre_prisonnier" ) + 1 );

//serie de condition permettant de donner un numero de prisonnier libre au joueur
if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre1" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 1 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre1", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre2" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 2 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre2", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre3" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 3 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre3", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre4" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 4 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre4", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre5" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 5 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre5", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre6" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 6 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre6", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre7" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 7 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre7", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre8" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 8 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre8", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre9" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 9 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre9", 1 );
}

else if ( GetLocalInt( GetObjectByTag( "vi_Prison" ), "libre10" ) == 0 )
{
SetLocalInt( oRespawner, "numero_prisonnier", 10 );
SetLocalInt( GetObjectByTag( "vi_prison" ), "libre10", 1 );
}

//cette partie permet de placer les objets qu'il y a dans l'inventaire du PJ dans un coffre ( blueprint et tag du coffre a modifier si besoin est )
object oItem = GetFirstItemInInventory( oRespawner );
int nStack = 0;
CreateObject( OBJECT_TYPE_PLACEABLE, "coffre_des_affai", GetLocation( GetObjectByTag( "pp_Prison" + IntToString( GetLocalInt( oRespawner, "numero_prisonnier" ) ) ) ), FALSE, "coffre_des_affaires" + IntToString( GetLocalInt( oRespawner, "numero_prisonnier" ) ) );

while( GetIsObjectValid( oItem ) )
{
nStack = GetNumStackedItems( oItem );
CreateItemOnObject( GetResRef( oItem ), GetObjectByTag( "coffre_des_affaires" + IntToString( GetLocalInt( oRespawner, "numero_prisonnier" ) ) ), nStack );
DestroyObject( oItem );
oItem = GetNextItemInInventory( oRespawner );
}
//le joueur respawn en prison
sDestTag = "pp_Prison";
}
}

if (GetIsObjectValid(GetObjectByTag(sDestTag)))
{
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
}


}
Note : le code affiché ci-dessus n'est pas rendu tel qu'il devrait l'être réellement, en particulier des sauts de lignes sont automatiquement insérés pour éviter de casser la mise en page. En le copiant/collant, vous résoudrez ce problème.


a+

ps : le lien vers ton module en construction semble pas fonctioner.
_________________
Arcantia
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
Mars
Seigneur
Inscrit le: 31 Mar 2004
Messages: 199
Répondre en citant
Posté le : 06/08/2004 10:52:10 Sujet du message :

Merci pour le code, je vais tester de suite et je vous donne la réponse.
PS:Merci aussi pour le lien, je vais rectifier ça.

Edit: ça compile, je fais des test se soir pour voir si ça marche.
_________________
Retour de forums d'aide aux créateurs
===> La communauté d'Aurora
===>Le sanctuaire des Scripts
===>Le salon de la 3D
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
Childéric
The Warmaster
Inscrit le: 27 Oct 2003
Messages: 5958
Répondre en citant
Posté le : 06/08/2004 11:50:21 Sujet du message :

Note : Fantôme, les bannières de 105 ko sont prohibées, fait moi le plaisir de la virer. Merci de ta compréhension. Wink

[Edit de Lendraste : vas-y molo gars. Les règles de modération ne sont pas faites pour ton plaisir, pas plus que pour celui des modérateurs dont tu ne fais pas parti. Un "s'il te plaît" aurait été de circonstance, ainsi que l'adresse du règlement, ou alors laisser faire un modérateur. Par ailleurs, je l'avais déjà averti par MP. Merci d'éviter ce genre d'intervention à l'avenir.]
_________________
"If the revolution ain't gon' be televised
Then fuck, I'll probably miss it"
- Aesop Rock

Last.fm | RYM | XKCD c'est bon, mangez-en !
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé MSN Messenger Ignorer l'utilisateur
 
Fantome
Ecuyer
Inscrit le: 06 Nov 2002
Messages: 63
Répondre en citant
Posté le : 06/08/2004 12:53:04 Sujet du message :

(Aparté : ok pas de pb, voilà c'est ôté. Dans le profil il y a aucune mention sur la taille limite de la signature (en dehors du nombre de caractère). quelle est la taille limite (en ko)?
merci.
a+)
_________________
Arcantia
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
kiky.le.magnifique
Homme très gay
Inscrit le: 19 Sep 2003
Messages: 907
Localisation: Camping de la nation martienne...
Répondre en citant
Posté le : 06/08/2004 13:04:33 Sujet du message :


Le reglement, ici a écrit :
la taille maximale d'une image est 200 pixels (px) de largeur par 55px de hauteur. Le poids de l'image - à comprendre sa taille en Kilo-octets (Ko) - est fonction de son type : les "jpg" peuvent faire 8Ko grand max, les "png" 6ko et les "gif" 5 ko.

_________________
http://perso.wanadoo.fr/kikitor | Deviant Art | www.VistaEntraide.com | CCLLSELFV! | D-lire_K | Viendez rêver au Pays des fées... | Ne taquinez pas l'admin!
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Visiter le site web du posteur Ignorer l'utilisateur
 
Montrer les messages depuis :
Page 1 sur 1 ¤


Vous ne pouvez pas poster de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas voter dans les sondages de ce forum


Sauter vers:
FAQ | Rechercher | Liste des Membres | Groupes d'utilisateurs | S'enregistrer | Profil | Se connecter pour vérifier ses messages privés | Connexion
Powered by phpBB 2.* [m] © 2001, 2002 phpBB Group
Theme rewritten in beautiful XHTML code by Baldurien.
Thème "La Bibliothèque de Neverwinter" crée par Kruger
Traduction par : phpBB-fr.com
Page generated in 50.287ms