Controle nettoyage via conversation

Répondre
Partager Rechercher
Coucou

J'aimerai modifier ce script afin qu'il soit utilisable dans une conversation pour nettoyer uniquement les que les zones déterminées (je ne sais pas comment faire ).

Code:
// nettoyeur de zones (drop, coffre, rencontres)
// a mettre dans le OnExit de la zone
// Icien decembre04
//
//    Dimencia
//     contrôle de la zone avant nettoyage apres TEMPO secondes (fevrier 08)
//    Le script de nettoyage se lance apres TEMPO secondes
//    Ajout Fermeture des portes des le depart du dernier joueur (mars 08)
//
//

#include "declencheur_include_area"

void init_map(object oSource, object oZone);

void main() {
    float TEMPO = 1.0; //temps avant nettoyage en secondes  
    object oPC = GetExitingObject();
    object oCrea = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPC, 1);
    object oZone = OBJECT_SELF;
	    
    int iNb_joueurs = GetLocalInt(oZone, "nbjoueurs");
//    SendMessageToPC(oPC, "Le script de Nettoyage voit "+IntToString(iNb_joueurs)+" joueurs ds la zone : "+GetName(oZone));        
// Je retest mais normalment c'est zero au lancement de ce script
// Le script de nettoyage à Icien sera lancer au bout de TEMPO secondes        

			
		if (iNb_joueurs < 1) {
        // On ferme toutes les portes    
        object oObj = GetFirstObjectInArea(oZone);
        int iType, iPortes = 0;
         while (GetIsObjectValid(oObj)) {
            iType = GetObjectType(oObj);
            if (iType == OBJECT_TYPE_DOOR) {
                iPortes++;
                 AssignCommand(oObj, ActionCloseDoor(oObj));
                }
             oObj = GetNextObjectInArea(oZone);                    
            }
//        SendMessageToPC(oPC, "fermeture de "+IntToString(iPortes)+" porte(s)");        
//        SendMessageToPC(oPC,"Le script de Nettoyage se lancera dans : "+IntToString(FloatToInt(TEMPO))+" secondes");
        DelayCommand(TEMPO , init_map(oPC, OBJECT_SELF));
        }
    else{
//        SendMessageToPC(oPC,"La zone n'est plus vide.");
        }    
    }
    


void init_map(object oPC,object oZone) {

int iPnj = 0;
int iDrop = 0;
int iItem = 0;
//SendMessageToPC(oPC,"Le processus de nettoyage de "+ GetName(oZone) + " commence");
int iNb_joueurs = GetLocalInt(oZone, "nbjoueurs");    
// Le script de nettoyage à Icien est lancé, TEMPO secondes    se sont écoulées
// Je regarde à nouveau si la zone est vide sinon, je ne nettoies pas    
				
    if (iNb_joueurs < 1) {
         object oSource = GetFirstObjectInArea(oZone);
         object oCrea = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oSource, 1);
         object oObj;
         object oItem;
         int nN=1;
         int iType;
        
         if (oCrea == OBJECT_INVALID && !(GetIsPC(oSource))) {
             oObj = oSource;
             while (GetIsObjectValid(oObj)) {
                 iType = GetObjectType(oObj);
                 if (GetTag(oObj) == "BodyBag")//1 Supprime les Drops
                    {
                     oItem=GetFirstItemInInventory(oObj);
                     while(GetIsObjectValid(oItem))
                         {
                          DestroyObject(oItem);
                          oItem=GetNextItemInInventory(oObj);
                          iDrop++;
                         }
                     DestroyObject(oObj);
                    }
					if (GetTag(oObj) == "ObjetEffacable")//1 Supprime les Placables temporaires
                    {
                     oItem=GetFirstItemInInventory(oObj);
                     while(GetIsObjectValid(oItem))
                         {
                          DestroyObject(oItem);
                          oItem=GetNextItemInInventory(oObj);
                          iDrop++;
                         }
                     DestroyObject(oObj);
                    }
                 else
                    {
                     //iType = GetObjectType(oObj);
                     switch (iType)
                        {
                         case OBJECT_TYPE_CREATURE://2 Supprime les spawns
                                  AssignCommand(oObj, ClearAllActions()); //Ajout
                                  AssignCommand(oObj, DestroyObject(oObj, 1.0));
                                  iPnj++;
                             break;
                             
                         case OBJECT_TYPE_ITEM://3 detruit les objets par terre
                             AssignCommand(oObj, DestroyObject(oObj, 0.0));
                             iItem++;
                             break;
                             
                         default:
                             break;
                             
                        }
                    }
                 nN++;
                 oObj = GetNearestObject(OBJECT_TYPE_ALL, oSource, nN);
                }
//                SendMessageToPC(oPC,IntToString(iDrop)+" Drop(s) detruit(s)");
//                SendMessageToPC(oPC,IntToString(iPnj)+" Creature(s) detruite(s)");
//                SendMessageToPC(oPC,IntToString(iItem)+" Item(s) detruit(s)");    
//                 SendMessageToPC(oPC,"nettoyage de la Zone: "+ GetName(oZone) +" terminé");
            }
            DeleteLocalInt(oZone, "init");
            DeleteLocalInt(oZone, "pop");
            DeleteLocalInt(oZone, "valrepop");
            DeleteLocalInt(oZone, "nbjoueurs");            
//            SendMessageToPC(oPC,"Zone prête à etre initialisée");            
        }
    else {
//        SendMessageToPC(oPC,"Nettoyage abondonné pour la zone "+ GetName(oZone));
//        SendMessageToPC(oPC,"car un joueur vient d'y entrer");
        }
		
    object oArea = OBJECT_SELF;
    object oPC = GetExitingObject();

    if (!GetIsObjectValid(oArea))
        return;
    if (!GetIsPC(oPC))
        return;
		
    if (GetLocalInt(oArea, TAG_TRIGGER_1 + TRIGGER_ACTIVE))
        ManageTriggersByTag(oArea, TAG_TRIGGER_1, FALSE);
    if (GetLocalInt(oArea, TAG_TRIGGER_2 + TRIGGER_ACTIVE))
        ManageTriggersByTag(oArea, TAG_TRIGGER_2, FALSE);
    if (GetLocalInt(oArea, TAG_TRIGGER_3 + TRIGGER_ACTIVE))
        ManageTriggersByTag(oArea, TAG_TRIGGER_3, FALSE);
    if (GetLocalInt(oArea, TAG_TRIGGER_4 + TRIGGER_ACTIVE))
        ManageTriggersByTag(oArea, TAG_TRIGGER_4, FALSE);
    if (GetLocalInt(oArea, TAG_TRIGGER_5 + TRIGGER_ACTIVE))
        ManageTriggersByTag(oArea, TAG_TRIGGER_5, FALSE);
    if (GetLocalInt(oArea, TAG_TRIGGER_6 + TRIGGER_ACTIVE))
        ManageTriggersByTag(oArea, TAG_TRIGGER_6, FALSE);
		
		
SetLocalInt(oPC, "verif_coffre_01",0);
SetLocalInt(oPC, "verif_coffre_02",0);
SetLocalInt(oPC, "verif_coffre_03",0);
SetLocalInt(oPC, "verif_coffre_04",0);
SetLocalInt(oPC, "verif_coffre_05",0);
SetLocalInt(oPC, "verif_coffre_06",0);
SetLocalInt(oPC, "verif_coffre_07",0);
SetLocalInt(oPC, "verif_coffre_08",0);
SetLocalInt(oPC, "verif_coffre_09",0);
SetLocalInt(oPC, "verif_coffre_10",0);		
SetLocalInt(oPC, "verif_coffre_11",0);		
SetLocalInt(oPC, "verif_coffre_12",0);

		

    DelayCleanArea(oArea);		
		
		
    }
Merci de l'aide
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés