Aelor
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Aelor

Forum officiel du module NeverWinter Nights et role play Aelor.
 
AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
Le Deal du moment : -40%
Tefal Ingenio Emotion – Batterie de cuisine 10 ...
Voir le deal
59.99 €

 

 Respawn

Aller en bas 
AuteurMessage
Gimli Oakenshield
L'ignorant en Hardware
Gimli Oakenshield


Nombre de messages : 783
Localisation : Près de mon ordi !
Date d'inscription : 15/12/2005

Respawn Empty
MessageSujet: Respawn   Respawn EmptySam 15 Sep - 11:23

Voici les deux premier scripts.

Le premier est a mettre dans : Script déclenché par la mort du PJ

Code:
const string GUI_DEFAULT_DEATH_SCREEN = "SCREEN_DEATH_DEFAULT";

// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer );

void main()
{
   object oPlayer = GetLastPlayerDied();
   
   // * increment global tracking number of times that I died
   SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);

   DelayCommand( 2.5f, ShowDefaultDeathScreen( oPlayer ) );
}

void ShowDefaultDeathScreen( object oPlayer )
{
   DisplayGuiScreen( oPlayer, GUI_DEFAULT_DEATH_SCREEN, FALSE );
}

Le second est a mettre dans : script déclenché par le spawn du PJ
Comme d'habitude les variables modifiables sont clairement indiquées au début, pour l'intant les valeurs par défaut sont :
WayPoint d'arrivée : A définir
Xp/lvl perdu : 50
or perdu : 10 %

Code:
#include "nw_i0_plot"

// Variables modifiables :

string sDestTag =  ""; // Ici mettre le Tag du WayPoint d'arrivée dans la crypte
int iXpParLvl = 50; // ici le nombre d'xp perdus par lvl
int iPourcentOr = 10;// ici le pourcentage d'or perdu

// Déclaration des fonctions :

void ApplyPenalty(object oDead)
{
    int nXP = GetXP(oDead);
    int nPenalty = iXpParLvl * GetHitDice(oDead);
    int nHD = GetHitDice(oDead);
    // * You can not lose a level with this respawning
    int nMin = ((nHD * (nHD - 1)) / 2) * 1000;

    int nNewXP = nXP - nPenalty;
    if (nNewXP < nMin)
      nNewXP = nMin;
    SetXP(oDead, nNewXP);
   float fPourcentOr = IntToFloat(iPourcentOr/100);
    int nGoldToTake =    FloatToInt(fPourcentOr * GetGold(oDead));
    // * a cap of 10 000gp taken from you
    if (nGoldToTake > 10000)
    {
        nGoldToTake = 10000;
    }
    AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
    DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
    DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));

}

//Début du script
void main()
{
    object oRespawner = GetLastRespawnButtonPresser();
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
    RemoveEffects(oRespawner);
    //* Return PC to temple

   if (GetIsObjectValid(GetObjectByTag(sDestTag)))
    {
   
        ApplyPenalty(oRespawner);
      object oSpawnPoint = GetObjectByTag(sDestTag);
        AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
    }
    else
    {
   
    }
 }
Revenir en haut Aller en bas
 
Respawn
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Respawn
» Bug du respawn

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Aelor :: Editeur :: Scripts-
Sauter vers: