La Bibliothèque de Neverwinter Nights
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
La date/heure actuelle est 20/05/2024 18:22:38


  Page 1 sur 1 ¤

Voir le sujet précédent ¤ Voir le sujet suivant 
Auteur Message
AZAZEL11
Seigneur
Inscrit le: 08 Fév 2006
Messages: 156
Répondre en citant
Posté le : 20/02/2006 01:23:28 Sujet du message : Les post spawn!!!

Bonjour vous tous! Problème problème que j'ai ici. Voilà mon module est à la base un ancien module que j'ai retouché presque tout en entier. Mais voilà que j'ai un problème de scripts auquel je me doutais pas.


Ça s'appele le PostSpawn:

Voici qui selon moi à comme résultat d'éffacer tous mes pnjs d'un coup!!!! J'aimerais savoir et comprendre aussi bien sur que veulent dire les chiffres d'événements *case #xxx* et où je peux voir ces événements dans aurora!!! Et si ce n'est pas ca, alors pourquoi tous mes pnjs disparaissent d'un coup??? C'est un problème majeur!!! J'imagine qu'a la base c'était pour économiser des ressources en faisant disparaitre les pnjs, et tous les pnjs devaient etre en spawn j'imagine....

voilà j'ai trouvé un script et il doit aller dans le Onexit d'une zone. Le problème est que je n'ai jamais mis sur aucunes zones ce script. Alors pourquoi tous les pnjs disparraissent subitement???

La condition du bug: Je dois sortir et entrer dans la zone en question. Mais le plus embêtant, c'est que le bug survient pas sur toutes les zones...pourtant, j'ai rien fait de plus ou de moins entre les zones *ok* et les zones *avec bug*. Alors cela pourrait être dû à quoi selon vous?

NWScript :
// a placer dans le OnExit d'une zone : nettoie les pnjs en, spawn custom et hard mais pas les dmspawn

void clean()
{
    object oArea = GetArea(OBJECT_SELF);
    object oObject = GetFirstObjectInArea(oArea);
    object oItem;
    int iDrop = GetObjectType(oObject);
    string sDrop = GetTag(oObject);


while(GetIsObjectValid(oObject))
{
if ((GetIsEncounterCreature(oObject) == TRUE))
{
DestroyObject(oObject);
}
    if(iDrop == OBJECT_TYPE_PLACEABLE && sDrop == "Bodybag")
    {
    while(GetIsObjectValid(oObject))
    {
    object oInv = GetFirstItemInInventory(oObject);
        while(oInv != OBJECT_INVALID)
        {
        DestroyObject(oInv);
        oInv = GetNextItemInInventory(oObject);
        }
    DestroyObject(oObject);
    }
    }
oObject = GetNextObjectInArea(oArea);
}
}
void main()
{


    if (!(GetTag(GetExitingObject())=="")) {return;} // tag="" => si pas joueur on fait pas
    else
    {
    int iPC = GetLocalInt(OBJECT_SELF, "spc");
            if(iPC > 0) // la zone avait un compteur
            {
                SetLocalInt(OBJECT_SELF, "spc", iPC-1);
                if(iPC > 1) {return;} // si il reste encore des PJs : pas de clean
                else { clean();} // plus de pnj => clean
            }
            else // ancien script
            {
            object oArea = GetArea(OBJECT_SELF);
            object oPC = GetFirstPC();
            int nPCinArea = FALSE;
                while(GetIsObjectValid(oPC) == TRUE && !nPCinArea) // il reste des PJ dans la zone ?
                {
                    if (GetArea(oPC) == oArea)
                    {
                    nPCinArea = TRUE;
                    }
                    oPC = GetNextPC();
                }

                if(!nPCinArea) {clean();}
            }
    }
}
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.

_________________
L'imagination est plus importante que le savoir. (Albert Einstein)
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
marneus
Chevalier
Inscrit le: 17 Oct 2005
Messages: 89
Localisation: devant mon pc ... surment
Répondre en citant
Posté le : 20/02/2006 08:23:00 Sujet du message :

personellement , je n'ai jamai eu de probleme de ce genre ...

et , si tu retire le script , tes pnj reste , ou bien il senvole quant meme?
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
lylver
Héros
Inscrit le: 08 Avr 2005
Messages: 274
Répondre en citant
Posté le : 20/02/2006 15:11:36 Sujet du message :

J'ai déjà rencontré ce problème, il s'agissait non pas d'un soucis avec le script OnEnter OnExit mais provenait du script OnSpawn des créatures.
Ce script relançait une boucle avec un DelayCommand vers lui-même.
Tant que des personnages joueurs étaient perçus/présents, il bouclait, sinon le monstre était nettoyé.
Je le recherche pour te le mettre
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
lylver
Héros
Inscrit le: 08 Avr 2005
Messages: 274
Répondre en citant
Posté le : 20/02/2006 15:26:27 Sujet du message :

NWScript :

// bm_checkpc.nss
void main()
{
  if (GetIsObjectValid ( OBJECT_SELF))
    {
    int bSomePCAround = (GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC)!=OBJECT_INVALID);

    if (!bSomePCAround)
        {
        DestroyObject(OBJECT_SELF);
        }
    else
        {
        DelayCommand(20.0, ExecuteScript("bm_checkpc", OBJECT_SELF));
        }
    }
}
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.


NWScript :

// nw_c2_default9.nss
//:Confused///////////////////////// /////////////////////
//:: Default: On Spawn In
//:: NW_C2_DEFAULT9
//:: Copyright (c) 2001 Bioware Corp.
//:Confused///////////////////////// ////////////////////
/*
    Determines the course of action to be taken
    after having just been spawned in
*/

//:Confused///////////////////////// ////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:Confused///////////////////////// ////////////////////
#include "NW_O2_CONINCLUDE"
#include "NW_I0_GENERIC"


void main()
{
    if (GetIsEncounterCreature())
            DelayCommand(45.0, ExecuteScript("bm_checkpc", OBJECT_SELF));

// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ****************************** ****************************** *****************************
    SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
    WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
                              // 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
                              // 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
                              //    combat.
    GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
}
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.


Voilà le coupable que j'avais dans le module TN Bouchon
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
AZAZEL11
Seigneur
Inscrit le: 08 Fév 2006
Messages: 156
Répondre en citant
Posté le : 20/02/2006 21:23:09 Sujet du message :

Merci pour votre attention très chers scripteurs!! Mais tapper pas, j'ai trouvé un script de zone préfab (portant le meme nom de celui par défaut) qui fait un destroyobject.....


Donc ce n'était pas un bug mais bien un script, en passant qui est formidable coté économie de ressources Very Happy




Alors quand je peux aider les moddeurs, je le fais avec grand plaisir, je met ici le script qui fait un *clear* de la zone quand la zone contient aucuns PJs

À mettre dans le OnUserDefined de la zone:



NWScript :
:Confused//////////////////////////////////////////////
//:: Area Onuserdefined
//:Confused/////////////////////////////////////////////
/*
    Place this script in the area userdefined event

    case 2998: sets skybox depending on weather
              (only while PCs are in the area)

    case 2999: checks how many PCs are in the
              area. (when a PC enters and every 5
              minutes there after, unless the area
              is empty)

    case 3000: wipes the area clean of items,
              creatures, drops, and resets the
              encounters.  (60 seconds after the
              last player leaves the area or when
              case 2999 finds 0 PCs in the area)

    case 3001: Boolean Logic used with 2999

    case 3002: Generic NPC Spawner
                **See below for setup details**

*/
//:Confused/////////////////////////////////////////////
//:: Created By:  Besalope
//:: Created On:  12/19/04
//:Confused/////////////////////////////////////////////

void main()
{
    int nUser=GetUserDefinedEventNumber();
    switch(nUser)
        {
        case 2998:  //This checks the weather type of the area every thirty seconds (but only when players are in the area) and sets the according skybox.
          {
            if(GetLocalInt(OBJECT_SELF,"PCs_In_Area")>= 1)  //this sets the area to only check the weather if there is a player in the area
            {
              int nWeather = GetWeather(OBJECT_SELF);

              switch(nWeather)
              {
                case WEATHER_CLEAR:
                {
                SetSkyBox(SKYBOX_GRASS_CLEAR);
                break;
                }
                case WEATHER_RAIN:
                {
                SetSkyBox(SKYBOX_GRASS_STORM);
                break;
                }
                case WEATHER_SNOW:
                {
                SetSkyBox(SKYBOX_ICY);
                break;
                }
              }
              DelayCommand(180.0f,SignalEvent(OBJECT_SELF,EventUserDefined(2998))); //the delay command sets how often the area is checked while a player is in the area.
            }
            break;
          }

        case 2999: //case 2999 was added to ensure that the number of PCs in the area is as accurate as possible
          {
            SetLocalInt(OBJECT_SELF,"PCs_Found",0);
            object oPC = GetFirstObjectInArea();
            while(GetIsObjectValid(oPC))
                {
                if(GetIsPC(oPC) == TRUE)      //removed DM check v1.28
                  {
                  SetLocalInt(OBJECT_SELF,"PCs_Found",GetLocalInt(OBJECT_SELF,"PCs_Found")+1);
                  }
                oPC = GetNextObjectInArea();
                }
            if(GetLocalInt(OBJECT_SELF,"PCs_Found") != GetLocalInt(OBJECT_SELF,"PCs_In_Area"))
            {
            SetLocalInt(OBJECT_SELF,"PCs_In_Area",GetLocalInt(OBJECT_SELF,"PCs_Found"));
            }
            if(GetLocalInt(OBJECT_SELF,"PCs_Found") == 0)
            {
            SignalEvent(OBJECT_SELF,EventUserDefined(3000));
            SetLocalString(OBJECT_SELF,"PC Tracker Ran","False");
            }
            else
            {
            DelayCommand(300.0f,SignalEvent(OBJECT_SELF,EventUserDefined(2999)));
            }
            break;
            }

        case 3000:
            {
            object oArea = GetArea(OBJECT_SELF);
            object oChk = GetFirstObjectInArea(oArea);
            while(GetIsObjectValid(oChk) && (GetLocalInt(OBJECT_SELF,"PCs_In_Area") == 0))
                {
                int nChk = GetObjectType(oChk);

                switch(nChk)
                {
                case OBJECT_TYPE_CREATURE:
                    {
                    SetImmortal(oChk,FALSE);
                    SetPlotFlag(oChk,FALSE);
                    DelayCommand(0.1f,DestroyObject(oChk));
                    break;
                    }
                case OBJECT_TYPE_ITEM:
                    {
                    SetImmortal(oChk,FALSE);
                    SetPlotFlag(oChk,FALSE);
                    DelayCommand(0.1f,DestroyObject(oChk));
                    break;
                    }
                case OBJECT_TYPE_PLACEABLE:
                    {
                    if(GetStringLowerCase(GetName(oChk)) == "remains")
                    {
                    object oItem = GetFirstItemInInventory(oChk);
                    while(GetIsObjectValid(oItem))
                        {
                        DestroyObject(oItem);
                        oItem = GetNextItemInInventory(oChk);
                        }
                    AssignCommand(oChk,SetIsDestroyable(TRUE));
                    DestroyObject(oChk);
                    }
                    break;
                    }
                }
                oChk = GetNextObjectInArea(oArea);
                }
            object oObject = GetFirstObjectInArea(GetArea(OBJECT_SELF));
            while(GetIsObjectValid(oObject) && (GetLocalInt(OBJECT_SELF,"PCs_In_Area") == 0))
                {
                if (GetObjectType(oObject) == OBJECT_TYPE_ENCOUNTER)
                {
                SetEncounterActive(TRUE, oObject);
                }
                oObject=GetNextObjectInArea();
                }
            break;
            }

        case 3001:  //added v1.28 Boolean logic check
            {
            if(GetLocalString(OBJECT_SELF,"PC Tracker Ran") == "False")        // Part of the boolean logic check v1.28 - This is the part that makes sure it hasn't already been triggered
            {
            SetLocalString(OBJECT_SELF,"PC Tracker Ran","True");              // Part of the boolean logic check v1.28 - Indicates that the tracker has been activated
            SignalEvent(OBJECT_SELF,EventUserDefined(2999));
            }
            else
            {
            return;
            }
            break;
            }

        case 3002:  //added v1.30 Generic NPC Spawner
            /*
            Generic NPC Spawner Configuration
            1. Create a Waypoint at Spawn Location
            2. Define the creature to spawn by naming the Waypoint: SPWN_[resref of creature you want to spawn]  i.e. SPWN_waterdhavianguar
            3. Next, define the type of NPC types include [Waypoint Walkers, Posted, Sitting, and Merchant]
              To define the type one of the following to the start of the Waypoint's Tag: WP_  POST_  SIT_  MER_  NIGHT_  DAY_  NORM_
            4. Now you define the NPC's Tag (add whatever you want after the definer from step 3) - TAG MUST BE UNIQUE!          i.e. POST_waterdhavianguard1
            4a. If you want a Waypoint walker, add _01 to the end of the tag    i.e. WP_waterdhavianwatcher1_01
            */
            {
            object oSP = GetFirstObjectInArea();
            string nOSPTag = "";
            while(GetIsObjectValid(oSP))
                {
                if(GetTag(oSP) == nOSPTag)
                {
                oSP = GetNextObjectInArea();
                }
                else
                {
                if((GetObjectType(oSP) == OBJECT_TYPE_WAYPOINT) || (GetObjectType(oSP) == OBJECT_TYPE_STORE))
                  {
                  if(GetStringUpperCase(GetStringLeft(GetName(oSP),5)) == "SPWN_")
                  {
                  string nresref = GetStringRight(GetName(oSP),GetStringLength(GetName(oSP))-5);



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),3)) == "WP_")    //Spawner for Waypoint Walkers
                  {
                  string sSPTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-3);
                  string sNPCTag = GetStringLeft(sSPTag,GetStringLength(sSPTag)-3);
                  CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                  }



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),5)) == "POST_")  //Spawner for posted NPCS
                  {
                  string sNPCTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-5);
                  CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                  }



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),4)) == "SIT_")  //Spawner for sitting NPCS
                  {
                  string sNPCTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-4);
                  CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                  DelayCommand(0.5f,AssignCommand(GetObjectByTag(sNPCTag),ActionSit(GetNearestObjectByTag("Chair"))));
                  }



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),4)) == "MER_")  //Spawner for Merchant NPCS
                  {
                  string sNPCTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-4);
                  CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                  if(GetStoreGold(oSP) <= 1000)
                    {
                    SetStoreGold(oSP,100000);
                    }
                  }



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),6)) == "NIGHT_")  //Spawner for Night-Only NPCs
                  {
                  if((GetTimeHour() >= 1Cool || (GetTimeHour() <= 6))                //change times as per your module
                    {
                    string sNPCTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-6);
                    CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                    }
                  }



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),4)) == "DAY_")  //Spawner for Day-Only NPCs
                  {
                  if((GetTimeHour() <= 1Cool && (GetTimeHour() >= 6))                //change times as per your module
                    {
                    string sNPCTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-4);
                    CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                    }
                  }



                  if(GetStringUpperCase(GetStringLeft(GetTag(oSP),5)) == "NORM_")  //Spawner for Normal NPCs that do not need any special treatment
                  {
                    string sNPCTag = GetStringRight(GetTag(oSP),GetStringLength(GetTag(oSP))-5);
                    CreateObject(OBJECT_TYPE_CREATURE,GetStringRight(GetStringLowerCase(GetName(oSP)),GetStringLength(GetName(oSP))-5),GetLocation(oSP),FALSE,sNPCTag);
                  }



                  }
                  }
                nOSPTag = GetTag(oSP);
                oSP = GetNextObjectInArea();
                }

                }
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.

_________________
L'imagination est plus importante que le savoir. (Albert Einstein)
 
Revenir en haut Voir le profil de l'utilisateur Envoyer un message privé Ignorer l'utilisateur
 
AZAZEL11
Seigneur
Inscrit le: 08 Fév 2006
Messages: 156
Répondre en citant
Posté le : 21/02/2006 00:44:36 Sujet du message :

Ah la ca va pas bien, au moins je sais pourquoi mes pnjs disparaissaient sauf que je sais pas comment faire fonctionner les spawns par script. Quelqu'un voudrait-il bien me dire comment faire? J'ai pourtant bien essayé de plusieurs facons, mais que voulez vous? je n'y arrive pas.


Merci d'avance
_________________
L'imagination est plus importante que le savoir. (Albert Einstein)
 
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 45.589ms