Ancordia_PRC8/_module/nss/tourn_sign.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

60 lines
2.2 KiB
Plaintext

#include "quest_inc"
void main()
{
string sDB = GetLocalString(GetModule(), "DB");
int nStart = GetCampaignInt(sDB, "ALVERTON_EVENT_START");
object oPC = GetPCSpeaker();
string sCharDB = CharacterDB(oPC);
//Let's delete previous tournament data for this PC
DeleteCampaignVariable(sCharDB, "TOUR_START");
DeleteCampaignVariable(sCharDB, "TOUR_ROUND");
DeleteCampaignVariable(sCharDB, "TOUR_NAME1");
DeleteCampaignVariable(sCharDB, "TOUR_NAME2");
DeleteCampaignVariable(sCharDB, "TOUR_NAME3");
DeleteCampaignVariable(sCharDB, "TOUR_NAME4");
DeleteCampaignVariable(sCharDB, "TOUR_SKILL1");
DeleteCampaignVariable(sCharDB, "TOUR_SKILL2");
DeleteCampaignVariable(sCharDB, "TOUR_SKILL3");
DeleteCampaignVariable(sCharDB, "TOUR_SKILL4");
DeleteCampaignVariable(sCharDB, "TOUR_RESREF1");
DeleteCampaignVariable(sCharDB, "TOUR_RESREF2");
DeleteCampaignVariable(sCharDB, "TOUR_RESREF3");
DeleteCampaignVariable(sCharDB, "TOUR_RESREF4");
//Time to generate new tournament data
int nTemplate;
string sName;
int nSkill;
int i;
//This loop will generate four opponents the PC will face (hopefully all of them!)
for (i=1; i<=4; i++)
{
nTemplate = Random(5)+1;
if (nTemplate >= 4) sName = GenerateNPCName("f", "hu");
else sName = GenerateNPCName("m", "hu");
sName += " "+GenerateNPCLastName("hu");
switch (i)
{
case 1: nSkill = Random(11); break;
case 2: nSkill = Random(10)+6; break;
case 3: nSkill = Random(10)+14; break;
case 4: nSkill = Random(10)+31; break;
}
//Special scenario - the final opponent might be Davlin Ashwalker
if (i == 4 && Random(10) == 0)
{
nTemplate = 6;
nSkill = 50;
sName = "Sir Davlin Ashwalker";
}
SetCampaignString(sCharDB, "TOUR_NAME"+IntToString(i), sName);
SetCampaignString(sCharDB, "TOUR_RESREF"+IntToString(i), "tour_"+IntToString(nTemplate));
SetCampaignInt(sCharDB, "TOUR_SKILL"+IntToString(i), nSkill);
}
SetCampaignInt(sCharDB, "TOUR_START", nStart);
SetCampaignInt(sCharDB, "TOUR_ROUND", 1);
}