NPC MAX HP SCRIPT
-
- Noob
- Posts: 8
- Joined: Mon Oct 02, 2006 8:28 am
- Contact:
NPC MAX HP SCRIPT
I can get it but you have to let me know to get it or not to get it cause it does work and it use leto script but it helps alot too and it is easier. Co want it yes or no?
-
- Noob
- Posts: 8
- Joined: Mon Oct 02, 2006 8:28 am
- Contact:
The Script
/* inc_setmaxhps
Step 1: on-client-enter, include this file and add this command:
MaxHitPointsPCEnter(GetEnteringObject());
Step 2: on-client-exit, include this file and add this command:
MaxHitPointsPCExit(GetExitingObject());
Step 3: Call this script from an NPC conversation
MaxHitPointsSetMax(GetPCSpeaker());
*/
const string PORTAL_IP = "420.420.420.420:5121"; // SERVER IP
const string NWN_VAULT_DIR = "/NWN/servervault"; // PATH TO SERVER VAULT
const string NWN_SOURCE_DIR = "/NWN/source"; // PATH TO CLASSES.2DA
string MaxHitPointsBicName(object oPC) {
string sChar, sBicName;
string sPCName = GetStringLowerCase(GetName(oPC));
int i, iNameLength = GetStringLength(sPCName);
for (i=0; i < iNameLength; i++) {
sChar = GetSubString(sPCName, i, 1);
if (TestStringAgainstPattern("(*a|*n|*w|'|-|_)", sChar)) {
if (sChar != " ") sBicName += sChar;
}
}
return GetStringLeft(sBicName, 16);
}
void MaxHitPointsPCEnter(object oPC) {
SetLocalString(oPC, "MaxHitPointsName", GetPCPlayerName(oPC));
DeleteLocalString(oPC, "MaxHitPointsScript");
int iOld = GetCampaignInt("MAXHPS", "MAX_HITPOINTS", oPC);
if (iOld > 0) {
int iChange = GetMaxHitPoints(oPC) - iOld;
object oPF;
if (iChange) {
oPF = GetObjectByTag("MAXHITPOINTS_PASS");
SendMessageToPC(oPC, "You gained " + IntToString(iChange) + " hit points from the Max Hit Points script.");
} else {
oPF = GetObjectByTag("MAXHITPOINTS_FAIL");
SendMessageToPC(oPC, "You failed to gain any hit points from the Max Hit Points script.");
}
DeleteCampaignVariable("MAXHPS", "MAX_HITPOINTS", oPC); // CLEAR DB
}
}
void MaxHitPointsPCExit(object oPC) {
string sScript = GetLocalString(oPC, "MaxHitPointsScript");
if (sScript != "") {
string sPath = GetLocalString(oPC, "MaxHitPointsName");
//sPath = NWN_VAULT_DIR+"/"+sPath+"/"+MaxHitPointsBicName(oPC)+".bic";
sPath = NWN_VAULT_DIR+"/"+sPath+"/";
if (sPath == "") WriteTimestampedLogEntry("MaxHitPoints Bic Path is Null");
sScript = "%char = '"+sPath+"'+FindNewestBic('"+sPath+"'); " + sScript;
//sScript = "%char= '"+sPath+"'; "+sScript;
sScript += "%char = '>'; ";
sScript += "close %char; ";
WriteTimestampedLogEntry("Leto Max HP Script >: "+sScript);
SetLocalString(GetModule(), "NWNX!LETO!SCRIPT", sScript);
string sScriptResult = GetLocalString(GetModule(), "NWNX!LETO!SCRIPT");
WriteTimestampedLogEntry("Leto Results <: "+sScriptResult);
}
}
void MaxHitPointsSetMax(object oPC) {
int iOld = GetCampaignInt("MAXHPS", "MAX_HITPOINTS", oPC);
if (iOld == 0) { // PC CAN RUN THIS SCRIPT
SetCampaignInt("MAXHPS", "MAX_HITPOINTS", GetMaxHitPoints(oPC), oPC);
string LS = "meta dir => '" + NWN_SOURCE_DIR + "'; $RDD = 0; for(/LvlStatList) { $HD = lookup 'classes', /~/LvlStatClass, 'HitDie'; if(/~/LvlStatClass == 37) { $RDD++; $HD = $RDD < 4 ? $HD : $RDD < 6 ? 8 : $RDD < 11 ? 10 : 12; } /~/LvlStatHitDie = $HD; }";
SetLocalString(oPC, "MaxHitPointsScript", LS);
SendMessageToPC(oPC,"Prepare to be Leto'ed...and thank Dragonsong!");
DelayCommand(2.0, ActivatePortal(oPC, PORTAL_IP, "", "", TRUE));
} else { // HP IS SET, JUST WAITING TO EXHALE (Should be hard to do)
SendMessageToPC(oPC, "You are already scheduled to run this script. Please be patient.");
}
}
//void main () {}
oh yea i dont know how to read these things so there you go
Step 1: on-client-enter, include this file and add this command:
MaxHitPointsPCEnter(GetEnteringObject());
Step 2: on-client-exit, include this file and add this command:
MaxHitPointsPCExit(GetExitingObject());
Step 3: Call this script from an NPC conversation
MaxHitPointsSetMax(GetPCSpeaker());
*/
const string PORTAL_IP = "420.420.420.420:5121"; // SERVER IP
const string NWN_VAULT_DIR = "/NWN/servervault"; // PATH TO SERVER VAULT
const string NWN_SOURCE_DIR = "/NWN/source"; // PATH TO CLASSES.2DA
string MaxHitPointsBicName(object oPC) {
string sChar, sBicName;
string sPCName = GetStringLowerCase(GetName(oPC));
int i, iNameLength = GetStringLength(sPCName);
for (i=0; i < iNameLength; i++) {
sChar = GetSubString(sPCName, i, 1);
if (TestStringAgainstPattern("(*a|*n|*w|'|-|_)", sChar)) {
if (sChar != " ") sBicName += sChar;
}
}
return GetStringLeft(sBicName, 16);
}
void MaxHitPointsPCEnter(object oPC) {
SetLocalString(oPC, "MaxHitPointsName", GetPCPlayerName(oPC));
DeleteLocalString(oPC, "MaxHitPointsScript");
int iOld = GetCampaignInt("MAXHPS", "MAX_HITPOINTS", oPC);
if (iOld > 0) {
int iChange = GetMaxHitPoints(oPC) - iOld;
object oPF;
if (iChange) {
oPF = GetObjectByTag("MAXHITPOINTS_PASS");
SendMessageToPC(oPC, "You gained " + IntToString(iChange) + " hit points from the Max Hit Points script.");
} else {
oPF = GetObjectByTag("MAXHITPOINTS_FAIL");
SendMessageToPC(oPC, "You failed to gain any hit points from the Max Hit Points script.");
}
DeleteCampaignVariable("MAXHPS", "MAX_HITPOINTS", oPC); // CLEAR DB
}
}
void MaxHitPointsPCExit(object oPC) {
string sScript = GetLocalString(oPC, "MaxHitPointsScript");
if (sScript != "") {
string sPath = GetLocalString(oPC, "MaxHitPointsName");
//sPath = NWN_VAULT_DIR+"/"+sPath+"/"+MaxHitPointsBicName(oPC)+".bic";
sPath = NWN_VAULT_DIR+"/"+sPath+"/";
if (sPath == "") WriteTimestampedLogEntry("MaxHitPoints Bic Path is Null");
sScript = "%char = '"+sPath+"'+FindNewestBic('"+sPath+"'); " + sScript;
//sScript = "%char= '"+sPath+"'; "+sScript;
sScript += "%char = '>'; ";
sScript += "close %char; ";
WriteTimestampedLogEntry("Leto Max HP Script >: "+sScript);
SetLocalString(GetModule(), "NWNX!LETO!SCRIPT", sScript);
string sScriptResult = GetLocalString(GetModule(), "NWNX!LETO!SCRIPT");
WriteTimestampedLogEntry("Leto Results <: "+sScriptResult);
}
}
void MaxHitPointsSetMax(object oPC) {
int iOld = GetCampaignInt("MAXHPS", "MAX_HITPOINTS", oPC);
if (iOld == 0) { // PC CAN RUN THIS SCRIPT
SetCampaignInt("MAXHPS", "MAX_HITPOINTS", GetMaxHitPoints(oPC), oPC);
string LS = "meta dir => '" + NWN_SOURCE_DIR + "'; $RDD = 0; for(/LvlStatList) { $HD = lookup 'classes', /~/LvlStatClass, 'HitDie'; if(/~/LvlStatClass == 37) { $RDD++; $HD = $RDD < 4 ? $HD : $RDD < 6 ? 8 : $RDD < 11 ? 10 : 12; } /~/LvlStatHitDie = $HD; }";
SetLocalString(oPC, "MaxHitPointsScript", LS);
SendMessageToPC(oPC,"Prepare to be Leto'ed...and thank Dragonsong!");
DelayCommand(2.0, ActivatePortal(oPC, PORTAL_IP, "", "", TRUE));
} else { // HP IS SET, JUST WAITING TO EXHALE (Should be hard to do)
SendMessageToPC(oPC, "You are already scheduled to run this script. Please be patient.");
}
}
//void main () {}
oh yea i dont know how to read these things so there you go