I build a script to create an officer to a designated place, the character is spawning at the right place, he got the equipment I give him and can talk to him np, the problem is that I want the character to be a certain rank and not a random. Everytime I recruit him he is never at the same rank and on top of that I can't change is skills or ability. I'm gonna put the script here so if you guys can help, I will really appreciated.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void ProcessDialogEvent()
{
ref NPChar, PChar, d;
PChar = GetMainCharacter();
aref Link, Diag;
string NPC_Meeting;
DeleteAttribute(&Dialog,"Links");
makeref(NPChar,CharacterRef);
makearef(Link, Dialog.Links);
makeref(d, Dialog);
makearef(Diag, NPChar.Dialog);
string iDay, iMonth;
iDay = environment.date.day;
iMonth = environment.date.month;
string lastspeak_date = iday + " " + iMonth;
switch(Dialog.CurrentNode)
{
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 = "dialogs\0\009";
d.Text = DLG_TEXT[0] + PChar.name;
Link.l1 = DLG_TEXT[1]
Link.l1.go = "continue";
break;
case "continue":
d.Text = DLG_TEXT[2];
Link.l1 = DLG_TEXT[3];
Link.l1.go = "continue2";
break;
case "continue2":
d.Text = DLG_TEXT[4];
Link.l1 = DLG_TEXT[5];
Link.l1.go = "ShowSkills";
break;
case "ShowSkills":
PChar.CharacterInterface_ViewEncOfficer = true;
Diag.CurrentNode = "ReturnfromSkillview";
NPChar.quest.meeting = NPC_Meeting;
Pchar.Quest.Last_Enc_Officer = NPChar.Index;
if (NPChar.chr_ai.type == "sit")
{
DumpAttributes(NPChar);
DeleteAttribute(NPChar, "chr_ai.type");
NPChar.chr_ai.type = "sit";
}
DialogExit();
LaunchOfficer(NPChar);
break;
case "ReturnfromSkillview":
d.Text = DLG_Text[6];
Link.l1 = DLG_TEXT[7];
Link.l1.go = "price";
break;
case "price":
d.Text = DLG_TEXT[8];
Link.l1 = DLG_TEXT[9];
Link.l1.go = "hire";
break;
case "hire":
d.Text = DLG_TEXT[10]
Link.l1 = DLG_TEXT[11];
DialogExit();
NPChar.offgen = true;
NPChar.officer = true;
LAi_Create_Officer(rand(0), &NPChar);
LAi_SetPlayerType(Pchar);
SetOfficersIndex(Pchar, 3, GetCharacterIndex("Horatio Hornblower"));
LAi_SetOfficerType(characterFromID("Horatio Hornblower"));
characters[GetCharacterIndex("Horatio Hornblower")].Dialog.Filename = "Enc_Officer_dialog.c";
characters[GetCharacterIndex("Horatio Hornblower")].Dialog.CurrentNode = "Hired";
break;
case "exit":
Diag.CurrentNode = Diag.TempNode;
NPChar.quest.meeting = NPC_Meeting;
DialogExit();
break;
}
}<!--c2--></div><!--ec2-->
One other thing to is that sometime when I enter the tavern the character will disappear if I exit without recruiting him is it possible to tell him to stay still until he get recruited??
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void ProcessDialogEvent()
{
ref NPChar, PChar, d;
PChar = GetMainCharacter();
aref Link, Diag;
string NPC_Meeting;
DeleteAttribute(&Dialog,"Links");
makeref(NPChar,CharacterRef);
makearef(Link, Dialog.Links);
makeref(d, Dialog);
makearef(Diag, NPChar.Dialog);
string iDay, iMonth;
iDay = environment.date.day;
iMonth = environment.date.month;
string lastspeak_date = iday + " " + iMonth;
switch(Dialog.CurrentNode)
{
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 = "dialogs\0\009";
d.Text = DLG_TEXT[0] + PChar.name;
Link.l1 = DLG_TEXT[1]
Link.l1.go = "continue";
break;
case "continue":
d.Text = DLG_TEXT[2];
Link.l1 = DLG_TEXT[3];
Link.l1.go = "continue2";
break;
case "continue2":
d.Text = DLG_TEXT[4];
Link.l1 = DLG_TEXT[5];
Link.l1.go = "ShowSkills";
break;
case "ShowSkills":
PChar.CharacterInterface_ViewEncOfficer = true;
Diag.CurrentNode = "ReturnfromSkillview";
NPChar.quest.meeting = NPC_Meeting;
Pchar.Quest.Last_Enc_Officer = NPChar.Index;
if (NPChar.chr_ai.type == "sit")
{
DumpAttributes(NPChar);
DeleteAttribute(NPChar, "chr_ai.type");
NPChar.chr_ai.type = "sit";
}
DialogExit();
LaunchOfficer(NPChar);
break;
case "ReturnfromSkillview":
d.Text = DLG_Text[6];
Link.l1 = DLG_TEXT[7];
Link.l1.go = "price";
break;
case "price":
d.Text = DLG_TEXT[8];
Link.l1 = DLG_TEXT[9];
Link.l1.go = "hire";
break;
case "hire":
d.Text = DLG_TEXT[10]
Link.l1 = DLG_TEXT[11];
DialogExit();
NPChar.offgen = true;
NPChar.officer = true;
LAi_Create_Officer(rand(0), &NPChar);
LAi_SetPlayerType(Pchar);
SetOfficersIndex(Pchar, 3, GetCharacterIndex("Horatio Hornblower"));
LAi_SetOfficerType(characterFromID("Horatio Hornblower"));
characters[GetCharacterIndex("Horatio Hornblower")].Dialog.Filename = "Enc_Officer_dialog.c";
characters[GetCharacterIndex("Horatio Hornblower")].Dialog.CurrentNode = "Hired";
break;
case "exit":
Diag.CurrentNode = Diag.TempNode;
NPChar.quest.meeting = NPC_Meeting;
DialogExit();
break;
}
}<!--c2--></div><!--ec2-->
One other thing to is that sometime when I enter the tavern the character will disappear if I exit without recruiting him is it possible to tell him to stay still until he get recruited??