• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Solved Dutchman Quest Revisions (Test Game Download Included)

Modder01

Freebooter
Storm Modder
Hi Everyone,

Since ChezJefrey has not responded for a while It is safe to say that he is taking a break (by his personal file data he is not banned so I don't know why else). Here is the current state of the dutchman quest:
Code:
void DutchEncounterQuestComplete(string sQuestName, string qname)
{
   ref chr;
   //trace("--- QUEST " + sQuestName + " CHECKED ---");
   switch(sQuestName)
   {
      case "begin_dutchencounter":
          //UpdateLogbook
          SetQuestHeader("Dutchman");
          AddQuestRecord("Dutchman", "1");
          trace("*** Slip of Paper Given");
          //ReloadLocation
          DoQuestReloadToLocation(pchar.location + "_upstairs", "goto", "goto1", "spawn_dutchman");
      break;

      case "spawn_dutchman":
      //login Davy Jones

      //generate encounter
           int iChar = SpawnDutchman();

           Pchar.quest.dutchman_KillJones.win_condition.l1 = "NPC_Death";
           Pchar.quest.dutchman_KillJones.win_condition.l1.character = "Davy Jones";
           PChar.quest.dutchman_KillJones.win_condition = "dutchman_KillJones";
      break;

      case "dutchman_KillJones":
          //Kill Jones by function
          //Play a sound here "Damn you jack sparrow" (sound sample filtered from original movie)
          if (CheckAttribute(pchar , "DutchmanRespawn"))
           {
               trace("Flying Dutchman Killed by Cannonfire");
               DeleteAttribute(pchar, "DutchmanRespawn");
              SetQuestHeader("Dutchman");
               AddQuestRecord("Dutchman", "2_failed");
               LAi_group_Delete("FlyingDutchman"); //Sea group
               Pchar.quest.dutchman_Respawn.win_condition.l1 = "ExitFromLocation";
               Pchar.quest.dutchman_Respawn.win_condition.l1.location = "Grenada";
               PChar.quest.dutchman_Respawn.win_condition = "spawn_dutchman";
           }
           else
           {
              SetQuestHeader("Dutchman");
              AddQuestRecord("Dutchman", "3_captured");
              trace("*** Davy Jones Killed by Abordage");
              DoQuestCheckDelay("dutchman_dead", 2.0);

           }
      break;

      case "dutchman_dead":
          //Tell quest giver in Bridgetown tavern to give reward
          characters[GetCharacterIndex("Chat_Quester_1")].dialog.currentnode = "dutchman_reward";
          trace("*** Character has been told quest is complete");
      break;
   }
}

int SpawnDutchman()
{
   int iChar = GetCharacterIndex("Davy Jones");
   if(iChar < 0) { //New
      iChar = GenerateCharacter(PIRATE, WITH_SHIP, "officer", MAN, 1, BOSS);
       characters[iChar].id = "Davy Jones";
       characters[iChar].name = "Davy";
       characters[iChar].location = "Grenada";
       characters[iChar].lastname = "Jones";
       characters[iChar].model = "pirate_5";
       characters[iChar].Ship.Type = GenerateShip(SHIP_DUTCHMAN, 1);
       characters[iChar].Ship.Cannons.Type = CANNON_TYPE_CANNON_LBS48;
       characters[iChar].ship.name = "The Flying Dutchman";
       characters[iChar].skill.cannons = 5;
       characters[iChar].skill.grappling = 5;
       characters[iChar].skill.accuracy = 5;
       characters[iChar].skill.defense = 10;
       characters[iChar].rank = 20;
       characters[iChar].skill.Fencing = 10;
       characters[iChar].skill.Gun = 10;
       characters[iChar].cannotsurrender = 1;
      FaceMaker(&characters[iChar]);
   }
   else { //Reset ship attributes (restock HP, ammo, etc.)
       SetBaseShipData(GetCharacter(iChar));
   }

   DeleteAttribute(&characters[iChar], "seaai");
   Group_CreateGroup("FlyingDutchman");
   Group_AddCharacter("FlyingDutchman", "Davy Jones");
   Group_SetGroupCommander("FlyingDutchman", "Davy Jones");
   Group_SetPursuitGroup("FlyingDutchman", PLAYER_GROUP);

   string sLocator = "Grenada_locators" + (rand(2)+2);
   Group_SetAddress("FlyingDutchman", "Grenada", "quest_ships", sLocator);
   SetCharacterRelationBoth(nMainCharacterIndex, iChar, RELATION_ENEMY);

   Group_SetTaskAttack("FlyingDutchman", PLAYER_GROUP);
   Group_LockTask("FlyingDutchman");
   UpdateRelations();
   trace("*** Davy Jones login successful");

   return iChar;
}

The problem was that Davy Jones wasn't spawning in the cabin which takes us to LAI_Boarding.c for my logic addressing that issue:
Code:
void LAi_SetBoardingCaptain(string locID)
{
   int i;
   ref chr;
   string model;
   string ani;
   string bString = "blade";
   int xhp;
   int locIndex = FindLocation(locID);

   int eclass = sti(boarding_enemy.rank);
   //Установим врагов

   model = LAi_GetBoardingModel(boarding_enemy, &ani);
   string sLoc = "aloc" + rand(3);  
   chr = LAi_CreateFantomCharacterEx(model, ani, "rld", sLoc);

   if(pchar.location=="Grenada") {
      if(!GetCharacterIndex("Davy Jones") < 0){
          ref chr2 = GetCharacterIndex("Davy Jones");
          chr.name = chr2.name;
          chr.lastname = chr2.lastname;
          chr.model = chr2.model;
          chr.rank = chr2.rank + 20;
          chr.skill.fencing = chr2.skill.fencing;
          chr.skill.gun = chr2.skill.gun;
          GiveItem2Character(chr, "blade19");
          EquipCharacterByItem(chr, "blade19");
          GiveItem2Character(chr, "gun6");
          EquipCharacterByItem(chr, "gun6");
          chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
          chr.ship.crew.experience = boarding_enemy.ship.crew.experience;
          LAi_SetHP(chr, 500.0, 500.0);
      } else {
          chr.rank = boarding_enemy.rank;
          chr.skill.fencing = boarding_enemy.skill.fencing;
          chr.skill.gun = boarding_enemy.skill.gun;

          chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
          chr.ship.crew.experience = boarding_enemy.ship.crew.experience;

          chr.blade = "blade1";
          bString=bString + makeint(6+rand(5)-eclass);
          chr.blade.itemID = bString;
          chr.blade.time = 0.1;
          chr.blade.colorstart = argb(128, 22, 46, 190);
          chr.blade.colorend = argb(0, 20, 60, 100);
          Lai_CharacterChangeEnergy(chr, 100.0);
          LAi_NPC_Equip(chr, eclass, true, true);
          LAi_SetBoardingCaptainLevelHP(chr);
      }
   } else {
      chr.rank = boarding_enemy.rank;
      chr.skill.fencing = boarding_enemy.skill.fencing;
      chr.skill.gun = boarding_enemy.skill.gun;

      chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
      chr.ship.crew.experience = boarding_enemy.ship.crew.experience;

      chr.blade = "blade1";
      bString=bString + makeint(6+rand(5)-eclass);
      chr.blade.itemID = bString;
      chr.blade.time = 0.1;
      chr.blade.colorstart = argb(128, 22, 46, 190);
      chr.blade.colorend = argb(0, 20, 60, 100);
      Lai_CharacterChangeEnergy(chr, 100.0);
      LAi_NPC_Equip(chr, eclass, true, true);
      LAi_SetBoardingCaptainLevelHP(chr);
   }

   LAi_group_MoveCharacter(chr, LAI_GROUP_BRDENEMY);


   //Заставим драться эти 2 группы
   LAi_group_FightGroupsEx(LAI_GROUP_PLAYER, LAI_GROUP_BRDENEMY, true, nMainCharacterIndex, -1, false, false);
   LAi_group_SetCheckEvent(LAI_GROUP_BRDENEMY);
}

I have also attached the log files and here is the test game link:
Meet Google Drive – One place for all your files

Note: This game is the full version of 5.0 as it is now. It is an experimental build of the game and as such those who respond to this topic will get credited for being play testers. Those who help fix it will also be credited to the bug fixing team. Since it is an experimental build there will be stability issues with the game from time to time.

Regards,
Modder01
 

Attachments

  • compile.log
    56.3 KB · Views: 278
  • error.log
    2.7 KB · Views: 313
  • system.log
    14.9 KB · Views: 295
Last edited:
Lots of surprising messages in compile.log; I'm not familiar with AoP:CT, but you may want to check on that.

First reason I could think of for him not showing up is if the necessary locator doesn't exist.
Do all locations have an "aloc0" through "aloc3"?

by his personal file data he is not banned
Indeed he's not.
 
Lots of surprising messages in compile.log; I'm not familiar with AoP:CT, but you may want to check on that.

First reason I could think of for him not showing up is if the necessary locator doesn't exist.
Do all locations have an "aloc0" through "aloc3"?


Indeed he's not.
The AOP:CT game has no logic for spawning special characters in the cabin like in COAS quest events... The locators do exist however the person being spawned in ins't Jones...
 
The AOP:CT game has no logic for spawning special characters in the cabin like in COAS quest events...
I am only familiar with PotC, so haven't a clue about CoAS either.

The locators do exist however the person being spawned in ins't Jones...
So you're saying you DO get a captain, just not Davy Jones?

Did you add any Trace/Log_SetStringToLog messages to check if your modified code gets executed?
Does 'GetCharacterIndex("Davy Jones") < 0' not just check if a character with that ID exists in the character array?
 
I am only familiar with PotC, so haven't a clue about CoAS either.


So you're saying you DO get a captain, just not Davy Jones?

Did you add any Trace/Log_SetStringToLog messages to check if your modified code gets executed?
Does 'GetCharacterIndex("Davy Jones") < 0' not just check if a character with that ID exists in the character array?
The character array does not include Davy Jones and I suspect that since the exact pchar location isn't known it is defaulting to the normal spawn. I can add trace and run again...
 
The quest generates the character. Therefore the character becomes part of the array when it is generated.
Makes sense. :onya

Is he already generated by the time you check if he exists?
If so, did you confirm the Davy Jones section of code is indeed triggered?
 
Makes sense. :onya

Is he already generated by the time you check if he exists?
If so, did you confirm the Davy Jones section of code is indeed triggered?
I made that code to account for the contingency that he doesn't so that it would spawn a random person in the cabin fight and that if Davy Jones existed, he would be spawned instead. That code in LAI_Boarding.c is frequently used outside of the quest so I had to prepare for that contingency.
 
I made that code to account for the contingency that he doesn't so that it would spawn a random person in the cabin fight and that if Davy Jones existed, he would be spawned instead. That code in LAI_Boarding.c is frequently used outside of the quest so I had to prepare for that contingency.
If I understand you correctly, you do get a character in the cabin, but it is not Davy Jones.
That makes me think you are falling into one of the two 'else' conditions that you have defined.
If so, either you are not at Grenada, or Davy Jones does not yet exist.
You should be able to check what actually happens using Trace/Log_SetStringToLog statements.

That is the only suggestion I can give based on what I understand from your description and code.
 
If I understand you correctly, you do get a character in the cabin, but it is not Davy Jones.
That makes me think you are falling into one of the two 'else' conditions that you have defined.
If so, either you are not at Grenada, or Davy Jones does not yet exist.
You should be able to check what actually happens using Trace/Log_SetStringToLog statements.

That is the only suggestion I can give based on what I understand from your description and code.

New Trace Statements....Testing Now....
Code:
void LAi_SetBoardingCaptain(string locID)
{
   int i;
   ref chr;
   string model;
   string ani;
   string bString = "blade";
   int xhp;
   int locIndex = FindLocation(locID);

   int eclass = sti(boarding_enemy.rank);
   //Установим врагов
   
   model = LAi_GetBoardingModel(boarding_enemy, &ani);
   string sLoc = "aloc" + rand(3);           
   chr = LAi_CreateFantomCharacterEx(model, ani, "rld", sLoc);
   
   if(pchar.location=="Grenada") {
       trace("cabin char spawn location is Grenada");
       if(!GetCharacterIndex("Davy Jones") < 0){
           trace("Quest Char Spawned");
           ref chr2 = GetCharacterIndex("Davy Jones");
           chr.name = chr2.name;
           chr.lastname = chr2.lastname;
           chr.model = chr2.model;
           chr.rank = chr2.rank + 20;
           chr.skill.fencing = chr2.skill.fencing;
           chr.skill.gun = chr2.skill.gun;
           GiveItem2Character(chr, "blade19");
           EquipCharacterByItem(chr, "blade19");
           GiveItem2Character(chr, "gun6");
           EquipCharacterByItem(chr, "gun6");
           chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
           chr.ship.crew.experience = boarding_enemy.ship.crew.experience;
           LAi_SetHP(chr, 500.0, 500.0);
       } else {
           trace("Random Char Spawned");
           chr.rank = boarding_enemy.rank;
           chr.skill.fencing = boarding_enemy.skill.fencing;
           chr.skill.gun = boarding_enemy.skill.gun;
   
           chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
           chr.ship.crew.experience = boarding_enemy.ship.crew.experience;
   
           chr.blade = "blade1";
           bString=bString + makeint(6+rand(5)-eclass);
           chr.blade.itemID = bString;
           chr.blade.time = 0.1;
           chr.blade.colorstart = argb(128, 22, 46, 190);
           chr.blade.colorend = argb(0, 20, 60, 100);
           Lai_CharacterChangeEnergy(chr, 100.0);
           LAi_NPC_Equip(chr, eclass, true, true);
           LAi_SetBoardingCaptainLevelHP(chr);
       }
   } else {
       trace("Not Grenada - Random Char Spawned")
       chr.rank = boarding_enemy.rank;
       chr.skill.fencing = boarding_enemy.skill.fencing;
       chr.skill.gun = boarding_enemy.skill.gun;

       chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
       chr.ship.crew.experience = boarding_enemy.ship.crew.experience;

       chr.blade = "blade1";
       bString=bString + makeint(6+rand(5)-eclass);
       chr.blade.itemID = bString;
       chr.blade.time = 0.1;
       chr.blade.colorstart = argb(128, 22, 46, 190);
       chr.blade.colorend = argb(0, 20, 60, 100);
       Lai_CharacterChangeEnergy(chr, 100.0);
       LAi_NPC_Equip(chr, eclass, true, true);
       LAi_SetBoardingCaptainLevelHP(chr);
   }
   
   LAi_group_MoveCharacter(chr, LAI_GROUP_BRDENEMY);


   //Заставим драться эти 2 группы
   LAi_group_FightGroupsEx(LAI_GROUP_PLAYER, LAI_GROUP_BRDENEMY, true, nMainCharacterIndex, -1, false, false);
   LAi_group_SetCheckEvent(LAI_GROUP_BRDENEMY);
}
 
New Logs:
Note: 2nd "Not Grenada statement" is for the quest ship when It spawned in Grenada sea....
 

Attachments

  • compile.log
    64.4 KB · Views: 278
  • error.log
    1.7 KB · Views: 263
  • system.log
    16.2 KB · Views: 282
So you're at Grenada, but the code thinks you're not?
If so, try trace-logging pchar.location to see where the game does think you are.
 
So you're at Grenada, but the code thinks you're not?
If so, try trace-logging pchar.location to see where the game does think you are.
that was unhelpful... pchar location is CaptainCabine.... I am going to trace the location ID and see if it is unique or is random.
 
Does at least explain the reason. That's a good start.

Maybe there is a character ship location to read?
Or does AoP have a "from_sea" attribute?
 
Dead end... Location ID is unique, but not in the same sense as I thought... Captain cabine location has an ID of 272 even though the original pchar location is not calculated.

Have another idea... in LAI_boarding.c there is logic to get the location of the player's ship and of the enemy ship, but certain things have to be passed for the enemy location to be calculated. Since it is safer to determine the pchar ship location instead I have added logic which will allow the location of the player's ship to be traced at the time of the captains cabine fight. I will trace the captains cabine location of the dutchman 3 times to see if the ID is unique and remains constant...
 
That didn't work, however I have another plan.... Locations that don't have an inland location have an island location tag on the world map retrieved at certain time in islands loader.c using the command on a trace line "worldMap.island". If it can be read from the LAI_Boarding.c I can compare the island with Grenada string so it is more likely to pass that condition....
 
Been a bit busy with the 'real' job...

Anyway, I would do away with location checks and such. I suggest copying the technique COAS uses, but in a way to not break the existing CT way.

I believe you have in your code set, an extraneous, unused file from COAS: Program\characters\RPGUtilite.c

That file contains a function that COAS uses during the boarding to create a 'stand in' for the captain, that generates a new character (similar to what CT's LAi_SetBoardingCaptain does), but copies all the attributes that the boarding_enemy from LAi_boarding.c has as captain. Apparently, CT does not set all the character attributes when assigning an enemy captain character, but COAS does. So CT, generates and sets skills, equipment and such in LAi_SetBoardingCaptain, but COAS already sets all those and merely copies the attributes to the stand in.

So what I might do for a quick solution in this case, is add an attribute to Davy Jones in your SpawnDutchman() function:

characters[iChar].copyme = true;

Borrow the function ChangeAttributesFromCharacter from RPGUtilite.c and put that in one of CT's used program files. You might have to edit and remove/change some of the attributes and checks it does that are not applicable to CT (e.g. the SPECIAL attributes). You will note that the function checks and copies all attributes and thing such as the equipped weapons of the source character, into the new stand in character. Then, in the LAi_SetBoardingCaptain function, check for the .copyme attribute and if true, that is Davy Jones and call ChangeAttributesFromCharacter, else, do as normally.

Code:
LAi_SetBoardingCaptain(string locID)

         chr = LAi_CreateFantomCharacterEx(model, ani, "rld", sLoc);
         if(CheckAttribute(boarding_enemy, "copyme") && sti(boarding_enemy.checkme) == 1) {
             ChangeAttributesFromCharacter(....
         }
         else {
                chr.rank = boarding_enemy.rank;
                 chr.skill.fencing = boarding_enemy.skill.fencing;
                 chr.skill.gun = boarding_enemy.skill.gun;
.
.
.
 
New Code:
dutch_encounter.c
Code:
void DutchEncounterQuestComplete(string sQuestName, string qname)
{
   ref chr;
   //trace("--- QUEST " + sQuestName + " CHECKED ---");
   switch(sQuestName)
   {
       case "begin_dutchencounter":
           //UpdateLogbook
           SetQuestHeader("Dutchman");
           AddQuestRecord("Dutchman", "1");
           trace("*** Slip of Paper Given");
           //ReloadLocation
           DoQuestReloadToLocation(pchar.location + "_upstairs", "goto", "goto1", "spawn_dutchman");
       break;

       case "spawn_dutchman":
       //login Davy Jones

       //generate encounter
            int qChar = SpawnDutchman();

            Pchar.quest.dutchman_KillJones.win_condition.l1 = "NPC_Death";
            Pchar.quest.dutchman_KillJones.win_condition.l1.character = "Davy Jones";
            PChar.quest.dutchman_KillJones.win_condition = "dutchman_KillJones";
       break;

       case "dutchman_KillJones":
           //Kill Jones by function
           //Play a sound here "Damn you jack sparrow" (sound sample filtered from original movie)
           if (CheckAttribute(pchar , "DutchmanRespawn"))
            {
                trace("Flying Dutchman Killed by Cannonfire");
                DeleteAttribute(pchar, "DutchmanRespawn");
               SetQuestHeader("Dutchman");
                AddQuestRecord("Dutchman", "2_failed");
                LAi_group_Delete("FlyingDutchman"); //Sea group
                Pchar.quest.dutchman_Respawn.win_condition.l1 = "ExitFromLocation";
                Pchar.quest.dutchman_Respawn.win_condition.l1.location = "Grenada";
                PChar.quest.dutchman_Respawn.win_condition = "spawn_dutchman";
            }
            else
            {
               SetQuestHeader("Dutchman");
               AddQuestRecord("Dutchman", "3_captured");
               trace("*** Davy Jones Killed by Abordage");
               DoQuestCheckDelay("dutchman_dead", 2.0);

            }
       break;

       case "dutchman_dead":
           //Tell quest giver in Bridgetown tavern to give reward
           characters[GetCharacterIndex("Chat_Quester_1")].dialog.currentnode = "dutchman_reward";
           trace("*** Character has been told quest is complete");
       break;
   }
}

int SpawnDutchman()
{
    int qChar = GetCharacterIndex("Davy Jones");
    if(qChar < 0) { //New
       qChar = GenerateCharacter(PIRATE, WITH_SHIP, "officer", MAN, 1, BOSS);
        characters[qChar].id = "Davy Jones";
        characters[qChar].name = "Davy";
        characters[qChar].location = "Grenada";
        characters[qChar].lastname = "Jones";
        characters[qChar].model = "pirate_5";
        characters[qChar].Ship.Type = GenerateShip(SHIP_DUTCHMAN, 1);
        characters[qChar].Ship.Cannons.Type = CANNON_TYPE_CANNON_LBS48;
        characters[qChar].ship.name = "The Flying Dutchman";
        characters[qChar].skill.cannons = 5;
        characters[qChar].skill.grappling = 5;
        characters[qChar].skill.accuracy = 5;
        characters[qChar].skill.defense = 10;
        characters[qChar].rank = 20;
        characters[qChar].skill.Fencing = 10;
        characters[qChar].skill.Gun = 10;
        characters[qChar].cannotsurrender = 1;
       characters[qChar].copyme = true;
       FaceMaker(&characters[qChar]);
       GiveItem2Character(qChar, "blade19");
        EquipCharacterByItem(qChar, "blade19");
        GiveItem2Character(qChar, "gun6");
        EquipCharacterByItem(qChar, "gun6");
    }
    else { //Reset ship attributes (restock HP, ammo, etc.)
        SetBaseShipData(GetCharacter(qChar));
    }

    DeleteAttribute(&characters[qChar], "seaai");
    Group_CreateGroup("FlyingDutchman");
    Group_AddCharacter("FlyingDutchman", "Davy Jones");
    Group_SetGroupCommander("FlyingDutchman", "Davy Jones");
    Group_SetPursuitGroup("FlyingDutchman", PLAYER_GROUP);

    string sLocator = "Grenada_locators" + (rand(2)+2);
    Group_SetAddress("FlyingDutchman", "Grenada", "quest_ships", sLocator);
    SetCharacterRelationBoth(nMainCharacterIndex, qChar, RELATION_ENEMY);

    Group_SetTaskAttack("FlyingDutchman", PLAYER_GROUP);
    Group_LockTask("FlyingDutchman");
    UpdateRelations();
    trace("*** Davy Jones login successful");

    return qChar;
}
LAI_Boarding.c
Code:
void LAi_SetBoardingCaptain(string locID)
{
   int i;
   ref chr;
   string model;
   string ani;
   string bString = "blade";
   int xhp;
   int locIndex = FindLocation(locID);

   int eclass = sti(boarding_enemy.rank);
   //Установим врагов
  
   model = LAi_GetBoardingModel(boarding_enemy, &ani);
   string sLoc = "aloc" + rand(3);          
   chr = LAi_CreateFantomCharacterEx(model, ani, "rld", sLoc);
    if(CheckAttribute(boarding_enemy, "copyme") && sti(boarding_enemy.checkme) == 1) {
       trace("Special Character");
        ChangeAttributesFromCharacter(chr, GetCharacterIndex("Davy Jones"), false);
    }
    else {
       trace("Random Character");
        chr.rank = boarding_enemy.rank;
       chr.skill.fencing = boarding_enemy.skill.fencing;
       chr.skill.gun = boarding_enemy.skill.gun;
      
       chr.ship.crew.morale = boarding_enemy.ship.crew.morale;
       chr.ship.crew.experience = boarding_enemy.ship.crew.experience;
      
       chr.blade = "blade1";
       bString=bString + makeint(6+rand(5)-eclass);
       chr.blade.itemID = bString;
       chr.blade.time = 0.1;
       chr.blade.colorstart = argb(128, 22, 46, 190);
       chr.blade.colorend = argb(0, 20, 60, 100);
       Lai_CharacterChangeEnergy(chr, 100.0);
       LAi_NPC_Equip(chr, eclass, true, true);
       LAi_SetBoardingCaptainLevelHP(chr);
   }
  
   LAi_group_MoveCharacter(chr, LAI_GROUP_BRDENEMY);


   //Заставим драться эти 2 группы
   LAi_group_FightGroupsEx(LAI_GROUP_PLAYER, LAI_GROUP_BRDENEMY, true, nMainCharacterIndex, -1, false, false);
   LAi_group_SetCheckEvent(LAI_GROUP_BRDENEMY);
}
.
.
.
void ChangeAttributesFromCharacter(ref CopyChref, ref PastChref, bool _dialogCopy)
{
    aref arToChar;
    aref arFromChar;

    CopyChref.model            = PastChref.model;
    CopyChref.model.animation  = PastChref.model.animation;
    CopyChref.sex              = CopyChref.sex;
    CopyChref.headModel        = PastChref.headModel;
    CopyChref.FaceId           = PastChref.FaceId;
    CopyChref.nation           = PastChref.nation;

   CopyChref.name             = PastChref.name;
    CopyChref.lastname         = PastChref.lastname;

    CopyChref.rank             = PastChref.rank;
    CopyChref.reputation       = makeint(PastChref.reputation);

   CopyChref.baseCapIdx       = PastChref.index; //Id оригинального в структуру клона

    if (CheckAttribute(PastChref, "loyality"))
    {
       CopyChref.loyality         = PastChref.loyality;
   }
   else DeleteAttribute(CopyChref, "loyality");
   if (CheckAttribute(PastChref, "alignment"))
   {
       CopyChref.alignment        = PastChref.alignment;
    }
    else DeleteAttribute(CopyChref, "alignment");

    CopyChref.Money            = PastChref.Money;

    CopyChref.chr_ai.hp         = makeint(PastChref.chr_ai.hp);
    CopyChref.chr.chr_ai.hp_max = makeint(PastChref.chr_ai.hp_max);

    LAi_SetHP(CopyChref, makeint(PastChref.chr_ai.hp_max), makeint(PastChref.chr_ai.hp_max));
   LAi_SetCurHPMax(CopyChref);

   //копируем структуру quest от оригинального кэпа, очень нужно по квестам :)
   if (CheckAttribute(PastChref, "quest"))
    {
       aref arToCharQuest, arFromCharQuest;
       makearef(arFromCharQuest, PastChref.quest);
       makearef(arToCharQuest, CopyChref.quest);
       DeleteAttribute(arToCharQuest, "");
       CopyAttributes(arToCharQuest, arFromCharQuest);
   }

   if (CheckAttribute(PastChref, "quest.officertype"))
    {
        CopyChref.quest.officertype     =   PastChref.quest.officertype;
    }
    else
    {
        DeleteAttribute(CopyChref, "quest.officertype");
    }

    if (CheckAttribute(PastChref, "Payment"))
    {
        CopyChref.Payment     =   PastChref.Payment; // платить ЗП
    }
    else
    {
        DeleteAttribute(CopyChref, "Payment");
    }
    if (CheckAttribute(PastChref, "HoldEquip"))
    {
        CopyChref.HoldEquip   =   PastChref.HoldEquip; // не отдавать саблю и пистоль
    }
   else
    {
        DeleteAttribute(CopyChref, "HoldEquip");
    }
    if (CheckAttribute(PastChref, "SaveItemsForDead"))
    {
        CopyChref.SaveItemsForDead   =   true;
    }
   else
    {
        DeleteAttribute(CopyChref, "SaveItemsForDead");
    }
    if (CheckAttribute(PastChref, "DontClearDead"))
    {
        CopyChref.DontClearDead   =   true;
    }
   else
    {
        DeleteAttribute(CopyChref, "DontClearDead");
    }
    if (CheckAttribute(PastChref, "OfficerWantToGo.DontGo"))
    {
        CopyChref.OfficerWantToGo.DontGo   =   true;
    }
   else
    {
        DeleteAttribute(CopyChref, "OfficerWantToGo.DontGo");
    }
    // skill
    DeleteAttribute(CopyChref, "skill");
    CopyChref.skill = "";

    makearef(arToChar, CopyChref.skill);
    makearef(arFromChar, PastChref.skill);

    CopyAttributes(arToChar,arFromChar);

    // SPECIAL
    DeleteAttribute(CopyChref, "SPECIAL");
    CopyChref.SPECIAL = "";

    makearef(arToChar, CopyChref.SPECIAL);
    makearef(arFromChar, PastChref.SPECIAL);

    CopyAttributes(arToChar,arFromChar);

    // Statistic
    DeleteAttribute(CopyChref, "Statistic");
    CopyChref.Statistic = "";

    makearef(arToChar, CopyChref.Statistic);
    makearef(arFromChar, PastChref.Statistic);

    CopyAttributes(arToChar,arFromChar);

    // perks
    DeleteAttribute(CopyChref, "perks");
    CopyChref.perks = "";

    makearef(arToChar, CopyChref.perks);
    makearef(arFromChar, PastChref.perks);

    CopyAttributes(arToChar,arFromChar);
    // items
    DeleteAttribute(CopyChref, "Items");
    CopyChref.Items = "";

    makearef(arToChar, CopyChref.Items);
    makearef(arFromChar, PastChref.Items);

    CopyAttributes(arToChar,arFromChar);

    if (CheckAttribute(PastChref, "equip.blade"))
    {
       CopyChref.equip.blade =   PastChref.equip.blade;
   }
   if (CheckAttribute(PastChref, "equip.gun"))
    {
       CopyChref.equip.gun   =   PastChref.equip.gun;
   }
   // health
   if (CheckAttribute(PastChref, "Health.TotalDamg"))
    {
       CopyChref.Health.TotalDamg =   PastChref.Health.TotalDamg;
   }
   else
   {
        CopyChref.Health.TotalDamg = 0;
   }
   if (_dialogCopy && CheckAttribute(PastChref, "Dialog.Filename"))
   {
       CopyChref.Dialog.Filename    = PastChref.Dialog.Filename;
       CopyChref.Dialog.CurrentNode = PastChref.Dialog.CurrentNode;
       if (CheckAttribute(PastChref, "greeting")) CopyChref.greeting = PastChref.greeting; //eddy.нет логам!
       else
       {
           DeleteAttribute(CopyChref, "greeting");
       }
   }
   Lai_CharacterChangeEnergy(CopyChref, 100.0);
   //SetNewModelToChar(CopyChref);  // чтоб сабли были правильные
}

New Errors are attached....
Incorrect index for character may refer to Davy Jones since it misses the attribute copyme...
 

Attachments

  • compile.log
    20.9 KB · Views: 263
  • error.log
    810 bytes · Views: 282
  • system.log
    8.4 KB · Views: 281
LOL, sorry man. I didn't actually code the thing, just typing out my thoughts, and you might have to double-check for my 'duh' errors...hehehe

sti(boarding_enemy.checkme) == 1

should be: sti(boarding_enemy.copyme) == 1

Sorry about that :)
 
Back
Top