La Bibliothèque de Neverwinter Nights
Aide et informations diverses sur Neverwinter Nights ainsi que D&D3.
La date/heure actuelle est 25/04/2024 21:34:33


  Page 1 sur 1 ¤

Voir le sujet précédent ¤ Voir le sujet suivant 
Auteur Message
FeudeDaisy
Chevalier
Inscrit le: 07 Juil 2008
Messages: 84
Répondre en citant
Posté le : 13/06/2010 15:58:03 Sujet du message : Placement des PNJ en fonction du JOUR/NUIT

Bonjour à tous!

La création de mon module NWN2 avance très bien mais j'ai un problème sur un script que j'utilisais sous NWN1 pour que les PNJ soit à un endroit différent le jour et la nuit!

Voici les deux scripts en question :
(a mettre dans le Heartbeat de NWN1 // je l'ai mis dans les scripts récurant sur NWN2)
NWScript :
//:Confused///////////////////////// /////////////////////
//:: Heartbeat personnalise
//:: RAV_ANIMHB
//:Confused///////////////////////// ////////////////////
/*
    Animations personnalisees
*/

//:Confused///////////////////////// ////////////////////
//:: Created By: Serge GANDOLPHE
//:: Created On: 13 fevrier 2003
//:Confused///////////////////////// ////////////////////
#include "NW_I0_GENERIC"
#include "nw_i0_plot"

void main()
{

    //if(!GetIsInCombat() && !IsInConversation(OBJECT_SELF) )
    //    ActionRandomWalk();

    if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
    {
        if(TalentAdvancedBuff(40.0))
        {
            SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);
            return;
        }
    }

    if(GetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING))
    {
        int nDay = FALSE;
        if(GetIsDay() || GetIsDawn())
        {
            nDay = TRUE;
        }
        if(GetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT") != nDay)
        {
            if(nDay == TRUE)
            {
                SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", TRUE);
            }
            else
            {
                SetLocalInt(OBJECT_SELF, "NW_GENERIC_DAY_NIGHT", FALSE);
            }
            WalkWayPoints();
        }
    }

    if(!GetHasEffect(EFFECT_TYPE_SLEEP))
    {
        if(!GetIsPostOrWalking())
        {
            if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
            {
                if(!GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
                {
                    if(!GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) && !IsInConversation(OBJECT_SELF))
                    {
                        if(GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS) || GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN))
                        {
                            PlayMobileAmbientAnimations();
                        }
                        else if(GetIsEncounterCreature() &&
                        !GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
                        {
                            PlayMobileAmbientAnimations();
                        }
                        else if(GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS) &&
                          !GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN)))
                        {
                            PlayImmobileAmbientAnimations();
                        }
                    }
                    else
                    {
                        DetermineSpecialBehavior();
                    }
                }
                else
                {
                    //DetermineCombatRound();
                }
            }
        }
    }
    else
    {
        if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT))
        {
            effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
            if(d10() > 6)
            {
                ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
            }
        }
    }
    if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
    {
        SignalEvent(OBJECT_SELF, EventUserDefined(1001));
    }

    //Ca se passe ici
    /*Le jour le pnj se ballade dans le village et a la tombee de la nuit il rentre chez lui*/
        if(GetLocalInt(OBJECT_SELF,"isoutside"))
        {
            if((GetIsNight() || GetIsDusk()) && !GetLocalInt(OBJECT_SELF,"movedinside")){
                SetLocalInt(OBJECT_SELF,"isoutside", FALSE);
                SetLocalInt(OBJECT_SELF,"movedoutside",FALSE);
                SetLocalInt(OBJECT_SELF,"movedinside",TRUE);
                ClearAllActions(TRUE);
                EscapeArea(FALSE,"EXIT_"+GetTag(OBJECT_SELF));
                object OPnj = CreateObject(OBJECT_TYPE_CREATURE,GetResRef(OBJECT_SELF),GetLocation(GetWaypointByTag("NIGHT_"+GetTag(OBJECT_SELF))));
                DestroyObject(OBJECT_SELF,10.0f);//Pour etre certain de ne pas avoir de clones
            }
        }
        else{
            if((GetIsDay() || GetIsDawn()) && !GetLocalInt(OBJECT_SELF,"movedoutside")){
                SetLocalInt(OBJECT_SELF,"isoutside", TRUE);
                SetLocalInt(OBJECT_SELF,"movedoutside",TRUE);
                SetLocalInt(OBJECT_SELF,"movedinside",FALSE);
                ClearAllActions(TRUE);
                EscapeArea(FALSE,"EXIT_"+GetTag(OBJECT_SELF));
                object OPnj = CreateObject(OBJECT_TYPE_CREATURE,GetResRef(OBJECT_SELF),GetLocation(GetWaypointByTag("DAY_"+GetTag(OBJECT_SELF))));
                DestroyObject(OBJECT_SELF,10.0f);
            }
        }
}
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 mettre dans le onspawn de NWN1 // je l'ai mis dans le cadre de spawn)
NWScript :
//:Confused///////////////////////// /////////////////////
//:: Default: On Spawn In
//:: rav_os_commoner
//:: Par Serge GANDOLPHE
//: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()
{
    //Ici il faut lister vos zones de JOUR!!!!
    //Remplacez simplement zone1 et zone2 par les tags de vos zones et rajoutez autant de  || areaTag =="zonex" que vous avez de zones de jour
    string areaTag = GetTag(GetArea(OBJECT_SELF));
    if(areaTag =="valkenas" || areaTag =="valkenasecurie" || areaTag =="valkenasmoulin" || areaTag =="valkenasferme" || areaTag =="valkenashouse1" || areaTag =="valkenashouse2" ){
        SetLocalInt(OBJECT_SELF,"isoutside", TRUE);
        SetLocalInt(OBJECT_SELF,"movedoutside",TRUE);
        SetLocalInt(OBJECT_SELF,"movedinside",FALSE);
    }
    else{
        SetLocalInt(OBJECT_SELF,"isoutside", FALSE);
        SetLocalInt(OBJECT_SELF,"movedoutside",FALSE);
        SetLocalInt(OBJECT_SELF,"movedinside",TRUE);
    }
// OPTIONAL BEHAVIORS (Comment In or Out to Activate ) ****************************** ****************************** ****************
    //SetSpawnInCondition(NW_FLAG_ SPECIAL_CONVERSATION);
    //SetSpawnInCondition(NW_FLAG_ SPECIAL_COMBAT_CONVERSATION);
                // This causes the creature to say a special greeting in their conversation file
                // upon Perceiving the player. Attach the [NW_D2_GenCheck.nss] script to the desired
                // greeting in order to designate it. As the creature is actually saying this to
                // himself, don't attach any player responses to the greeting.

    //SetSpawnInCondition(NW_FLAG_ SHOUT_ATTACK_MY_TARGET);
                // This will set the listening pattern on the NPC to attack when allies call
    //SetSpawnInCondition(NW_FLAG_ STEALTH);
                // If the NPC has stealth and they are a rogue go into stealth mode
    //SetSpawnInCondition(NW_FLAG_ SEARCH);
                // If the NPC has Search go into Search Mode
    //SetSpawnInCondition(NW_FLAG_ SET_WARNINGS);
                // This will set the NPC to give a warning to non-enemies before attacking

    //SetSpawnInCondition(NW_FLAG_ SLEEP);
                //Creatures that spawn in during the night will be asleep.
    //SetSpawnInCondition(NW_FLAG_ DAY_NIGHT_POSTING);
    //SetSpawnInCondition(NW_FLAG_ APPEAR_SPAWN_IN_ANIMATION);
    //SetSpawnInCondition(NW_FLAG_ IMMOBILE_AMBIENT_ANIMATIONS);
    //SetSpawnInCondition(NW_FLAG_ AMBIENT_ANIMATIONS);
                //This will play Ambient Animations until the NPC sees an enemy or is cleared.
                //NOTE that these animations will play automatically for Encounter Creatures.

    // NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME.
    //SetSpawnInCondition(NW_FLAG_ ESCAPE_RETURN);    // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.)
    //SetSpawnInCondition(NW_FLAG_ ESCAPE_LEAVE);    // OPTIONAL BEHAVIOR (Flee to a way point and do not return.)
    //SetSpawnInCondition(NW_FLAG_ TELEPORT_LEAVE);  // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
    //SetSpawnInCondition(NW_FLAG_ TELEPORT_RETURN);  // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)

// CUSTOM USER DEFINED EVENTS
/*
    The following settings will allow the user to fire one of the blank user defined events in the NW_D2_DefaultD.  Like the
    On Spawn In script this script is meant to be customized by the end user to allow for unique behaviors.  The user defined
    events user 1000 - 1010
*/

    //SetSpawnInCondition(NW_FLAG_ HEARTBEAT_EVENT);        //OPTIONAL BEHAVIOR - Fire User Defined Event 1001
    //SetSpawnInCondition(NW_FLAG_ PERCIEVE_EVENT);        //OPTIONAL BEHAVIOR - Fire User Defined Event 1002
    //SetSpawnInCondition(NW_FLAG_ ATTACK_EVENT);          //OPTIONAL BEHAVIOR - Fire User Defined Event 1005
    //SetSpawnInCondition(NW_FLAG_ DAMAGED_EVENT);          //OPTIONAL BEHAVIOR - Fire User Defined Event 1006
    //SetSpawnInCondition(NW_FLAG_ DISTURBED_EVENT);        //OPTIONAL BEHAVIOR - Fire User Defined Event 1008
    //SetSpawnInCondition(NW_FLAG_ END_COMBAT_ROUND_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003
    //SetSpawnInCondition(NW_FLAG_ ON_DIALOGUE_EVENT);      //OPTIONAL BEHAVIOR - Fire User Defined Event 1004
    //SetSpawnInCondition(NW_FLAG_ DEATH_EVENT);            //OPTIONAL BEHAVIOR - Fire User Defined Event 1007

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



Le principe est d'avoir le PNJ dans la zone de "jour" et d'avoir deux tags principalement : "DAY_TAGPNJ" ; "NIGHT_TAGPNJ" ainsi que deux "EXIT_TAGPNJ"; (et un PNJ identique dans la palette!)
La nuit venu, le PNJ marchait jusqu'au point "EXIT_TAGPNJ) et on le retrouvait dans la maison en y entrant... le système est identique lorsque le jour arrive!
Sur NWN tout marchait au poil, mais sur NWN2 apparemment, le PNJ spawn sans arrêt sur le point de JOUR...

est-ce que quelqu'un à une idée svp?
ou un autre système à utilisé? (en m'expliquant si possible comment faire... )

Merci
_________________
Le Slide Challenge est une communauté regroupant plusieurs jeu assez ancien auquel nous jouons le soir en semaine!!!
[http]
 
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.719ms