|
Bon voilà j'y suis enfin arrivé
Je vais pas rentrer dans les détails je laisse juste l'include qui contient tout ce qu'il faut si ça interresse quelqu'un.
Pour une persistance des degats sur le matos faudra que quelqu'un s'y colle moi j'en ai pas besoin. [ EDIT : avec la 1.62 la persistance des dégats est assurée sans BDD ]
Petit détail qui peut avoir son importance, si un joueur s'amuse à courir en évitant les monstres, si ya bcp de monstres et si le joueur court longtemps ( entendez par là une minute ) Ca lag sévère et j'ai testé en solo et pas sur le net donc voilà quoi...
[EDIT : Après tests, c'est kifkif avec ou sans ces scripts, c'est le fait que plusieurs créatures courent derrière le joueur qui fait le plus lagger que les scripts d'usure, enfin a priori... ]
//:://///////////////////////////////////////////// //:: BASE INCLUDE FILE FOR WEAPON/ARMOR/ITEM BREAKAGE //:: aa_itembreak_inc //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* This is a base include file to be used to add in some basic item breakage. This is not been heavily tested, but from the testing done this works fine.
SET UP: ========================================== Modify the following scripts and make sure the variables are all defined (all functions have base definitions to make it simpler to integrate:
------------------------------------------------------ nw_c2_default6: ------------------------------------------------------
#include "aa_itembreak_inc"
object oTarget = GetAttackTarget(); object oDamager = GetLastDamager(); object oWeapon = GetLastWeaponUsed(oDamager);
// Recommended to add just before the following line // if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
// Begin Weapon Breakage / Ammo Return if(GetIsObjectValid(oWeapon) == TRUE) { DoWeaponBreakage(oDamager, oTarget, oWeapon); }
------------------------------------------------------ nw_c2_default3: ------------------------------------------------------
#include "aa_itembreak_inc"
// Recommended to add just before the following line // if (GetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT))
// Do Armor/Item Breakage object oAttacker = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN); DoArmorItemBreakage(oAttacker,OBJECT_SELF);
------------------------------------------------------ nw_c2_default7: ------------------------------------------------------
#include "aa_itembreak_inc"
object oKiller = GetLastKiller(); object oWeapon = GetLastWeaponUsed(oKiller);
// Recommended to add towards the top of this script.
// Begin Weapon Breakage / Ammo Return if(GetIsObjectValid(oWeapon) == TRUE) { DoWeaponBreakage(oKiller, OBJECT_SELF, oWeapon); }
*/ //::////////////////////////////////////////////// //:: Created By: Raasta //:: Created On: 4/3/04 //:: Modifie par Ketil Dimzad, avril 2004 //:://////////////////////////////////////////////
// DEBUG MODE - TRUE is ON / FALSE if OFF // Set this to FALSE to not see the debug info // Set this to TRUE to see all debug info // (Default = TRUE) int DEBUGME = FALSE;
// void DoCheckMissleReturn(object oAttacker, object oTarget, object oWeapon); // ================================================================ // This funtion Checks to see if the weapon (oWeapon) being used by (oAttacker) // is a valid ranged weapon on (oTarget). If so then it rolls a base chance and // creates a duplicate of the missle on the target. So on death there is a chance // of recovering your missle weapons. void DoCheckMissleReturn(object oAttacker, object oTarget, object oWeapon);
// int GetIsWeaponAmmoReturnable(object oWeapon); // ================================================================ // This function returns TRUE if the weapon is ranged // and returns FALSE if it is not. int GetIsWeaponAmmoReturnable(object oWeapon);
// int DoGetMagicItemBonus(object oWeapon); // ================================================================ // This function is used with the DoSetItemMax function to determine // the ItemMax HitPoints. This is set through a loop that will determine // all the magic properties and add them up to get a total. The iMax + // values can be changed to suit your taste. int DoGetMagicItemBonus(object oWeapon);
// int DoGetBaseItemBonus(object oWeapon); // ================================================================ // This function is used with the DoSetItemMax function to determine // the ItemMax HitPoints. This is will determine the base item type // and set the base hit points for that item. The iMax + values can // be changed to suit your taste. int DoGetBaseItemBonus(object oWeapon);
// void DoSetItemMax(object oWeapon, object oPC); // ================================================================ // This function will get the base item type (base hit points) and // then check to see if there are magic item properties on it if so // it will add all these up to get the ItemMax Hit Points. This is // a variable stored on the item itsself. void DoSetItemMax(object oWeapon, object oPC);
// void DoWeaponBreakageAdvance(object oAttacker, object oWeapon, int iCurrent); // ================================================================ // This function will advance the damage on an item (subtract hit points) // from the MaxHit Points of an item damaged. Note, there is a 3% chance // that damage done to an item can be 'exceptional'. Exceptional damage // will do 2d20 points of damage. void DoWeaponBreakageAdvance(object oAttacker, object oWeapon, int iCurrent);
// void DoArmorBreakageAdvance(object oAttacker, object oWeapon, int iCurrent); // ================================================================ // Cette fonction fonctionne de la meme maniere que celle pour les armes. // Ca permet juste d'avoir un parametrage different pour les armures et items // equipes comme ils sont touches moins souvent avec ce systeme que les armes. // N'ayant pas tout compris a la fonction c'est le mieux que je puisse faire :) void DoArmorBreakageAdvance(object oAttacker, object oWeapon, int iCurrent);
// void DoWeaponBreakage(object oAttacker, object oTarget, object oWeapon); // ================================================================ // This is the base function that will check if an item is valid and if it // has a set MaxHit Points. If not then it will create a new MaxHit point // value and do calculations against the weapon. void DoWeaponBreakage(object oAttacker, object oTarget, object oWeapon);
// void DoArmorItemBreakage(object oAttacker, object oTarget); // ================================================================ // This is the base function that will check if an item is valid and if it // has a set MaxHit Points. If not then it will create a new MaxHit point // value and do calculations against the armor or worn item (this includes // all worn item slots). void DoArmorItemBreakage(object oAttacker, object oTarget);
//////////////////////////////////////////////////////////////////////////// // FUNCTIONS ////////////////////////////////////////////////////////////////////////////
void DoCheckMissleReturn(object oAttacker, object oTarget, object oWeapon) { int iWeapon = GetBaseItemType(oWeapon); int iRandRoll = d20(); int iRandBreak = d100();
switch(iWeapon) { case BASE_ITEM_DART: if(iRandBreak >= 5) { string sAmmoResRef = GetResRef(oWeapon); CreateItemOnObject(sAmmoResRef, oTarget, 1); } break; case BASE_ITEM_HEAVYCROSSBOW: if(iRandBreak <= 12) { object oAmmo = GetItemInSlot(INVENTORY_SLOT_BOLTS, oAttacker); if(GetIsObjectValid(oAmmo) == TRUE) { string sAmmoResRef = GetResRef(oAmmo); CreateItemOnObject(sAmmoResRef, oTarget, 1); } } break; case BASE_ITEM_LIGHTCROSSBOW: if(iRandBreak <= 12) { object oAmmo = GetItemInSlot(INVENTORY_SLOT_BOLTS, oAttacker); if(GetIsObjectValid(oAmmo) == TRUE) { string sAmmoResRef = GetResRef(oAmmo); CreateItemOnObject(sAmmoResRef, oTarget, 1); } } break; case BASE_ITEM_LONGBOW: if(iRandBreak <= 12) { object oAmmo = GetItemInSlot(INVENTORY_SLOT_ARROWS, oAttacker); if(GetIsObjectValid(oAmmo) == TRUE) { string sAmmoResRef = GetResRef(oAmmo); CreateItemOnObject(sAmmoResRef, oTarget, 1); } } break; case BASE_ITEM_SHORTBOW: if(iRandBreak <= 12) { object oAmmo = GetItemInSlot(INVENTORY_SLOT_ARROWS, oAttacker); if(GetIsObjectValid(oAmmo) == TRUE) { string sAmmoResRef = GetResRef(oAmmo); CreateItemOnObject(sAmmoResRef, oTarget, 1); } } break; case BASE_ITEM_SHURIKEN: if(iRandBreak >= 5) { string sAmmoResRef = GetResRef(oWeapon); CreateItemOnObject(sAmmoResRef, oTarget, 1); } break; case BASE_ITEM_SLING: if(iRandBreak <= 12) { object oAmmo = GetItemInSlot(INVENTORY_SLOT_BULLETS, oAttacker); if(GetIsObjectValid(oAmmo) == TRUE) { string sAmmoResRef = GetResRef(oAmmo); CreateItemOnObject(sAmmoResRef, oTarget, 1); } } break; case BASE_ITEM_THROWINGAXE: if(iRandBreak >= 5) { string sAmmoResRef = GetResRef(oWeapon); CreateItemOnObject(sAmmoResRef, oTarget, 1); } break; default: break; } }
int GetIsWeaponAmmoReturnable(object oWeapon) { int iReturn; int iWeapon = GetBaseItemType(oWeapon);
if( iWeapon == BASE_ITEM_DART || iWeapon == BASE_ITEM_HEAVYCROSSBOW || iWeapon == BASE_ITEM_LIGHTCROSSBOW || iWeapon == BASE_ITEM_LONGBOW || iWeapon == BASE_ITEM_SHORTBOW || iWeapon == BASE_ITEM_SHURIKEN || iWeapon == BASE_ITEM_SLING || iWeapon == BASE_ITEM_THROWINGAXE) iReturn = TRUE; else iReturn = FALSE;
return iReturn; }
int DoGetMagicItemBonus(object oWeapon) { int iMax = 1; itemproperty ipLoop = GetFirstItemProperty(oWeapon);
//Bon alors dans cette boucle on défini la valeur en hp qu'apporte les propriétés des items. //Donc un item magique est plus résistant qu'un item non magique. while (GetIsItemPropertyValid(ipLoop)) { int iType = GetItemPropertyType(ipLoop);
if(iType == ITEM_PROPERTY_ABILITY_BONUS) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_AC_BONUS) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_AC_BONUS_VS_ALIGNMENT_GROUP) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_AC_BONUS_VS_DAMAGE_TYPE) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_AC_BONUS_VS_RACIAL_GROUP) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_AC_BONUS_VS_SPECIFIC_ALIGNMENT) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_ARCANE_SPELL_FAILURE) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_ATTACK_BONUS) iMax = iMax + 750; else if(iType == ITEM_PROPERTY_ATTACK_BONUS_VS_ALIGNMENT_GROUP) iMax = iMax + 450; else if(iType == ITEM_PROPERTY_ATTACK_BONUS_VS_RACIAL_GROUP) iMax = iMax + 250; else if(iType == ITEM_PROPERTY_ATTACK_BONUS_VS_SPECIFIC_ALIGNMENT) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_BASE_ITEM_WEIGHT_REDUCTION) iMax = iMax + 100; else if(iType == ITEM_PROPERTY_BONUS_FEAT) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N) iMax = iMax + 400; else if(iType == ITEM_PROPERTY_CAST_SPELL) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_DAMAGE_BONUS) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP) iMax = iMax + 700; else if(iType == ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP) iMax = iMax + 700; else if(iType == ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_DAMAGE_REDUCTION) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_DAMAGE_RESISTANCE) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_DAMAGE_VULNERABILITY) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DARKVISION) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_DECREASED_ABILITY_SCORE) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_AC) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_DAMAGE) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_ENHANCEMENT_MODIFIER) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_SAVING_THROWS) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_SAVING_THROWS_SPECIFIC) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_DECREASED_SKILL_MODIFIER) iMax = iMax + 1; else if(iType == ITEM_PROPERTY_ENHANCED_CONTAINER_REDUCED_WEIGHT) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_ENHANCEMENT_BONUS) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_ALIGNMENT_GROUP) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_RACIAL_GROUP) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_ENHANCEMENT_BONUS_VS_SPECIFIC_ALIGNEMENT) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_EXTRA_MELEE_DAMAGE_TYPE) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_EXTRA_RANGED_DAMAGE_TYPE) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_FREEDOM_OF_MOVEMENT) iMax = iMax + 900; else if(iType == ITEM_PROPERTY_HASTE) iMax = iMax + 900; else if(iType == ITEM_PROPERTY_HOLY_AVENGER) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL) iMax = iMax + 900; else if(iType == ITEM_PROPERTY_IMPROVED_EVASION) iMax = iMax + 1200; else if(iType == ITEM_PROPERTY_KEEN) iMax = iMax + 1200; else if(iType == ITEM_PROPERTY_LIGHT) iMax = iMax + 100; else if(iType == ITEM_PROPERTY_MASSIVE_CRITICALS) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_MIGHTY) iMax = iMax + 600; else if(iType == ITEM_PROPERTY_MIND_BLANK) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_ON_HIT_PROPERTIES) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_ON_MONSTER_HIT) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_ONHITCASTSPELL) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_POISON) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_REGENERATION) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_REGENERATION_VAMPIRIC) iMax = iMax + 900; else if(iType == ITEM_PROPERTY_SAVING_THROW_BONUS) iMax = iMax + 600; else if(iType == ITEM_PROPERTY_SAVING_THROW_BONUS_SPECIFIC) iMax = iMax + 600; else if(iType == ITEM_PROPERTY_SKILL_BONUS) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_SPELL_RESISTANCE) iMax = iMax + 1000; else if(iType == ITEM_PROPERTY_TRUE_SEEING) iMax = iMax + 500; else if(iType == ITEM_PROPERTY_TURN_RESISTANCE) iMax = iMax + 600; else if(iType == ITEM_PROPERTY_UNLIMITED_AMMUNITION) iMax = iMax + 800; else if(iType == ITEM_PROPERTY_USE_LIMITATION_ALIGNMENT_GROUP) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_USE_LIMITATION_CLASS) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_USE_LIMITATION_RACIAL_TYPE) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_USE_LIMITATION_SPECIFIC_ALIGNMENT) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_USE_LIMITATION_TILESET) iMax = iMax + 300; else if(iType == ITEM_PROPERTY_VISUALEFFECT) iMax = iMax + 100; else if(iType == ITEM_PROPERTY_WEIGHT_INCREASE) iMax = iMax + 10;
ipLoop = GetNextItemProperty(oWeapon); }
return iMax; }
//Ici on modifie la valeur en hp de l'item de base
int DoGetBaseItemBonus(object oWeapon) { int iMax = 1; int iWeapon = GetBaseItemType(oWeapon);
if(iWeapon == BASE_ITEM_AMULET) iMax = iMax + 500; else if(iWeapon == BASE_ITEM_ARMOR) iMax = iMax + 500 + (GetItemACValue(oWeapon)*50); else if(iWeapon == BASE_ITEM_ARROW) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_BASTARDSWORD) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_BATTLEAXE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_BELT) iMax = iMax + 500; else if(iWeapon == BASE_ITEM_BOLT) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_BOOTS) iMax = iMax + 500; else if(iWeapon == BASE_ITEM_BRACER) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_BULLET) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_CLOAK) iMax = iMax + 500; else if(iWeapon == BASE_ITEM_CLUB) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_DAGGER) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_DART) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_DIREMACE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_DOUBLEAXE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_DWARVENWARAXE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_GLOVES) iMax = iMax + 500; else if(iWeapon == BASE_ITEM_GOLD) iMax = iMax + 99999; else if(iWeapon == BASE_ITEM_GREATAXE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_GREATSWORD) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_HALBERD) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_HANDAXE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_HEAVYCROSSBOW) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_HEAVYFLAIL) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_HELMET) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_KAMA) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_KATANA) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_KUKRI) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_LARGESHIELD) iMax = iMax + 650; else if(iWeapon == BASE_ITEM_LIGHTCROSSBOW) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_LIGHTFLAIL) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_LIGHTHAMMER) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_LIGHTMACE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_LONGBOW) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_LONGSWORD) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_MORNINGSTAR) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_QUARTERSTAFF) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_RAPIER) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_RING) iMax = iMax + 250; else if(iWeapon == BASE_ITEM_SCIMITAR) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SCYTHE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SHORTBOW) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SHORTSPEAR) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SHORTSWORD) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SHURIKEN) iMax = iMax + 500; else if(iWeapon == BASE_ITEM_SICKLE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SLING) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_SMALLSHIELD) iMax = iMax + 450; else if(iWeapon == BASE_ITEM_THROWINGAXE) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_TOWERSHIELD) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_TWOBLADEDSWORD)iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_WARHAMMER) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_WHIP) iMax = iMax + 1000; else if(iWeapon == BASE_ITEM_INVALID) iMax = 100000; else iMax = 500;
return iMax; }
void DoSetItemMax(object oWeapon, object oPC) { int iMax = 1; int iISPlotItem = GetPlotFlag(oWeapon); int iTypeBonus = DoGetBaseItemBonus(oWeapon); int iMagicBonus = DoGetMagicItemBonus(oWeapon);
if(iISPlotItem == TRUE) iMax = iMax + 2000000;
int iTotal = iMax + iMagicBonus + iTypeBonus;
if(DEBUGME == TRUE) { SendMessageToPC(oPC, "SETTING NEW ITEM HP "); SendMessageToPC(oPC, "======================="); SendMessageToPC(oPC, "BASE BONUS = " + IntToString(iTypeBonus)); SendMessageToPC(oPC, "MAGIC BONUS = " + IntToString(iMagicBonus)); SendMessageToPC(oPC, "TOTAL BONUS = " + IntToString(iTotal)); SendMessageToPC(oPC, "======================="); }
SetLocalInt(oWeapon, "MAX_HP", iTotal); SetLocalInt(oWeapon, "CUR_HP", iTotal); SetLocalInt(oWeapon, "ITEM_SET", TRUE); }
void DoWeaponBreakageAdvance(object oAttacker, object oWeapon, int iCurrent) { int iExceptional = d100();
if(iCurrent <= 0) { SendMessageToPC(oAttacker, "*************************"); SendMessageToPC(oAttacker, "*** Objet detruit : " + GetName(oWeapon) + " ***"); SendMessageToPC(oAttacker, "*************************"); //PlayVoiceChat(VOICE_CHAT_BORED,oAttacker); /*la ligne PlayVOiceChat a été commenté parce que très chiante à force mais on peut apprécier... */ FloatingTextStringOnCreature("*** Objet detruit : " + GetName(oWeapon) + " ***",oAttacker); DestroyObject(oWeapon); } else { if(iExceptional <= 5) //Changer ici le % de chance d'avoir des degats exceptionnels { SendMessageToPC(oAttacker, "** PERTE D'INTEGRITE IMPORTANTE : " + GetName(oWeapon) + "**"); int iDamRoll = d10(3); //Changer ici les degats subit en cas de perte importante int iNewTotal = iCurrent - iDamRoll; SendMessageToPC(oAttacker, "Perte importante de " + IntToString(iDamRoll) + " pts d'integrite."); //PlayVoiceChat(VOICE_CHAT_BORED,oAttacker); FloatingTextStringOnCreature("Votre " + GetName(oWeapon) + " est endommagé par le combat.",oAttacker); SetLocalInt(oWeapon, "CUR_HP", iNewTotal); } else { int iNewTotal = iCurrent - 5; //Changer ici le nb de pts de degats classiques SetLocalInt(oWeapon, "CUR_HP", iNewTotal); }
if(DEBUGME == TRUE) { int iCURitemHP = GetLocalInt(oWeapon, "CUR_HP"); SendMessageToPC(oAttacker, "SETTING NEW HP "); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "NEW TOTAL = " + IntToString(iCURitemHP)); SendMessageToPC(oAttacker, "======================="); } } } //DoArmorBreakageAdvance RAJOUTEE PAR MOI MEME, pour parametrer differement des armes //Fonctionne désormais beaucoup mieux et marche sur tous les items équipés. void DoArmorBreakageAdvance(object oAttacker, object oWeapon, int iCurrent) { int iExceptional = d100();
if(iCurrent <= 0) { SendMessageToPC(oAttacker, "*************************"); SendMessageToPC(oAttacker, "*** Objet detruit : " + GetName(oWeapon) + " ***"); SendMessageToPC(oAttacker, "*************************"); //PlayVoiceChat(VOICE_CHAT_BORED,oAttacker); FloatingTextStringOnCreature("*** Objet detruit : " + GetName(oWeapon) + " ***",oAttacker); DestroyObject(oWeapon); } else { if(iExceptional <= 5) //Changer ici le % de chance d'avoir des degats exceptionnels { SendMessageToPC(oAttacker, "** PERTE D'INTEGRITE IMPORTANTE : " + GetName(oWeapon) + "**"); int iDamRoll = d10(3); //Changer ici les degats subit en cas de perte importante int iNewTotal = iCurrent - iDamRoll; SendMessageToPC(oAttacker, "Perte importante de " + IntToString(iDamRoll) + " pts d'integrite."); //PlayVoiceChat(VOICE_CHAT_BORED,oAttacker); FloatingTextStringOnCreature("Votre " + GetName(oWeapon) + " est endommagé par le combat.",oAttacker); SetLocalInt(oWeapon, "CUR_HP", iNewTotal); } else { int iNewTotal = iCurrent - 5; //Changer ici le nb de pts de degats classique SetLocalInt(oWeapon, "CUR_HP", iNewTotal); }
if(DEBUGME == TRUE) { int iCURitemHP = GetLocalInt(oWeapon, "CUR_HP"); SendMessageToPC(oAttacker, "SETTING NEW HP "); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "NEW TOTAL = " + IntToString(iCURitemHP)); SendMessageToPC(oAttacker, "======================="); } } } //------------------------FONCTION AJOUTEE
void DoWeaponBreakage(object oAttacker, object oTarget, object oWeapon) { int iIsValid = GetIsWeaponAmmoReturnable(oWeapon); int iMAXitemHP = GetLocalInt(oWeapon, "MAX_HP"); int iISitemSET = GetLocalInt(oWeapon, "ITEM_SET");
if(DEBUGME == TRUE) { SendMessageToPC(oAttacker, "HP SETTINGS"); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "MAX TOTAL = " + IntToString(iMAXitemHP)); SendMessageToPC(oAttacker, "ITEM SETUP = " + IntToString(iISitemSET)); SendMessageToPC(oAttacker, "======================="); }
if(iIsValid == TRUE) { if(iISitemSET == FALSE) { DoSetItemMax(oWeapon, oAttacker);
if(DEBUGME == TRUE) { int iCURitemHP = GetLocalInt(oWeapon, "CUR_HP"); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "MAX TOTAL = " + IntToString(iMAXitemHP)); SendMessageToPC(oAttacker, "CUR TOTAL = " + IntToString(iCURitemHP)); SendMessageToPC(oAttacker, "======================="); } } else { int iCURitemHP = GetLocalInt(oWeapon, "CUR_HP"); DoCheckMissleReturn(oAttacker, oTarget, oWeapon); DoWeaponBreakageAdvance(oAttacker, oWeapon, iCURitemHP); } } else { if(iISitemSET == FALSE) { DoSetItemMax(oWeapon, oAttacker); } else { int iCURitemHP = GetLocalInt(oWeapon, "CUR_HP"); DoWeaponBreakageAdvance(oAttacker, oWeapon, iCURitemHP);
if(DEBUGME == TRUE) { int iCURitemHP = GetLocalInt(oWeapon, "CUR_HP"); SendMessageToPC(oAttacker, "ITEM = " + GetName(oWeapon)); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "CUR TOTAL = " + IntToString(iCURitemHP)); SendMessageToPC(oAttacker, "======================="); } } } }
void DoArmorItemBreakage(object oAttacker, object oTarget) { int iBeenDamaged = GetLocalInt(oAttacker, "LAST_HP"); int iCurrent = GetCurrentHitPoints(oAttacker);
//En commentant les lignes ci-dessous, la fonction marche bien mieux. //if(iCurrent < iBeenDamaged) //Je capte pas trop ce que ca veut dire, souvent le script //{ //S'arrete la, ce qui diminue les degats sur les armures/items int nSlot = Random(17);
object oItem=GetItemInSlot(nSlot, oAttacker); //Si nSlot n'est pas equipe, le script s'arrete, donc c'est au builder de voir : //Ca parait logique de pouvoir taper sur un endroit ou il n'y a pas d'objets et ainsi //ne pas faire de degats aux objets equipes. //MAIS en comparaison des degats recus par les armes c'est de la gnognotte. //D'ou la creation de la fonction DoArmorBreakageAdvance qui permet de parametrer //differemment les degats recu par les objets puisqu'ils sont bcp moins souvent //touches autant leur faire mal quand ils le sont. if (GetIsObjectValid(oItem)) {
int iMAXitemHP = GetLocalInt(oItem, "MAX_HP"); int iISitemSET = GetLocalInt(oItem, "ITEM_SET");
if(iISitemSET == FALSE) { DoSetItemMax(oItem, oAttacker);
if(DEBUGME == TRUE) { int iCURitemHP = GetLocalInt(oItem, "CUR_HP"); SendMessageToPC(oAttacker, "ITEM = " + GetName(oItem)); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "CUR TOTAL = " + IntToString(iCURitemHP)); SendMessageToPC(oAttacker, "======================="); } } else { int iCURitemHP = GetLocalInt(oItem, "CUR_HP"); DoArmorBreakageAdvance(oAttacker, oItem, iCURitemHP);
if(DEBUGME == TRUE) { int iCURitemHP = GetLocalInt(oItem, "CUR_HP"); SendMessageToPC(oAttacker, "ITEM = " + GetName(oItem)); SendMessageToPC(oAttacker, "======================="); SendMessageToPC(oAttacker, "MAX TOTAL = " + IntToString(iMAXitemHP)); SendMessageToPC(oAttacker, "CUR TOTAL = " + IntToString(iCURitemHP)); SendMessageToPC(oAttacker, "======================="); }
}
// } }
// SET PC's HitPoints to CurrentLevel to check at next EOR SetLocalInt(oAttacker, "LAST_HP", iCurrent);
}
Voilà, c'est testé ça fonctionne avec NWN+SoU+HotU v1.61 et au delà à priori, ça peut être pas mal de le rajouter aux persistants
EDIT pour petite maj et rajout de commentaires.
|