void ProcessDialogEvent()
{
ref NPChar;
aref Link, Diag;
DeleteAttribute(&Dialog,"Links");
makeref(NPChar,CharacterRef);
makearef(Link, Dialog.Links);
makearef(Diag, NPChar.Dialog);
ref PChar;
PChar = GetMainCharacter();
int loc_id = FindLocation(PChar.location);
string nationme, nationhim;
int maxCrewquantity = GetMaxCrewQuantity(PChar);
int maxcrew = GetMaxLandCrew(sti(PChar.Ship.Crew.Quantity));
switch(Dialog.CurrentNode)
{
case "exit":
Diag.CurrentNode = Diag.TempNode;
DialogExit();
//if(Npchar.middlename!=""){LAi_tmpl_SetFollow(Npchar, CharacterFromId(Npchar.middlename), 120000);}
break;
case "first time":
Dialog.defAni = "dialog_stay1";
Dialog.defCam = "1";
Dialog.defSnd = "dialogs\0\017";
Dialog.defLinkAni = "dialog_1";
Dialog.defLinkCam = "1";
Dialog.defLinkSnd = "dialogs\woman\024";
Dialog.ani = "dialog_stay2";
Dialog.cam = "1";
Dialog.snd = "voice\PADI\PADI001";
MyFlag = GetCurrentFlag();
int MyNation = PERSONAL_NATION;
int MyFlag = GetCurrentFlag();
if(GetFlagRMRelation(sti(Npchar.nation)) <= REL_WAR && rand(10)>8) //MT: if you're at war with the nation the sailor belongs to
{
if (frnd() < GetChanceDetectFalseFlag()
{
switch(makeint(Npchar.nation))
{
case 0 : LAi_group_SetRelation("ENGLAND_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_068.wav");}nationhim="english";break;
case 1 : LAi_group_SetRelation("FRANCE_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_a_065.wav");}nationhim="french";break;
case 2 : LAi_group_SetRelation("SPAIN_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_057.wav");}nationhim="spanish";break;
case 4 : LAi_group_SetRelation("DOUWESEN_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_058.wav");}nationhim="dutch";break;
case 5 : LAi_group_SetRelation("CONCEICAO_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_a_056.wav");}nationhim="portuguese";break;
case 6 : LAi_group_SetRelation("AMERICA_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_068.wav");}nationhim="english";break;
}
LAi_group_SetRelation(LAI_GROUP_GUARDS, LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
Dialog.Text = DLG_TEXT[13] + GetMyFullName(PChar) + DLG_TEXT[14];
Link.l1 = DLG_TEXT[15] + NationHim + DLG_TEXT[16];
Link.l1.go = "exit";
LAi_group_SetRelation("random_sailors_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
if(GetRMRelation(PChar, PIRATE) >= REL_NEUTRAL)
{
LAi_group_SetRelation("random_pirates_group", "random_sailors_group", LAI_GROUP_ENEMY);
}
if(loc_id != -1 && locations[loc_id].type == "tavern")
{
LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
Random_Raid("soldiers", 5, makeint(NPchar.nation),"enemy","friend","");
}
}
else
{
if (IsInServiceOf(PIRATE)) // PB: Link this to acting as a pirate MT: modified as of 15-12-2015. Same functionality
{
Dialog.Text = DLG_TEXT[10] + GetMyFullName(PChar) + DLG_TEXT[11];
Link.l1 = RandSwear() + DLG_TEXT[12];
Link.l1.go = "exit";
switch(makeint(Npchar.nation))
{
case 0 : LAi_group_SetRelation("ENGLAND_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_052.wav");}break;
case 1 : LAi_group_SetRelation("FRANCE_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_a_052.wav");}break;
case 2 : LAi_group_SetRelation("SPAIN_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_043.wav");}break;
case 4 : LAi_group_SetRelation("DOUWESEN_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_043.wav");}break;
case 5 : LAi_group_SetRelation("CONCEICAO_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_a_043.wav");}break;
case 6 : LAi_group_SetRelation("AMERICA_SOLDIERS", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_052.wav");}break;
}
LAi_group_SetRelation(LAI_GROUP_GUARDS, LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
LAi_group_SetRelation("random_sailors_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
if(loc_id != -1 && locations[loc_id].type == "tavern")
{
LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
Random_Raid("soldiers", 5, makeint(NPchar.nation),"enemy","friend","");
}
}
else
{
switch(mynation)
{
case 0 : nationme="english";break;
case 1 : nationme="french";break;
case 2 : nationme="spanish";break;
case 3 : nationme="pirate";break;
case 4 : nationme="dutch";break;
case 5 : nationme="portuguese";break;
case 10 : nationme="pirate";break;
}
LAi_group_SetRelation("random_sailors_group", LAI_GROUP_PLAYER, LAI_GROUP_ENEMY);
switch(makeint(Npchar.nation))
{
case 0 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_a_052.wav");}nationhim="english";break;
case 1 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_a_052.wav");}nationhim="french";break;
case 2 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_043.wav");}nationhim="spanish";break;
case 4 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_043.wav");}nationhim="dutch";break;
case 5 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_a_043.wav");}nationhim="portuguese";break;
}
Dialog.Text = DLG_TEXT[17] + nationhim + DLG_TEXT[18] + nationme + DLG_TEXT[19];
Link.l1 = DLG_TEXT[20] + NationHim + DLG_TEXT[21];
Link.l1.go = "exit";
if(loc_id != -1 && locations[loc_id].type == "tavern")
{
LAi_LocationFightDisable(&locations[FindLocation(Pchar.location)], false);
}
}
}
}
else //MT: If you're NOT at war with the nation the sailor belongs to
{
if (HaveLetterOfMarque(sti(Npchar.nation)))
{
if(frnd()<makefloat(GetRankFromPoints(GetScore(PChar)))/12.0) //MT: LoM with sailor's nation and famous
{
Dialog.Text = DLG_TEXT[0];
}
else
{
Dialog.Text = DLG_TEXT[1]; //MT: If LoM, but not famous
}
if(Pchar.Ship.Crew.Quantity<maxCrewquantity)
{
Link.l1 = DLG_TEXT[2];
Link.l1.go = "engage";
Link.l2 = DLG_TEXT[3];
Link.l2.go = "exit";
}
else
{
Link.l1 = DLG_TEXT[4];
Link.l1.go = "exit";
}
switch(makeint(Npchar.nation))
{
case 0 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_b_080.wav");}break;
case 1 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_c_073.wav");}break;
case 2 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_004.wav");}break;
case 3 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_a_062.wav");}break;
case 4 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_068.wav");}break;
case 5 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_b_062.wav");}break;
}
}
else //MT: if you don't have a LoM with the nation the sailor belongs to, and you're not at war with it
{
if(frnd()<makefloat(GetRankFromPoints(GetScore(PChar)))/12.0)
{
Dialog.Text = DLG_TEXT[0];
}
else
{
Dialog.Text = DLG_TEXT[30]; //MT: String of dialogue added for when you don't serve the crown, as line 1 would imply
}
if(Pchar.Ship.Crew.Quantity<maxCrewquantity)
{
Link.l1 = DLG_TEXT[2];
Link.l1.go = "engage";
Link.l2 = DLG_TEXT[3];
Link.l2.go = "exit";
}
else
{
Link.l1 = DLG_TEXT[4];
Link.l1.go = "exit";
}
switch(makeint(Npchar.nation))
{
case 0 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Eng_m_b_080.wav");}break;
case 1 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Fre_m_c_073.wav");}break;
case 2 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Spa_m_b_004.wav");}break;
case 3 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_a_062.wav");}break;
case 4 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Dut_m_a_068.wav");}break;
case 5 : if(Npchar.sex=="man"){PlaySound("VOICE\" + LanguageGetLanguage() + "\Por_m_b_062.wav");}break;
}
}
}
Diag.TempNode = "first time";
break;