La Bibliothèque de Neverwinter Nights
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
La date/heure actuelle est 21/09/2024 10:55:26


  Page 1 sur 1 ¤

Voir le sujet précédent ¤ Voir le sujet suivant 
Auteur Message
Kétil Dimzad
Ecuyer
Inscrit le: 10 Oct 2003
Messages: 62
Localisation: Fijj'Bool City
Répondre en citant
Posté le : 21/04/2004 22:58:45 Sujet du message : Système de casse ( venant du vault )

Voilà j'ai choppé ce système de casse qui me semble bien :

http://nwvault.ign.com/Files/script...228128000.shtml

Rapido comment il fonctionne :

Les armes et autres items ont des pts de vies, ces pts sont fonctions du type de l'item et de ses propriétés magiques ( paramétrable dans la biblio )

Quand une arme frappe, elle perd un pt de vie
A chaque fin de round de combat ( théoriquement car voir plus bas ) un slot équipé autre qu'une arme est tiré au hasard et perd un pt de vie.

Il y a un jet de dé ( 3 chances sur 100 ) pour voir si un dégat extraordinaire à lieu ( 1 ou 2 d20 je sais plus )

Voilà, quand l'arme arrive à 0 ou moins de pts de vie, elle se brise.

Ca me semble pas mal comme système, on peut imaginer des forgerons pouvant réparer des armes avec ce système.

Petit problème, les pts de vies sont stockés sur l'arme via une variable locale donc une déco reco remet l'arme à neuf.
Mais j'pense ( je m'y connais pas trop en BDD mébon ) que les fonctions de campagne peuvent pallier à ça.

Côté technique :
-------------------
Une biblio de fonctions.

3 scripts à modifier dans les scripts de base :
nw_c2_default6
nw_c2_default3
nw_c2_default7

défault 6 et 7 gèrent les casses des armes et les flèches qui peuvent éventuellement se retrouver sur les corps des NPC tués en combat.

le défault 3 gère les armures et les items dans les slots.
C'est là que le bas blesse, ça ne marche pas pour le défault3...

je vous donne la fonction à mettre dans ce script :

NWScript :

#include "aa_itembreak_inc"

    // Recommended to add just before the following line
    // if (GetSpawnInCondition(NW_FLAG_E ND_COMBAT_ROUND_EVENT))

    // Do Armor/Item Breakage
    DoArmorItemBreakage(OBJECT_SELF, oTarget);
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.


oTarget n'est pas déclaré, et je ne sais vraiment pas comment le déclarer.....

J'ai essayé pas mal de trucs, GetLastDamager, GetLastHostileActor... rien ne fonctionne en test....

Pourtant ce script me semble bien...


Voilà, moralité, la casse des armes fonctionne à merveille mais pas le reste, et c'est bien dommage.

Si quelqu'un a une idée... Moi j'en ai plus là, je recommencerai à chercher demain

A+
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Numéro ICQ Ignorer l'utilisateur
 
lendraste
Grand Maître Chanteur du Conseil
Inscrit le: 20 Fév 2003
Messages: 1403
Localisation: Quelque part ailleurs
Répondre en citant
Posté le : 22/04/2004 06:49:34 Sujet du message :

Voici le lien correct vers le Vault : Functions for Weapon/Armor/Item Breakage
Tâche de faire attention à ton lien la prochaine fois. Smile

J'ai regardé la fonction DoArmorItemBreakage de l'auteur du script, et il se trouve que ce dernier a raté son coup. Le paramètre oTarget n'est pas utilisé dans le corps de la fonction. autrement dit, dans nw_c2_default3, il suffit d'ajouter cette déclaration suivante, juste avant l'appel à DoArmorItemBreakage :
NWScript :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.


C'est un peu stupide, mais ça t'évite de changer la bibliothèque de script de l'auteur qui ajoutera peut-être un correctif ou une amélioration plus tard.
_________________
Lendraste de Loreval
Qui cherche la Vérité cherche celui qui la détient, car elle n'existe pas à l'état naturel.
La cité des mensonges - 1
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé MSN Messenger Numéro ICQ Ignorer l'utilisateur
 
Kétil Dimzad
Ecuyer
Inscrit le: 10 Oct 2003
Messages: 62
Localisation: Fijj'Bool City
Répondre en citant
Posté le : 22/04/2004 15:42:10 Sujet du message :

Bon voilà j'y suis enfin arrivé Smile

Lendraste ta soluce marche pas Smile

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 :

NWScript :

//:Confused//////////////////////////////////////////////
//:: BASE INCLUDE FILE FOR WEAPON/ARMOR/ITEM BREAKAGE
//:: aa_itembreak_inc
//:: Copyright (c) 2001 Bioware Corp.
//:Confused/////////////////////////////////////////////
/*
    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);
    }


*/
//:Confused/////////////////////////////////////////////
//:: Created By: Raasta
//:: Created On: 4/3/04
//:: Modifie par Ketil Dimzad, avril 2004
//:Confused/////////////////////////////////////////////

// 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 = TRUE;

// 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 Smile
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);

    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 + 1200;
        else if(iType == ITEM_PROPERTY_DAMAGE_RESISTANCE)                          iMax = iMax + 1200;
        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 + 1200;
        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 + 1200;
        else if(iType == ITEM_PROPERTY_EXTRA_RANGED_DAMAGE_TYPE)                    iMax = iMax + 1200;
        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 + 1500;
        else if(iType == ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE)                        iMax = iMax + 1500;
        else if(iType == ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS)                      iMax = iMax + 1500;
        else if(iType == ITEM_PROPERTY_IMMUNITY_SPECIFIC_SPELL)                    iMax = iMax + 1500;
        else if(iType == ITEM_PROPERTY_IMMUNITY_SPELL_SCHOOL)                      iMax = iMax + 1500;
        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 + 1100;
        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;
}


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 + 120 + (GetItemACValue(oWeapon)*20);
    else if(iWeapon == BASE_ITEM_ARROW)        iMax = iMax + 5000;
    else if(iWeapon == BASE_ITEM_BASTARDSWORD)  iMax = iMax + 2000;
    else if(iWeapon == BASE_ITEM_BATTLEAXE)    iMax = iMax + 2000;
    else if(iWeapon == BASE_ITEM_BELT)          iMax = iMax + 500;
    else if(iWeapon == BASE_ITEM_BOLT)          iMax = iMax + 5000;
    else if(iWeapon == BASE_ITEM_BOOTS)        iMax = iMax + 500;
    else if(iWeapon == BASE_ITEM_BRACER)        iMax = iMax + 2000;
    else if(iWeapon == BASE_ITEM_BULLET)        iMax = iMax + 5000;
    else if(iWeapon == BASE_ITEM_CLOAK)        iMax = iMax + 500;
    else if(iWeapon == BASE_ITEM_CLUB)          iMax = iMax + 1250;
    else if(iWeapon == BASE_ITEM_DAGGER)        iMax = iMax + 1450;
    else if(iWeapon == BASE_ITEM_DART)          iMax = iMax + 1700;
    else if(iWeapon == BASE_ITEM_DIREMACE)      iMax = iMax + 2300;
    else if(iWeapon == BASE_ITEM_DOUBLEAXE)    iMax = iMax + 2300;
    else if(iWeapon == BASE_ITEM_DWARVENWARAXE) iMax = iMax + 2300;
    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 + 2600;
    else if(iWeapon == BASE_ITEM_GREATSWORD)    iMax = iMax + 2600;
    else if(iWeapon == BASE_ITEM_HALBERD)      iMax = iMax + 2200;
    else if(iWeapon == BASE_ITEM_HANDAXE)      iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_HEAVYCROSSBOW) iMax = iMax + 2900;
    else if(iWeapon == BASE_ITEM_HEAVYFLAIL)    iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_HELMET)        iMax = iMax + 800;
    else if(iWeapon == BASE_ITEM_KAMA)          iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_KATANA)        iMax = iMax + 2100;
    else if(iWeapon == BASE_ITEM_KUKRI)        iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_LARGESHIELD)  iMax = iMax + 650;
    else if(iWeapon == BASE_ITEM_LIGHTCROSSBOW) iMax = iMax + 2200;
    else if(iWeapon == BASE_ITEM_LIGHTFLAIL)    iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_LIGHTHAMMER)  iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_LIGHTMACE)    iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_LONGBOW)      iMax = iMax + 2800;
    else if(iWeapon == BASE_ITEM_LONGSWORD)    iMax = iMax + 2100;
    else if(iWeapon == BASE_ITEM_MORNINGSTAR)  iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_QUARTERSTAFF)  iMax = iMax + 1600;
    else if(iWeapon == BASE_ITEM_RAPIER)        iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_RING)          iMax = iMax + 250;
    else if(iWeapon == BASE_ITEM_SCIMITAR)      iMax = iMax + 1900;
    else if(iWeapon == BASE_ITEM_SCYTHE)        iMax = iMax + 2100;
    else if(iWeapon == BASE_ITEM_SHORTBOW)      iMax = iMax + 2100;
    else if(iWeapon == BASE_ITEM_SHORTSPEAR)    iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_SHORTSWORD)    iMax = iMax + 1800;
    else if(iWeapon == BASE_ITEM_SHURIKEN)      iMax = iMax + 500;
    else if(iWeapon == BASE_ITEM_SICKLE)        iMax = iMax + 2300;
    else if(iWeapon == BASE_ITEM_SLING)        iMax = iMax + 2800;
    else if(iWeapon == BASE_ITEM_SMALLSHIELD)  iMax = iMax + 450;
    else if(iWeapon == BASE_ITEM_THROWINGAXE)  iMax = iMax + 500;
    else if(iWeapon == BASE_ITEM_TOWERSHIELD)  iMax = iMax + 850;
    else if(iWeapon == BASE_ITEM_TWOBLADEDSWORD)iMax = iMax + 2300;
    else if(iWeapon == BASE_ITEM_WARHAMMER)    iMax = iMax + 1900;
    else if(iWeapon == BASE_ITEM_WHIP)          iMax = iMax + 1500;
    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, "*************************");
        DestroyObject(oWeapon);
    }
    else
    {
        if(iExceptional <= 3)    //Changer ici le % de chance d'avoir des degats exceptionnels
        {
            SendMessageToPC(oAttacker, "** PERTE D'INTEGRITE IMPORTANTE : " + GetName(oWeapon) + "**");
            int iDamRoll = d20(1); //Changer ici les degats subit en cas de perte importante
            int iNewTotal = iCurrent - iDamRoll;
            SendMessageToPC(oAttacker, "Perte importante de " + IntToString(iDamRoll) + " pts d'integrite.");
            SetLocalInt(oWeapon, "CUR_HP", iNewTotal);
        }
        else
        {
            int iNewTotal = iCurrent - 1;  //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
void DoArmorBreakageAdvance(object oAttacker, object oWeapon, int iCurrent)
{
    int iExceptional = d100();

    if(iCurrent <= 0)
    {
        SendMessageToPC(oAttacker, "*************************");
        SendMessageToPC(oAttacker, "*** Objet detruit : " + GetName(oWeapon) + " ***");
        SendMessageToPC(oAttacker, "*************************");
        DestroyObject(oWeapon);
    }
    else
    {
        if(iExceptional <= 3)        //Changer ici le % de chance d'avoir des degats exceptionnels
        {
            SendMessageToPC(oAttacker, "** PERTE D'INTEGRITE IMPORTANTE : " + GetName(oWeapon) + "**");
            int iDamRoll = d20(1); //Changer ici les degats subit en cas de perte importante
            int iNewTotal = iCurrent - iDamRoll;
            SendMessageToPC(oAttacker, "Perte importante de " + IntToString(iDamRoll) + " pts d'integrite.");
            SetLocalInt(oWeapon, "CUR_HP", iNewTotal);
        }
        else
        {
            int iNewTotal = iCurrent - 1; //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);

    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);

}

Le code a colorer syntaxiquement est trop long (plus de 10240 caractères) et risque de ne pas s'afficher du tout. Vous pouvez le voir en version colorée ici.


Vala

A+ Smile
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Numéro ICQ Ignorer l'utilisateur
 
Kétil Dimzad
Ecuyer
Inscrit le: 10 Oct 2003
Messages: 62
Localisation: Fijj'Bool City
Répondre en citant
Posté le : 22/04/2004 15:44:37 Sujet du message :

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 Smile
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Numéro ICQ 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 77.97ms