generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit
This commit is contained in:
132
_module/nss/sf_score.nss
Normal file
132
_module/nss/sf_score.nss
Normal file
@@ -0,0 +1,132 @@
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
// Get the first player
|
||||
object oPC = GetPCSpeaker();
|
||||
//object oPC = GetFirstPC();
|
||||
object oMod = GetModule();
|
||||
float fPerc;
|
||||
int iHeav;
|
||||
int iHell;
|
||||
int iDied;
|
||||
int iKilled;
|
||||
int hVLoss;
|
||||
int hLLoss;
|
||||
int iHit;
|
||||
int iPCdamage;
|
||||
int iHvcas;
|
||||
int iHlcas;
|
||||
int iHvTotCas;
|
||||
int iHlTotCas;
|
||||
int aDamage;
|
||||
int iDice;
|
||||
int iSwing;
|
||||
int iHitPerc;
|
||||
int iHWkills;
|
||||
int iHWdeaths;
|
||||
int iHWdam;
|
||||
int iHWhit;
|
||||
int iHWswing;
|
||||
int aScore;
|
||||
int iHWPCkillTot;
|
||||
int iHWPCdeathTot;
|
||||
int iSwitch = GetLocalInt(oMod, "score_switch");
|
||||
int iChamp = GetLocalInt(oPC, "champ_won");
|
||||
|
||||
string sPRes2;
|
||||
string sPRes;
|
||||
string oRank;
|
||||
string oDam;
|
||||
string iMessage;
|
||||
string SpeakText;
|
||||
string sChamp = GetLocalString(oMod, "sChamp");
|
||||
|
||||
PlaySound("gui_select");
|
||||
|
||||
//generate message
|
||||
|
||||
iDice = d8();
|
||||
switch(iDice)
|
||||
{
|
||||
case 1: {iMessage = "Victory is written in blood!";}break;
|
||||
case 2: {iMessage = "Winning a war is about making others die for their country!";}break;
|
||||
case 3: {iMessage = "A stained soul is a remorseless weapon!";}break;
|
||||
case 4: {iMessage = "Honour and glory are mortal enemies!";}break;
|
||||
case 5: {iMessage = "A strong sword is useless to a weak heart!";}break;
|
||||
case 6: {iMessage = "A blunt sword and a sharp wit are better than the converse!";}break;
|
||||
case 7: {iMessage = "Love and war know nothing true of each other!";}break;
|
||||
case 8: {iMessage = "Good and evil can not exist without each other!";}break;
|
||||
case 9: {iMessage = "The blood of the earth begets the blood of mankind!";}break;
|
||||
case 10: {iMessage = "Indifference is the true enemy of hatred!";}break;
|
||||
}
|
||||
if (iChamp==1)
|
||||
{iMessage = "Congratulations! You are the Holy War Champion";}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// initialise stat integers
|
||||
|
||||
iDied = GetLocalInt (oPC,"iDied");
|
||||
iKilled = GetLocalInt (oPC,"iKilled");
|
||||
iPCdamage = GetLocalInt(oPC, "player_dd");
|
||||
iHit = GetLocalInt(oPC, "pc_hit");
|
||||
iSwing = GetLocalInt(oPC, "pc_swing");
|
||||
aScore = GetLocalInt(oPC, "a_score");
|
||||
|
||||
|
||||
|
||||
// Calculate average damage (divide by zero will crash the script)
|
||||
|
||||
if (iHit!=0)
|
||||
{aDamage = iPCdamage / iHit;}
|
||||
else {aDamage = 0;}
|
||||
|
||||
// Calculate Hit %
|
||||
|
||||
if (iSwing!=0)
|
||||
{
|
||||
fPerc = (IntToFloat(iHit) / IntToFloat(iSwing)) * 100.0;
|
||||
iHitPerc = FloatToInt(fPerc);
|
||||
|
||||
}
|
||||
else
|
||||
{iHitPerc=0;}
|
||||
|
||||
|
||||
|
||||
// generate text for scoreboard
|
||||
|
||||
SpeakText = "\n====================\n";
|
||||
SpeakText += GetName(oPC);
|
||||
SpeakText += "\n--------------------\n";
|
||||
SpeakText += "Rank: ";
|
||||
SpeakText += GetLocalString(oPC, "rank");
|
||||
SpeakText += "\n\nKills: ";
|
||||
SpeakText += IntToString(iKilled);
|
||||
SpeakText += "\nDeaths: ";
|
||||
SpeakText += IntToString(iDied);
|
||||
SpeakText += "\nHits: ";
|
||||
SpeakText += IntToString(iHit);
|
||||
SpeakText += "\nAccuracy: ";
|
||||
SpeakText += IntToString(iHitPerc);
|
||||
SpeakText += "%";
|
||||
SpeakText += "\nTotal Damage: ";
|
||||
SpeakText += IntToString(iPCdamage);
|
||||
SpeakText += "\nAverage Damage: ";
|
||||
SpeakText += IntToString(aDamage);
|
||||
SpeakText += "\nArena Score: ";
|
||||
if (aScore==0){ SpeakText += "NCC";}
|
||||
else {SpeakText += IntToString(aScore);}
|
||||
SpeakText += "\n\n--------------------\n";
|
||||
//SpeakText += iMessage;
|
||||
|
||||
// Display the scoreboard details
|
||||
|
||||
SpeakString(SpeakText);
|
||||
}
|
||||
|
||||
// <StartAction>[Reset Holy War Scores]</Start> <StartHighlight>[Reset Holy War Scores]</Start>
|
||||
Reference in New Issue
Block a user