NWScript :
//:: Created On: 12/19/04
//://///////////////////////////////////////////
int CurrentTime();
int nHourMax=90;
void main()
{
object oArea=(OBJECT_SELF);
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.
{
}
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)|| GetIsDM(oPC)||GetIsDMPossessed(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:
{
// AJOUT DE SONJA ICI
object oMast = GetMaster(oChk);
if ((oMast == OBJECT_INVALID) || (GetIsPC(oMast) != TRUE))
{
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() >= 1 || (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() <= 1 && (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();
SignalEvent(OBJECT_SELF,EventUserDefined(4000));
}
///Azzzzz
}
break;
}
case 4000:
{
int iCurrentTime, iTempsPresent, iTempsPasser, iTempsPiste;
iTempsPiste = GetLocalInt(oArea,"Piste_heure");
////////////////////////////////////////////////////////////////////////////
object oArea=GetArea(OBJECT_SELF);
object oCreature=GetFirstObjectInArea(oArea);
iCurrentTime=CurrentTime();
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////BOUCLE////////////////////////////////
while(GetIsObjectValid(oCreature))//&&
{
if (GetIsPC(oCreature)||GetIsEncounterCreature(oCreature)||GetObjectType(oCreature)==OBJECT_TYPE_CREATURE))
/////////////////////////////////////////////////////////////////
//////////////////////////RACES ET LES LOCALINT//////////////////
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ABERRATION)
{
SetLocalString(oArea,"abberration", "d'aberration");
SetLocalInt(oArea, "ptabberration",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ANIMAL)
{
SetLocalString(oArea,"animal", "de/d' " +GetName(oCreature));
SetLocalInt(oArea,"ptanimal",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_BEAST)
{
SetLocalString(oArea,"beast", "de bête primitive");
SetLocalInt(oArea, "ptbeast",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_CONSTRUCT)
{
SetLocalString(oArea,"artificiel" ,"de créature artificielle");
SetLocalInt(oArea,"ptartificiel",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_DRAGON)
{
SetLocalString(oArea,"dragon", "de dragon");
SetLocalInt(oArea,"ptdragon",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_DWARF)
{
SetLocalString(oArea,"nain", "de nain");
SetLocalInt(oArea,"ptnain",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ELEMENTAL)
{
SetLocalString(oArea,"elemental", "d'élémental");
SetLocalInt(oArea,"ptelemental",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ELF)
{
SetLocalString(oArea,"elfe", "d'elfe");
SetLocalInt(oArea, "ptelfe",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_FEY)
{
SetLocalString(oArea,"fee", "de fée" );
SetLocalInt(oArea,"ptfee",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_GIANT)
{
SetLocalString(oArea,"geant", "de géant");
SetLocalInt(oArea,"ptgeant",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_GNOME)
{
SetLocalString(oArea,"gnome", "de gnome");
SetLocalInt(oArea,"ptgnome",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HALFELF)
{
SetLocalString(oArea,"demielf", "de demi-elfe");
SetLocalInt(oArea,"ptdemielf",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HALFLING)
{
SetLocalString(oArea,"halfling", "de petit-gens");
SetLocalInt(oArea,"pthalfling",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HALFORC)
{
SetLocalString(oArea,"demiorc", "de demi-orque");
SetLocalInt(oArea, "ptdemiorc",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMAN)
{
SetLocalString(oArea,"humain", "d'humain");
SetLocalInt(oArea,"pthumain",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_GOBLINOID)
{
SetLocalString(oArea,"goblin", "de gobelin");
SetLocalInt(oArea, "ptgoblin",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_MONSTROUS)
{
SetLocalString(oArea,"humanoide", "d'humainoide");
SetLocalInt(oArea,"pthumanoide",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_ORC)
{
SetLocalString(oArea,"orc", "d'orque");
SetLocalInt(oArea,"ptorc",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_REPTILIAN)
{
SetLocalString(oArea,"reptile", "de reptile");
SetLocalInt(oArea,"ptreptile",CurrentTime());
}
if (GetLocalInt(oArea, "ptreptile")==90)
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_MAGICAL_BEAST)
{
SetLocalString(oArea,"magique", "de créature magique");
SetLocalInt(oArea,"ptmagique",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_OOZE)
{
SetLocalString(oArea,"vase", "de vase");
SetLocalInt(oArea, "ptvase",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_OUTSIDER)
{
SetLocalString(oArea,"outsider", "d'extra-planètaire");
SetLocalInt(oArea,"ptoutsider",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_SHAPECHANGER)
{
SetLocalString(oArea,"shapechanger", "de changeur de forme");
SetLocalInt(oArea,"ptshapechanger",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_UNDEAD)
{
SetLocalString(oArea,"undead", "de mort-vivant");
SetLocalInt(oArea,"ptundead",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_VERMIN)
{
SetLocalString(oArea,"vermine", "de/d'"+GetName(oCreature));
SetLocalInt(oArea, "ptvermine",CurrentTime());
}
/////////////////////////fin des variables///////////////////////
//////////////////////////fin de la boucle///////////////////////
oCreature=GetNextObjectInArea();
} //while ok
//DelayCommand(60.1,SignalEvent(OBJECT_SELF,EventUserDefined(4000)));
} // case 4000 void
break; //fin des switch
} //switch
} //void
/////////////////////////////////////////////////////////////////
////////////////////////////Calendrier///////////////////////////
int CurrentTime()
{ //ok
return GetCalendarYear()*8064 + GetCalendarMonth()*672 + GetCalendarDay()*24 + GetTimeHour();
} //ok
/////////////////////////////////////////////////////////////////
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.//://///////////////////////////////////////////
int CurrentTime();
int nHourMax=90;
void main()
{
object oArea=(OBJECT_SELF);
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.
{
}
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)|| GetIsDM(oPC)||GetIsDMPossessed(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:
{
// AJOUT DE SONJA ICI
object oMast = GetMaster(oChk);
if ((oMast == OBJECT_INVALID) || (GetIsPC(oMast) != TRUE))
{
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() >= 1 || (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() <= 1 && (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();
SignalEvent(OBJECT_SELF,EventUserDefined(4000));
}
///Azzzzz
}
break;
}
case 4000:
{
int iCurrentTime, iTempsPresent, iTempsPasser, iTempsPiste;
iTempsPiste = GetLocalInt(oArea,"Piste_heure");
////////////////////////////////////////////////////////////////////////////
object oArea=GetArea(OBJECT_SELF);
object oCreature=GetFirstObjectInArea(oArea);
iCurrentTime=CurrentTime();
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////BOUCLE////////////////////////////////
while(GetIsObjectValid(oCreature))//&&
{
if (GetIsPC(oCreature)||GetIsEncounterCreature(oCreature)||GetObjectType(oCreature)==OBJECT_TYPE_CREATURE))
/////////////////////////////////////////////////////////////////
//////////////////////////RACES ET LES LOCALINT//////////////////
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ABERRATION)
{
SetLocalString(oArea,"abberration", "d'aberration");
SetLocalInt(oArea, "ptabberration",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ANIMAL)
{
SetLocalString(oArea,"animal", "de/d' " +GetName(oCreature));
SetLocalInt(oArea,"ptanimal",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_BEAST)
{
SetLocalString(oArea,"beast", "de bête primitive");
SetLocalInt(oArea, "ptbeast",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_CONSTRUCT)
{
SetLocalString(oArea,"artificiel" ,"de créature artificielle");
SetLocalInt(oArea,"ptartificiel",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_DRAGON)
{
SetLocalString(oArea,"dragon", "de dragon");
SetLocalInt(oArea,"ptdragon",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_DWARF)
{
SetLocalString(oArea,"nain", "de nain");
SetLocalInt(oArea,"ptnain",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ELEMENTAL)
{
SetLocalString(oArea,"elemental", "d'élémental");
SetLocalInt(oArea,"ptelemental",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_ELF)
{
SetLocalString(oArea,"elfe", "d'elfe");
SetLocalInt(oArea, "ptelfe",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_FEY)
{
SetLocalString(oArea,"fee", "de fée" );
SetLocalInt(oArea,"ptfee",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_GIANT)
{
SetLocalString(oArea,"geant", "de géant");
SetLocalInt(oArea,"ptgeant",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_GNOME)
{
SetLocalString(oArea,"gnome", "de gnome");
SetLocalInt(oArea,"ptgnome",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HALFELF)
{
SetLocalString(oArea,"demielf", "de demi-elfe");
SetLocalInt(oArea,"ptdemielf",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HALFLING)
{
SetLocalString(oArea,"halfling", "de petit-gens");
SetLocalInt(oArea,"pthalfling",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HALFORC)
{
SetLocalString(oArea,"demiorc", "de demi-orque");
SetLocalInt(oArea, "ptdemiorc",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMAN)
{
SetLocalString(oArea,"humain", "d'humain");
SetLocalInt(oArea,"pthumain",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_GOBLINOID)
{
SetLocalString(oArea,"goblin", "de gobelin");
SetLocalInt(oArea, "ptgoblin",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_MONSTROUS)
{
SetLocalString(oArea,"humanoide", "d'humainoide");
SetLocalInt(oArea,"pthumanoide",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_ORC)
{
SetLocalString(oArea,"orc", "d'orque");
SetLocalInt(oArea,"ptorc",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_HUMANOID_REPTILIAN)
{
SetLocalString(oArea,"reptile", "de reptile");
SetLocalInt(oArea,"ptreptile",CurrentTime());
}
if (GetLocalInt(oArea, "ptreptile")==90)
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_MAGICAL_BEAST)
{
SetLocalString(oArea,"magique", "de créature magique");
SetLocalInt(oArea,"ptmagique",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_OOZE)
{
SetLocalString(oArea,"vase", "de vase");
SetLocalInt(oArea, "ptvase",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_OUTSIDER)
{
SetLocalString(oArea,"outsider", "d'extra-planètaire");
SetLocalInt(oArea,"ptoutsider",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_SHAPECHANGER)
{
SetLocalString(oArea,"shapechanger", "de changeur de forme");
SetLocalInt(oArea,"ptshapechanger",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_UNDEAD)
{
SetLocalString(oArea,"undead", "de mort-vivant");
SetLocalInt(oArea,"ptundead",CurrentTime());
}
/////////////////////////////////////////////////////////////////
if(GetRacialType(oCreature)== RACIAL_TYPE_VERMIN)
{
SetLocalString(oArea,"vermine", "de/d'"+GetName(oCreature));
SetLocalInt(oArea, "ptvermine",CurrentTime());
}
/////////////////////////fin des variables///////////////////////
//////////////////////////fin de la boucle///////////////////////
oCreature=GetNextObjectInArea();
} //while ok
//DelayCommand(60.1,SignalEvent(OBJECT_SELF,EventUserDefined(4000)));
} // case 4000 void
break; //fin des switch
} //switch
} //void
/////////////////////////////////////////////////////////////////
////////////////////////////Calendrier///////////////////////////
int CurrentTime()
{ //ok
return GetCalendarYear()*8064 + GetCalendarMonth()*672 + GetCalendarDay()*24 + GetTimeHour();
} //ok
/////////////////////////////////////////////////////////////////