Si ca peux aider quelqu un je vous propose mes scripts de mort/saignement ainsi que mes scripts de repos.
Ces scripts de sont pas tous de moi, certain oui, d autre en partie bref c est une compile adaptée
Le principe :
1) Une dizaine de minute entre les repos et necessaire
2) Le perso tombe inconscient entre 0 et -10 pts de vie, ensuite il est mort. Dans ce cas perte de 50 pt d ex multiplié par le niveau du perso et perte de 10% de l or.
3) en cas de mort, on respawn au dernier endroit ou le perso c est reposé, une tombe apparait a son point de mort ( juste pour le fun).
4) en cas de reboot du serveur, le perso se retrouve teleporté a son dernier point de repos.
Les scripts :
A placer sur le onrest :
//:://////////////////////////////////////////////
//:: Created By: Jonas Boberg aka. zimero
//:: Created On: 20021212
//:: Modified On: 20030107
//:://////////////////////////////////////////////
//USER ADJUSTABLE VARIABLES
//the number of hours the players must wait between full rests
//*
int TIMEBETWEENRESTING=5;
//do you want to display the time until next rest in real world minutes?
//(default: game hours)
//*
int REALTIMEMINUTES=1;
//END USER ADJUSTABLE VARIABLES
//*
int CurrentTime();
void main()
{
//initiate the variables
//*
object oPC = GetLastPCRested();
int iCurrentTime, iLastRestTime, iTimeSinceRest, iTimeUntilRest;
float fTimePenalty;
switch (GetLastRestEventType())
{
case REST_EVENTTYPE_REST_STARTED:
//get the current time
//*
iCurrentTime = CurrentTime();
//gets the last time the player rested
//*
iLastRestTime = GetLocalInt(oPC,"REST_HOUR");
//the time (in hours) since the last rest
//*
iTimeSinceRest = iCurrentTime-iLastRestTime;
//stores the second the player begins to rest
//*
SetLocalInt(oPC, "REST_SECOND", GetTimeSecond());
//if the player has never rested before or if the
//necessary time has passed, allow the player to rest
//*
if (iLastRestTime==0 || iTimeSinceRest >= TIMEBETWEENRESTING)
{
SetLocalInt(oPC, "REST_ALLOWED", TRUE);
//*
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:://////////////////////////////////////////////
//*
#include "nw_i0_plot"
#include "ginc_death"
// Reset reputation
//*
void main()
{
object oPlayer = GetLastPlayerDied();
object oKiller = GetLastHostileActor(oPlayer);
AssignCommand(oPlayer, ClearAllActions());
// * make friendly to Each of the 3 common factions
//*
if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
}
if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
{ SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
}
location oLoc = GetLocation(oPlayer);
object oTombe = CreateObject(OBJECT_TYPE_PLACEABLE,"tombe_joueur",oLoc);
// affiche l ecran de respawn
//*
oPlayer = GetLastPlayerDied();
ShowDeathScreen(oPlayer, TRUE, TRUE, FALSE, TRUE);
SetIsDeathPopUpDisplayed(oPlayer, TRUE);
}
Modifier le gui_death_respawn comme ceci :
//::///////////////////////////////////////////////
//:: Generic On Pressed Respawn Button
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: November
//:://////////////////////////////////////////////
#include "nw_i0_plot"
#include "ginc_death"
#include "ginc_behavior"
// * Applies an XP and GP penalty
// * to the player respawning
//*
void ApplyPenalty(object oDead)
{
int nXP = GetXP(oDead);
int nPenalty = 50 * 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);
int nGoldToTake = FloatToInt(0.10 * GetGold(oDead));
// * a cap of 10 000gp taken from you
//*
if (nGoldToTake > 10000)
{
nGoldToTake = 10000;
}
AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
DelayCommand(8.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
DelayCommand(8.2, FloatingTextStrRefOnCreature(58300, oDead, FALSE));
}
void main()
{
object oRespawner = OBJECT_SELF;
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
ApplyPenalty(oRespawner);
//*---------------------------------------------
//* teleport au dernier point de rest
//*----------------------------------------------
object oPC =oRespawner;
object oTarget;
location lTarget;
string name = GetName(oPC) ;
oTarget = GetWaypointByTag(name);
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)!=OBJECT_INVALID)
{
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
}
//* fin teleport
RemoveDeathScreens( oRespawner );
effect eGroggy = EffectDazed();
DelayCommand(0.1,ApplyEffectToObject( DURATION_TYPE_TEMPORARY, eGroggy, oRespawner, RoundsToSeconds( 5 ) ));
oTarget = oRespawner;
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT)
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));
}
A placer sur le client on enter
void main ()
{
//*---------------------------------------------
//* teleport au dernier point de rest
//*----------------------------------------------
object oPC =GetEnteringObject();
object oTarget;
location lTarget;
string name = GetName(oPC) ;
oTarget = GetWaypointByTag(name);
lTarget = GetLocation(oTarget);
if (GetAreaFromLocation(lTarget)!=OBJECT_INVALID)
{
DelayCommand(30.0,AssignCommand(oPC, ClearAllActions()));
DelayCommand(31.0,AssignCommand(oPC, ActionJumpToLocation(lTarget)));
//* fin teleport
}
}
Voili voilou, si ca peut aider