[script] le repos sur les terres de Simaon

Répondre
Partager Rechercher
Bon voilà suite à ce fil de discussion


Si cela intéresse quelqu'un, je mets ici mon script concernant le repos en Simaon
Les zones sont de 3 types, les contraintes sont cumulatives :

zones civilisées (variable hostile à 0 ou non enregistrée) : il faut juste de l'eau et de la nourriture pour dormir correctement
Les test de constitution sont calqués un peu sur les règles DD3.5 avec un DD de 10 +2 cumulatif (au lieu de +1 pour la nourriture je crois)
zone sauvage (variable hostile à 1) : le joueur doit se trouver près d'un campement qu'il aura au préalable établi, sinon il se reposera mal
zone hostile (variable hostile à 2) : un test de SURVIE est effectué pour tous les membres du groupe. Si TOUS les membres du groupe le ratent, des créatures surprennent les joueurs alors qu'il étaient en train de dormir.


Chaque réveil entraîne une lenteur plus ou moins grande selon le type de réveil, le temps que le joueur reprennent ses esprit (10 - 15 secondes)



En gros pour les monstres un test de survie est effectué à chaque fois que la zone a une variable de type int hostile = 2, et que le 1er waypoint avec pour tag civilisation est à plus de 40m

(Survie pour représenter la capacité des joueurs à avoir pu monter un campement discret, à effacer leurs traces, etc etc)


le DD est aussi sauvegardé sur la zone (variable de type int "rencontre")

les créatures qui spawnent sont aussi sauvegardées (variable de type string "creature" qui est le blueprint de la creature) et par défaut c'est un gob ("ktx_gob")
1 à 4 créatures sont spawnées lors du repos si le test est échoué
Si le test est réussi, les joueurs peuvent alors se reposer tranquillement chacun leur tour pendant 15 secondes









le script de spawn pendant le repos

la bibliothèque

Code PHP:

//test de constitution
int TestConstit(object oPCTestint nDifficult);
 
//application de malus pendant le repos en zone sauvage
void MalusZoneSauvage(object oAreaMalus,object oPCRepos);
 
//application des malus de faim et de soif
void MalusFaimSoif (object oPCFaimint iMalusFaimSave,int iMalusSoifSave);
 
//retourne le temps en minutes qui s'est déroulé entre fTime et 
//l'instant présent. Ce sont des INTEGER calculés selon la formule
// HeureModule x 60 + MinuteModule
int TimeControl(int iTime);
 
//Test pour savoir si un item placable de campement a été mis 
//à côté du perso qui se repose
int TestCampementProche(object oPCTestCampement);
 
//Fait un test de survie pour savoir si une rencontre aura lieu
//Le test est effectué par chaque membres du groupe, un membre du groupe
//qui ne se repose pas aura un bonus de +2 car montant la garde
//Un test réussi profitte au groupe entier pendant 15 secondes
int TestSurvieRencontre (object oPCRencontre,int iDDRencontre);
 
//Crée de 1 à 4 créatures à côté du Joueur qui se repose
//les créatures par défaut sont des gobelins, mais on peut 
//définir d'autres créatures dans les variables de la zone
void CreateRencontrePendantRepos (object oPCInvalidRest,object oAreaRencontre);
 
// Convertit trois couleurs RGB en une valeur int.
// * nRed/nGreen/nBlue sont des valeurs comprises
//   entre 0 et 255 inclus.
// * Retournera 0 (noir) si une valeur est incorrecte.
int DeclareIntColor(int nRed=0int nGreen=0int nBlue=0);
 
 
float KTXRandomFloat ();
vector GetKTXRandomVector();
void FloatingTestResting (object oPlay);
 
/******************************************************************
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
////////////// ************************************** \\\\\\\\\\\\\
--------------       FONCTIONS -- DEFINITIONS       -------------
\\\\\\\\\\\\\\ ************************************** /////////////
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
******************************************************************/
 
 
 
//*****************************************************************
//TEST DE CONSTITUTION ********************************************
//*****************************************************************
int TestConstit(object oPCTestint nDifficult)
{
int iJet d20()+ GetAbilityModifier (ABILITY_CONSTITUTION,oPCTest);
string sJet IntToString(iJet);
string sDD =  IntToString(nDifficult);
SendMessageToPC (oPCTest,"Test de Constitution : "+sJet+". DD : "sDD);
if (
iJet >= nDifficult)    
    {
    
SendMessageToPC (oPCTest,"réussi");
    return 
TRUE;
    }
else 
    {
    
SendMessageToPC (oPCTest,"raté");
    return 
FALSE;
    }
}
 
 
//*****************************************************************
//ZONE SAUVAGE ****************************************************
//*****************************************************************
void MalusZoneSauvage(object oAreaMalus,object oPCRepos)
{
int iHostileCtrl GetLocalInt (oAreaMalus,"hostile");
// si la zone est classée hostile ou très hostile
// le joueur doit avoir un camp de base pour bien dormir
// test de la variable ReposCamp, qui est à 1 si le joueur
// se trouve à moins de 5 m d'un camp de base
    
if (iHostileCtrl >= 1)
        {
        
int iTestCampBase GetLocalInt (oPCRepos,"ReposCamp");
        
// pas de malus cumulatif pour le repos précaire
        // Il entraine un malus de 2 dans une caractéristique aléatoire
        
if (iTestCampBase == 0)
            {
            
int iMaliApplic Random (6)+1;
            
effect eEffetRepos ExtraordinaryEffect(EffectAbilityDecrease(iMaliApplic,2));
            
ApplyEffectToObject(DURATION_TYPE_PERMANENTeEffetReposoPCRepos);
            }
        }
}
 
//*****************************************************************
//APPLICATION DES MALUS DE FAIM  ET DE SOIF ***********************
//*****************************************************************
void MalusFaimSoif (object oPCFaimSoifint iMalusFaimSave,int iMalusSoifSave)
{
int iFaimCtrl GetLocalInt (oPCFaimSoif"faim");
int iSoifCtrl GetLocalInt (oPCFaimSoif"soif");
int iMalusConstit iMalusFaimSave+iMalusSoifSave;
if ((
iFaimCtrl==0)||(iSoifCtrl==0))
        {
        
effect eConst ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_CONSTITUTIONiMalusConstit));
        
ApplyEffectToObject(DURATION_TYPE_PERMANENTeConstoPCFaimSoif);
        
int iMortdeFaim GetAbilityScore(oPCFaimSoif,ABILITY_CONSTITUTION);
        if (
iMortdeFaim <= 0)
            {
            
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDeath(),oPCFaimSoif);
            
SendMessageToPC (oPCFaimSoif"Le manque de vivres vous a été fatal");
            
SetLocalInt(oPCFaimSoif"faim",7);
            }
        }
 
 
// alcool => -2 en DEX, INT ou SAG. Les malus de soif ont été effacé au début
if (iSoifCtrl==1)
    {
    
int iCaracAlcool Random(4)+1;
    if (
iCaracAlcool == 2) {iCaracAlcool=1;}
    
effect eSoif ExtraordinaryEffect(EffectAbilityDecrease(iCaracAlcool,2));
    
ApplyEffectToObject(DURATION_TYPE_PERMANENTeSoifoPCFaimSoif);
    }
}
 
 
//*****************************************************************
//CONTROLE DU TEMPS PASSE *****************************************
//*****************************************************************
int TimeControl(int iTime)
{
int iHour GetTimeHour ();
int iMin GetTimeMinute ();
int iCurrentTime = (iHour*60) + iMin;
int iEcartTime abs(iCurrentTime iTime);
return 
iEcartTime;
}
 
 
//*****************************************************************
//REPOS ZONE SAUVAGE **********************************************
//*****************************************************************
int TestCampementProche(object oPCTestCampement)
{
object oCamptest GetNearestObjectByTag ("ktxcampbase",oPCTestCampement);
int iReturn FALSE;
if (
oCamptest != OBJECT_INVALID)
    {
    if (
GetDistanceBetween(oCamptestoPCTestCampement) <= 5.0)
        {
        
iReturn TRUE;
        }
    }
 
return 
iReturn;
}
 
 
 
//*****************************************************************
//TEST DE RENCONTRE EN ZONE SAUVAGE********************************
//*****************************************************************
int TestSurvieRencontre (object oPCRencontre,int iDDRencontre)
{
object oTarget GetFirstFactionMember(oPCRencontre);
int iSkillTest FALSE;
int iVariable;
float fDistance;
int TestRencontreModif iDDRencontre;
while (
oTarget != OBJECT_INVALID)
    {
    
fDistance GetDistanceBetween (oPCRencontreoTarget) ;
    if ((
fDistance>= 25.0)||(fDistance==0.0)) oTarget GetNextFactionMember(oPCRencontre,TRUE);
    else 
        {
        
iVariable GetLocalInt(oTarget,"TestSurvieReussi");
        if (
iVariable == 1)
            {
            
iSkillTest TRUE;
            }
        else 
            {
            if (
GetIsResting(oTarget)==FALSE)
                {
                
TestRencontreModif TestRencontreModif 2;
                }
            if (
GetIsSkillSuccessful (oTarget,SKILL_SURVIVAL,TestRencontreModif))
                {
 
                
iSkillTest TRUE;
                
SetLocalInt (oTarget,"TestSurvieReussi",1);
                
DelayCommand (15.0,SetLocalInt (oTarget,"TestSurvieReussi",0));
                }
            }
        
oTarget GetNextFactionMember(oPCRencontre,TRUE);
        }
    }
return 
iSkillTest;
}
 
 
//*****************************************************************
//CREATION DE CREATURES SURPRENANT LE PC QUI SE REPOSE*************
//*****************************************************************
void CreateRencontrePendantRepos (object oPCInvalidRest,object oAreaRencontre)
{
string sCreature GetLocalString (oAreaRencontre,"creature");
//par défaut des gobelins apparaissent
if (sCreature == ""
    {
    if (
Random(5)==0sCreature="ktx_bugbear";
    else 
sCreature="ktx_gob";
    }
 
location lApparition CalcSafeLocation (oPCInvalidRest,GetLocation (oPCInvalidRest), IntToFloat(Random(10)), TRUETRUE);
int NbCreatures Random(4)+1// crée de 1 à 4 créatures
while (NbCreatures 0)
    {
    
CreateObject(OBJECT_TYPE_CREATURE,sCreature,lApparition,FALSE);
    
NbCreatures NbCreatures -1;
    }
SendMessageToPC(oPCInvalidRest"Un groupe de créatures vous a réveillé en sursaut");
AssignCommand (oPCInvalidRest,ClearAllActions());
}
 
// script Deyonara
int DeclareIntColor(int nRed=0int nGreen=0int nBlue=0)
{
if((
nRed<|| nRed>255) ||
   (
nGreen<|| nGreen>255) ||
   (
nBlue<|| nBlue>255))
    return 
0;
 
     return ((
nRed*65536)+(nGreen*256)+nBlue);

 
float KTXRandomFloat()
{
float fRand IntToFloat(Random(10))/10
return 
fRand;
}
 
vector GetKTXRandomVector()
{
vector V;
V.KTXRandomFloat();
V.KTXRandomFloat();
V.KTXRandomFloat();
 
return 
V;
}
 
void FloatingTestResting (object oPlay)
{
vector vVector GetKTXRandomVector();
FloatingTextStringOnCreature ("Zzz.."
        
oPlayFALSE5.0
        
DeclareIntColor(255,255,255), DeclareIntColor(0,0,255),
        
0.2
        
vVector);



le script de repos à mettre sur l'event du module OnRest





Code PHP:

 
/*
sur la zone : 
- int hostile : type d'hostilité de la zone
- string SCRIPTREPOS : nom du script à executer
- int rencontre : DD de rencontre : par défaut 15
- string creature : resref des créature lors des rencontre. 
            par défaut "ktx_gob"
 
Tag WAYPOINT
civilisation : tag du WP de civilisation
PointEau : tag à mettre prêt de l'eau. Ce WP est utilisé pour le rechargement de la gourde d'eau
 
 
*/
 
#include "ktx_module_onrestinclude"
 
void main()
{
object oPCRested GetLastPCRested();
object oArea GetArea (oPCRested);
int iJetRencontre 15// le test de survie par défaut = 15
int iTempsNourriture //le temps en minutes pendant lequel la nourriture fait effet 
 
 
//DATABASE
/*
string sVariableBDDFaimMalus = GetName(oPCRested)+"RestFaimMalus";
string sVariableBDDSoifMalus = GetName(oPCRested)+"RestSoifMalus";
string sVariableBDDFaimDD = GetName(oPCRested)+"RestFaimDD";
string sVariableBDDSoifDD = GetName(oPCRested)+"RestSoifDD";
string SimaonBDD = "rest" + GetPCPlayerName(oPCRested); 
int iFaimVarMalus = GetCampaignInt (SimaonBDD,sVariableBDDFaimMalus,oPCRested);
int iSoifVarMalus = GetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,oPCRested);
int iFaimVarDD = GetCampaignInt (SimaonBDD,sVariableBDDFaimDD,oPCRested);
int iSoifVarDD = GetCampaignInt (SimaonBDD,sVariableBDDSoifDD,oPCRested);
*/
 
//OBJET PERSISTANT
string sVariableBDDFaimMalus ="MalusFaim" 
string sVariableBDDSoifMalus ="MalusSoif" 
string sVariableBDDFaimDD ="MalusFaimDD" ;  
string sVariableBDDSoifDD "MalusSoifDD";  
object oItemPersist GetItemPossessedBy  (oPCRested"persistant");  
int iFaimVarMalus GetLocalInt (oItemPersist,sVariableBDDFaimMalus);  
int iSoifVarMalus GetLocalInt (oItemPersist,sVariableBDDSoifMalus);  
int iFaimVarDD GetLocalInt (oItemPersist,sVariableBDDFaimDD);  
int iSoifVarDD GetLocalInt (oItemPersist,sVariableBDDSoifDD);  
 
//*********************************************
//*********************************************
switch (GetLastRestEventType())
{
//*********************************************
//*********************************************
case REST_EVENTTYPE_REST_STARTED:
{
FadeToBlack (oPCRested);
 
FloatingTestResting (oPCRested);
DelayCommand (1.5fFloatingTestResting (oPCRested));     
DelayCommand (3.0fFloatingTestResting (oPCRested));
 
 
// TU PEUX EFFACER TOUT CA !
// contrôle si le PJ a de la nourriture    
// si un objet avec le TAG "nourriture" est présent dans
// l'inventaire l'objet est détruit et la variable "faim" est à 1
// iFaim sert pour les messages ensuite, "faim" pour le malus appliqué
// "RestFaimDD" pour les futurs jets de constitution et "RestFaimMalus" pour le malus appliqué
// Les sauvegardes sont faites ici car les joueurs peuvent être dérangés
// lors de leur repos alors qu'ils ont mangé
 
    
object oNourriture GetItemPossessedBy(oPCRested,"nourriture");
    
int iRepas GetLocalInt (oPCRested,"DernierRepas");
    
int iFaim;
    if (
TimeControl(iRepas)<=iTempsNourriture)
        {
        
iFaim=1;
        
SetLocalInt (oPCRested"faim",1);
        
SendMessageToPC (oPCRested,"Votre dernier repas étant proche, vous n'avez pas besoin de manger pour le moment");
        }
    else 
            {
            if (
oNourriture == OBJECT_INVALID)
                {
                
SetLocalInt (oPCRested"faim",0);
                
iFaim 0;
                
iFaimVarDD iFaimVarDD+2;
                
//BDD
                //SetCampaignInt (SimaonBDD,sVariableBDDFaimDD,iFaimVarDD,oPCRested);
                
SetLocalInt (oItemPersist,sVariableBDDFaimDD,iFaimVarDD);
                
SendMessageToPC (oPCRested,"Jet de constitution contre la faim : ");
 
                if (
TestConstit(oPCRested,10+(iFaimVarDD))==TRUE)
                    {
                    
SetLocalInt (oPCRested"faim",1);
                    }
                else
                    {
                    
iFaimVarMalus iFaimVarMalus+1;
                    
//BDD
                    //SetCampaignInt (SimaonBDD,sVariableBDDFaimMalus,iFaimVarMalus,oPCRested);
                    
SetLocalInt (oItemPersist,sVariableBDDFaimMalus,iFaimVarMalus);
                    }
                }
            else 
                {
                
DestroyObject(oNourriture0.0);
                
SetLocalInt (oPCRested"faim",1);
                
iFaim 1;
                
//BDD
                //SetCampaignInt (SimaonBDD,sVariableBDDFaimDD,0,oPCRested);
                //SetCampaignInt (SimaonBDD,sVariableBDDFaimMalus,0,oPCRested);
                
SetLocalInt (oItemPersist,sVariableBDDFaimDD,0);
                
SetLocalInt (oItemPersist,sVariableBDDFaimDD,0);
                
int SetLocaliRepas = (GetTimeHour()*60)+ GetTimeMinute();
                
SetLocalInt (oPCRested,"DernierRepas",SetLocaliRepas);
                }
            }
 
 
 
// contrôle si le PJ a de quoi boire    
// si un objet avec le TAG "alcool" est present dans
// l'inventaire la bouteille d'alcool est détruite et la variable "soif" est à 1
// si un objet avec le TAG "boisson" est present dans
// l'inventaire l'objet perd une charge et la variable "soif" est à 2
// "RestSoif" est utilisé pour les futurs jets de constitution et le malus appliqué
// Les sauvegardes sont faites ici car les joueurs peuvent être dérangés
// lors de leur repos alors qu'ils ont bu
 
    
object oBoisson GetItemPossessedBy(oPCRested,"gourde_eau");
    if ((
oBoisson == OBJECT_INVALID)||(GetItemCharges (oBoisson) == 0)) oBoisson GetItemPossessedBy (oPCRested"boisson");
    
object oAlcool GetItemPossessedBy(oPCRested,"alcool");
    
int iSoif;
 
    if ((
oBoisson == OBJECT_INVALID)&&(oAlcool== OBJECT_INVALID))
        {
        
SetLocalInt (oPCRested"soif",0);
        
iSoif 0;
        
SendMessageToPC (oPCRested,"test de constitution contre la soif : ");
        
int TestSoifConstit 10+iSoifVarDD;
        if (
TestConstit(oPCRested,TestSoifConstit)==TRUE)
            {
            
SetLocalInt (oPCRested"soif",2);
            
iSoifVarDD iSoifVarDD +2;
            
//BDD
            //SetCampaignInt (SimaonBDD,sVariableBDDSoifDD,iSoifVarDD,oPCRested);
            
SetLocalInt (oItemPersist,sVariableBDDSoifDD,iSoifVarDD);
            }
        else 
            {
            
iSoifVarDD iSoifVarDD +2;
            
iSoifVarMalus iSoifVarMalus+2;
            
//BDD
            //SetCampaignInt (SimaonBDD,sVariableBDDSoifDD,iSoifVarDD,oPCRested);
            //SetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,iSoifVarMalus,oPCRested);
            
SetLocalInt (oItemPersist,sVariableBDDSoifDD,iSoifVarDD);
            
SetLocalInt (oItemPersist,sVariableBDDSoifMalus,iSoifVarMalus);
            }
        }
    else
         {
// contrôle si le joueur a de l'eau. si oui => "soif" = 2 et perte d'une charge sur la gourde
// si pas d'eau, contrôle la présence d'alcool. Si oui "soif" = 1
// si le joueur n'a rien, "soif" = 0
        
if (oBoisson != OBJECT_INVALID)
          {
         if (
GetTag (oBoisson) == "boisson")
            {
            
int iStackboiss GetItemStackSize(oBoisson);
            if (
iStackboiss == 1DestroyObject (oBoisson);
            else 
SetItemStackSize (oBoisson, (iStackboiss-1));
            
SetLocalInt (oPCRested"soif",2);
            
iSoif 2;
            }
         else
             {
             
int iPortion GetItemCharges (oBoisson);
             if (
iPortion 0)
                {
                
SetItemCharges (oBoisson,iPortion-1);
                
SetLocalInt (oPCRested"soif",2);
                
iSoif 2;
                
//BDD
                //SetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,0,oPCRested);
                //SetCampaignInt (SimaonBDD,sVariableBDDSoifDD,0,oPCRested);
                
SetLocalInt (oItemPersist,sVariableBDDSoifMalus,0);
                
SetLocalInt (oItemPersist,sVariableBDDSoifDD,0);
 
                if (
GetItemCharges(oBoisson)>0)
                    {
                    
int iPortionEau GetItemCharges(oBoisson)*500;
                    
SendMessageToPC (oPCRested,"il vous reste encore "+IntToString(iPortionEau)+" ml d'eau");
                    }
                }
              }
          }
         else if (
oAlcool != OBJECT_INVALID)
              {
            
int iStackAlcool GetItemStackSize(oAlcool);
            if (
iStackAlcool == 1DestroyObject (oAlcool);
            else 
SetItemStackSize (oAlcool, (iStackAlcool-1));
            
SetLocalInt (oPCRested"soif",1);
            
iSoif 1;
            
//BDD
            //SetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,0,oPCRested);
            //SetCampaignInt (SimaonBDD,sVariableBDDSoifDD,0,oPCRested);
            
SetLocalInt (oItemPersist,sVariableBDDSoifMalus,0);
            
SetLocalInt (oItemPersist,sVariableBDDSoifDD,0);
            if (
TestConstit(oPCRested,12)==TRUE)
                {
                
SetLocalInt (oPCRested"soif",2);
                }    
            }
         }
 
 
 
//    Test la zone : 
//  si "hostile" = 2 : zone sauvage. Pas de risque de rencontre si les joueurs 
//  se trouvent à moins de 40m d'un WP avec pour tag "civilisation"
//  si "hostile" = 1 : zone précaire. pas de rencontre mais campement obligatoire
//  si "hostile" = 0 : zone civilisée. Repos correct
//  si aucun PJ du groupe n'a réussi le test de survie, apparition de créatures
//  les zones hostiles sont les zones non habitées par des créatures amies
 
int iHostile GetLocalInt (oArea,"hostile");
 
// Lorsque la zone est hostile, il faut un campement de base, sinon 
// sinon le repos est précaire ==> ReposCamp = 0 si pas de camp de base
// pas de jet de sauvegarde pour le repos précaire
if  (iHostile >= 1)
    {
    
int iCampTest 0;
    
SetLocalInt (oPCRested,"ReposCamp",0);
    if (
TestCampementProche(oPCRested)==TRUE)
        {
        
SetLocalInt (oPCRested,"ReposCamp",1);
        
iCampTest 1;
        }
    if (
iHostile == 2)
        { 
        
object oCivilisation GetNearestObjectByTag ("civilisation"oPCRested);
        
float fDistance GetDistanceBetween (oCivilisationoPCRested);
        if ((
fDistance >= 40.0)||(fDistance == 0.0))
            {
            
int TestRencontre GetLocalInt (oArea,"rencontre");
            if (
TestRencontre iJetRencontre)    {TestRencontre iJetRencontre;}
            
int i TestSurvieRencontre(oPCRested,TestRencontre);
            if (
== FALSE)
                {
                
DelayCommand(1.0,CreateRencontrePendantRepos(oPCRested,oArea));
                }
            }
        }
}
 
 
 
// sauvegarde les messages envoyés au joueur
// les messages sont de 2 types : bon et mauvais
int iHostileCtrl GetLocalInt (oArea,"hostile");
string sMessageToPCRestedBenef "";
string sMessageToPCRestedMal "";
int Test;
if ((
iHostileCtrl >= 1)&&(GetLocalInt(oPCRested,"ReposCamp")==0))
    {
    
sMessageToPCRestedMal sMessageToPCRestedMal "Se reposer dans un lieu aussi hostile n'est pas de tout repos. ";
    }
if ((
iHostileCtrl >= 1)&&(GetLocalInt (oPCRested,"ReposCamp")==1))
    {
    
sMessageToPCRestedBenef sMessageToPCRestedBenef "Le campement que vous avez établi a été confortable. ";
    }
if (
iSoif==0)
    {
    
sMessageToPCRestedMal sMessageToPCRestedMal "La soif se fait ressentir fortement. ";
    }
if (
iSoif==1)
    {
    
sMessageToPCRestedMal sMessageToPCRestedMal "L'alcool, ça fait toujours du bien par où ça passe, malgré le mal aux cheveux ! ";
    }
if (
iSoif==2)
    {
    
sMessageToPCRestedBenef sMessageToPCRestedBenef "Boire avant de vous reposer vous a bien désaltéré. ";
    }
if (
iFaim==1)
    {
    
sMessageToPCRestedBenef sMessageToPCRestedBenef "Vous êtes suffisamment rassasié. ";
    }
if (
iFaim==0)
    {
    
sMessageToPCRestedMal sMessageToPCRestedMal "La faim vous tenaille. ";
    }
SetLocalString (oPCRested,"sMessageToPCRested",sMessageToPCRestedBenef sMessageToPCRestedMal);
}
 
break;
//*********************************************
//*********************************************
case REST_EVENTTYPE_REST_CANCELLED :
{    
ApplyEffectToObject(DURATION_TYPE_TEMPORARYEffectSlow(), oPCRested20.0f);
SendMessageToPC(oPCRested"Vous avez du mal à vous lever si promptement");
 
// Eventuel Malus si la zone est sauvage
MalusZoneSauvage(oArea,oPCRested);
 
// Controle de la faim et de la soif
MalusFaimSoif(oPCRested,iFaimVarMalus,iSoifVarMalus);
int iTestMortdeFaim GetLocalInt(oPCRested"faim");
if (
iTestMortdeFaim==7)
    {
    
//BDD
    //SetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,0,oPCRested);
    //SetCampaignInt (SimaonBDD,sVariableBDDFaimMalus,0,oPCRested);
    
SetLocalInt (oItemPersist,sVariableBDDSoifMalus,0);
    
SetLocalInt (oItemPersist,sVariableBDDFaimMalus,0);
    }
 
}
 
break;
//*********************************************
//*********************************************
 
case REST_EVENTTYPE_REST_INVALID :
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARYEffectSlow(), oPCRested10.0f);
 
// Eventuel Malus si la zone est sauvage
MalusZoneSauvage(oArea,oPCRested);
 
// Controle de la faim et de la soif
MalusFaimSoif(oPCRested,iFaimVarMalus,iSoifVarMalus);
int iTestMortdeFaim GetLocalInt(oPCRested"faim");
if (
iTestMortdeFaim==7)
    {
    
//BDD
    //SetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,0,oPCRested);
    //SetCampaignInt (SimaonBDD,sVariableBDDFaimMalus,0,oPCRested);
    
SetLocalInt (oItemPersist,sVariableBDDSoifMalus,0);
    
SetLocalInt (oItemPersist,sVariableBDDFaimMalus,0);
    }
}
 
break;
//*********************************************
//*********************************************
case REST_EVENTTYPE_REST_FINISHED:
{
    if((
GetLevelByClass(CLASS_TYPE_CLERIC,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_DRUID,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_SORCERER,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_PALADIN,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_RANGER,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_WIZARD,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_BARD,oPCRested) > 0) ||
            (
GetLevelByClass(CLASS_TYPE_ARCANE_ARCHER,oPCRested) > 0))
                {
                
// script de sauvegarde des sorts
                
ExecuteScript ("ktx_module_savepj_spell"oPCRested);
                }
 
ExportSingleCharacter (oPCRested);
 
//rajoute l'effet de lenteur à la fin du repos
ApplyEffectToObject(DURATION_TYPE_TEMPORARYEffectSlow(), oPCRested15.0f);
 
// Eventuel Malus si la zone est sauvage
MalusZoneSauvage(oArea,oPCRested);
 
// Controle de la faim et de la soif
MalusFaimSoif(oPCRested,iFaimVarMalus,iSoifVarMalus);
int iTestMortdeFaim GetLocalInt(oPCRested"faim");
if (
iTestMortdeFaim == 7)
    {
    
//BDD
    //SetCampaignInt (SimaonBDD,sVariableBDDSoifMalus,0,oPCRested);
    //SetCampaignInt (SimaonBDD,sVariableBDDFaimMalus,0,oPCRested);
    
SetLocalInt (oItemPersist,sVariableBDDSoifMalus,0);
    
SetLocalInt (oItemPersist,sVariableBDDFaimMalus,0);
    }
 
/* 
// save location
int iDonjon = GetLocalInt (GetArea(oPCRested), "donjon");
if (iDonjon==0) 
    {
    string sCampaign = "location" + GetPCPlayerName(oPCRested);
    string sVarLocation = GetName(oPCRested)+"location";
    location lPCEnterLoc = GetLocation (oPCRested);
    SetCampaignLocation (sCampaign,sVarLocation,lPCEnterLoc,oPCRested);
    }
*/
 
//envoi des messages au joueur qui s'est reposé
string sMessage GetLocalString(oPCRested,"sMessageToPCRested");
DelayCommand (2.0 SendMessageToPC (oPCRested,sMessage));
 
 
// si la zone a un script de repos, le script est exécuté    
string sScript GetLocalString (oArea,"SCRIPTREPOS");
if (
sScript != "")
    {
ExecuteScript (sScript,oPCRested);}
 
 
 
}
break;        
//*********************************************
//*********************************************
}
//*********************************************
//*********************************************


voilà.
Je te remercie de ton action, même si je ne suis pas un modeur d'un module particulié, tes scripts je suis certains ne manqueront pas de titiller la cervelle fondue d'autres scripteurs ()
Répondre

Connectés sur ce fil

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