After a chance encounter...
Neverwinter Nights Multiplayer Server 24x7 Now with NWN and NWN:EE :: NWN1 - AL DOHRAL - Server(s) :: BETA-TEST Feedback
Page 1 of 1
After a chance encounter...
I bumped into Ehye Kandee in the lobby and promised I'd share... well here it is.
One thing I noticed straight off when I entered ArgentumRegio is the use of items to track lives. In my own project, that contains a similar perma-death system, I totally did away with 'clumsy' item use in favor of a persistent value, tracked via NBDE
I do not have access to the AR builder's mod, so I do not know exactly how you have your scripts organized or what have you, so I will present the code, and leave it to you to integrate.
Step One:: the CONST INT
In the original scripts, these were locals set on the mod, I prefer a looser interpretation and use 'const' in the ruleset config file. If you intend to follow my example, you will need to include these as well.
Step Two: OnEnter
This function needs to be included iinto the OnEnter Event. My own onenter event contains many thing outside of the subject of this script, so I only present the function below. ColorToOne () is used synonymously with SendMessageToPC ()... I like colored text, so I use it through out my code.... its a personal thing. Change it if you don't have the original function (by RiffRaff).
The 'NewSoul' function MUST only be called once per PC and must #include "nbde_inc" or whatever you may have renamed Knat's code
Step Three :: OnRespawn Function
This next section needs to be incorporated into the respawn event. It gives a little feedback and has a random chance for divine intervention.... that check could easily be expanded to play off a deity system if you have one...
The SendMessageToAllPC function is a looping ColorToOne () that sends it to all PCs...
Step Four: Awarding Additional Lives
Do it by items, do it on level up, do it up as part of a quest, what ever. Whenever extreme heroic effort is required, increase the LIVES persistent value.
Yeh. There it is, hope I explained that well enough and that you find some use for it.
- 9fires
One thing I noticed straight off when I entered ArgentumRegio is the use of items to track lives. In my own project, that contains a similar perma-death system, I totally did away with 'clumsy' item use in favor of a persistent value, tracked via NBDE
I do not have access to the AR builder's mod, so I do not know exactly how you have your scripts organized or what have you, so I will present the code, and leave it to you to integrate.
Step One:: the CONST INT
In the original scripts, these were locals set on the mod, I prefer a looser interpretation and use 'const' in the ruleset config file. If you intend to follow my example, you will need to include these as well.
CAP wrote:
const int LIVES = 9;// Number of Lives
const int LIVES_LOST = 6;// Level at which the PC starts losing Lives
Step Two: OnEnter
This function needs to be included iinto the OnEnter Event. My own onenter event contains many thing outside of the subject of this script, so I only present the function below. ColorToOne () is used synonymously with SendMessageToPC ()... I like colored text, so I use it through out my code.... its a personal thing. Change it if you don't have the original function (by RiffRaff).
The 'NewSoul' function MUST only be called once per PC and must #include "nbde_inc" or whatever you may have renamed Knat's code
CAP wrote:
//:**************************************************************************:\\
//New character are assigned a number of Lives.
void NewSoul(object oPC)
{
if (CAP_DEATH != 1) return;//Master On/Off Switch
object oPC = OBJECT_SELF;
string sDB = WORLD_DATABASE();//A string to identify the database used, change to your PC tracking DB
int nLives = LIVES;
int nCurrentLives = NBDE_GetCampaignInt(sDB, "LIVES", oPC);
//If the PC is a new character give them Lives, elsewise ignore...
int nNew = 0;
if (nCurrentLives != 0 && nCurrentLives <= 9) nNew = 1;
if (nNew == 0) NBDE_SetCampaignInt(sDB, "LIVES", nLives, oPC);
if (CAP_MASTER_DEBUG == 1) {
ColorToOne (oPC, "You have "+IntToString (NBDE_GetCampaignInt (sDB, "LIVES", oPC))
+" Lives. After your sixth season, you will begin to lose your lives each time you respawn.");
}
ColorToOne (oPC, "You have "+IntToString (NBDE_GetCampaignInt (sDB, "LIVES", oPC))+" Lives.");
return;
}
Step Three :: OnRespawn Function
This next section needs to be incorporated into the respawn event. It gives a little feedback and has a random chance for divine intervention.... that check could easily be expanded to play off a deity system if you have one...
CAP wrote:
//:**************************************************************************:\\
int nDeaths = NBDE_GetCampaignInt(WORLD_DATABASE(), "TIMES_DIED", oPC);//Times Dies
int nLives = NBDE_GetCampaignInt(WORLD_DATABASE(),"LIVES", oPC);//Lives Remaining
nDeaths = nDeaths+1;
NBDE_SetCampaignInt (WORLD_DATABASE(), "TIMES_DIED", nDeaths, oPC);
string sS;
if (nDeaths > 1) sS = "times";
else sS = "time";
SendMessageToPC (oPC, StringToRGBString("You have died ", STRING_COLOR_RED)+IntToString(nDeaths)+" "+sS);
//: Dealing with lives
int nDead = FALSE;
int nLivesLost = LIVES_LOST;//level at which we start to lose lives, see config
if(GetHitDice(oPC) > nLivesLost) {
int pSex = GetGender (oPC);
string sSex1, sSex2;
switch (pSex)
{
case GENDER_FEMALE:
sSex1 = "her"; sSex2 = "She";
break;
case GENDER_MALE:
sSex1 = "his"; sSex2 = "He";
break;
}
if (GetLocalInt (oPC, "IMMORTAL") != TRUE){
int nDivineIntervention = Random (100)+1;
int nSaved = 0;
if (nDivineIntervention >= 90) nSaved = 1;
if (nLives == 0) nSaved = 2;
switch (nSaved)
{
case [You must be registered and logged in to see this link.]
nLives = nLives-1;
NBDE_SetCampaignInt (WORLD_DATABASE(), "LIVES", nLives, oPC);
if (nLives == 0) ColorToOne (oPC, "You have but this life remaining to you. You must be careful, for the next time you fall shall be your final time.");
break;
case [You must be registered and logged in to see this link.] Intervention
ColorToOne (oPC, "The gods have blessed you, sparing you the loss of a Life.");
break;
case [You must be registered and logged in to see this link.]
nDead = TRUE;
break;
}
}//EoIMMORTAL
}//EoLIVESLOST
The SendMessageToAllPC function is a looping ColorToOne () that sends it to all PCs...
CAP wrote:
void SendMessageToAllPCs(string sMessage)
{
SendMessageToAllDMs (sMessage);
object oPC = GetFirstPC();
while(GetIsObjectValid(oPC))
{
if (GetIsPC(oPC)) ColorToOne(oPC, sMessage);
oPC = GetNextPC();
}
}
Step Four: Awarding Additional Lives
Do it by items, do it on level up, do it up as part of a quest, what ever. Whenever extreme heroic effort is required, increase the LIVES persistent value.
Yeh. There it is, hope I explained that well enough and that you find some use for it.
- 9fires
9fires- New Member
- Number of posts : 2
Registration date : 2010-01-28
Neverwinter Nights Multiplayer Server 24x7 Now with NWN and NWN:EE :: NWN1 - AL DOHRAL - Server(s) :: BETA-TEST Feedback
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|