La Bibliothèque de Neverwinter Nights
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
La date/heure actuelle est 13/06/2024 17:48:17


  Page 1 sur 1 ¤

Voir le sujet précédent ¤ Voir le sujet suivant 
Auteur Message
N'kälhäash
Novice
Inscrit le: 12 Avr 2003
Messages: 12
Répondre en citant
Posté le : 14/04/2003 01:15:27 Sujet du message : Drop d'item équipé aléatoire d'un pj ...

Bonjour , que rajoutez a ce script pour que le joueur perde , en plus donc de tout son or (et des potions sacrés) , un item équipé (et non pas de l'inventaire) ,choisi aléatoirement (son arme , un anneau etc) .Le perde dans le sac avec l'or , donc récupérable ...
Surprised


Code :
void AnphTransferThings (object oPlayer, object oDest)
{
    string sItemTag;
    object oItem;
    string sResRef;

    oItem = GetFirstItemInInventory (oPlayer);
    while(GetIsObjectValid (oItem))
    {
        sResRef = "";
        sItemTag = GetTag (oItem);

        /* holy fucking stupid, apparently potions
           don't have resrefs? */

        if (sItemTag == "PotionOfCCW")
            sResRef = "potionofcurel004";
        else if (sItemTag == "PotionOfCLW")
            sResRef = "potionofcurel003";
        else if (sItemTag == "PotionOfCMW")
            sResRef = "potionofcurel001";
        else if (sItemTag == "PotionOfCSW")
            sResRef = "potionofcurel002";
        if (sResRef != "" && GetIsObjectValid (oDest))
        {
            DestroyObject (oItem);
            CreateItemOnObject (sResRef, oDest);
        }

        oItem = GetNextItemInInventory (oPlayer);
    }
}

void AnphDropStuff (object oPlayer)
{
    location lDiedHere = GetLocation(oPlayer);
    object oBackpack;
    string sID=GetName(oPlayer)+GetPCPublicCDKey(oPlayer);

    oBackpack=GetLocalObject(oMod,"PlayerBackpack"+sID);
    if(GetIsObjectValid(oBackpack)==FALSE)
    {
        oBackpack = CreateObject (OBJECT_TYPE_PLACEABLE, "playerbackpack", lDiedHere);

        if (!GetIsObjectValid (oBackpack))
        {
            SendMessageToPC (oPlayer, "invalid backpack");
        }
        SetLocalObject(oMod,"PlayerBackpack"+sID, oBackpack);

    }
    int nAmtGold=GetGold(oPlayer);
    int nAmtGold2=GetGold(oPlayer);
    if (nAmtGold != nAmtGold2)
    {
        WriteTimestampedLogEntry ("ERROR: Golds do not match!");
        return;
    }
    WriteTimestampedLogEntry ("Dropping gold from player - " +
                              IntToString (nAmtGold));

    if (nAmtGold2 < nAmtGold)
    {
        nAmtGold = nAmtGold2;
    }

    /* Take all their gold */
    AssignCommand (oPlayer, TakeGoldFromCreature(nAmtGold, oPlayer, TRUE));

    if (nAmtGold > 30000)
    {
        nAmtGold = 30000;
    }

    if (nAmtGold > 0)
    {
        CreateItemOnObject("NW_IT_GOLD001", oBackpack, nAmtGold);
    }

    /* Now, go through and find the gold! */
    object oItem = GetFirstItemInInventory (oBackpack);
    if (!GetIsObjectValid (oItem))
    {
        DestroyObject (oBackpack);
    }

    while (GetIsObjectValid (oItem))
    {
        if (GetTag (oItem) == "NW_IT_GOLD001")
        {
            int nGold;
            nGold = GetNumStackedItems (oItem);
            if (nGold > 30000)
            {
                WriteTimestampedLogEntry ("** ERROR: Amount of gold in dropped bag is - " +
                                          IntToString (nGold));
            }
            if (nGold != nAmtGold)
            {
                WriteTimestampedLogEntry ("** ERROR: Amount of gold dropped does not equal amnt - " +
                                          IntToString (nGold));
            }
        }
        oItem = GetNextItemInInventory (oBackpack);
    }

    AnphTransferThings (oPlayer, oBackpack);
}



Merci Smile
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
N'kälhäash
Novice
Inscrit le: 12 Avr 2003
Messages: 12
Répondre en citant
Posté le : 16/04/2003 19:35:27 Sujet du message :

Up
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé 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 19.776ms