• 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!

Fixed Officer sent to scout for smuggling time does not disappear at the door

DeathDaisy

Freebooter
Storm Modder
when sending an officer to scout for the patrol times when smuggling, they run to the door but does not despawn. this is how it looks right now in my quests_common.c, but I have tried a lot of different variations, so dont pay too much heed to what is outcommented and not
Code:
case "Send Officer to scout":
            //Levis add smuggling questbook
            Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
            AddQuestRecord(questbookname, 11);
            Preprocessor_Remove("location");
            Pchar.quest.Contraband.scout.done = true;
            //In 1 day he has to return
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            RemovePassenger(PChar, NPChar);
            //NPChar.StoredFellow = True;
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
            LAi_SetActorType(NPChar);
            LAi_ActorGoToLocation(NPChar,"reload","reload1", "none", "", "", "Send Officer Gone",10);
            /*PChar.quest.Send_Officer_Gone.win_condition.l1 = "ExitFromLocation";
            PChar.quest.Send_Officer_Gone.win_condition.l1.location = PChar.location;
            PChar.quest.Send_Officer_Gone.win_condition = "Send Officer Gone";*/
        break;

        case "Send Officer Gone":
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            LAi_SetOfficerType(NPChar);
            ChangeCharacterAddressGroup(NPChar,"none","",""); //We don't have to see him anymore
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" from location");
            PChar.quest.Contraband_Scouting.win_condition.l1 = "Timer";
            PChar.quest.Contraband_Scouting.win_condition.l1.date.day = GetAddingDataDay(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.month = GetAddingDataMonth(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.year = GetAddingDataYear(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition = "Send Officer time expired";
            if(DEBUG_SMUGGLING>0)trace("SMUGGLING timer set 1 day later ");
        break;
depending on whats commented out and which order stuff is in, they either just stand tby the door inert or turn around and keep following you until you leave, at which point they disappear and the quest seem to work normally with the timers and whatnot. but they absolutely flatout refuse to disappear at the door. cant despawn them with the console and not by putting ChangeCharacterAddressGroup instead of LAi_ActorGo(or run) to location. it makes no sense. :modding
 
Took a swing at it myself.
This work:

Code:
case "Send Officer to scout":
            //Levis add smuggling questbook
            Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
            questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
            AddQuestRecord(questbookname, 11);
            Preprocessor_Remove("location");
            Pchar.quest.Contraband.scout.done = true;
            //In 1 day he has to return
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            NPChar.StoredFellow = True;
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
            LAi_SetActorType(NPChar);
            LAi_ActorRunToLocation(NPChar, "reload", "reload1", "None", "", "", "Send Officer Gone", -1);
        break;

        case "Send Officer Gone":
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            RemovePassenger(PChar, NPChar);
            BLI_UpdateOfficers();
            if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" from location");
            PChar.quest.Contraband_Scouting.win_condition.l1 = "Timer";
            PChar.quest.Contraband_Scouting.win_condition.l1.date.day = GetAddingDataDay(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.month = GetAddingDataMonth(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition.l1.date.year = GetAddingDataYear(0, 0, 1);
            PChar.quest.Contraband_Scouting.win_condition = "Send Officer time expired";
            if(DEBUG_SMUGGLING>0)trace("SMUGGLING timer set 1 day later ");
        break;

also a little change is needed in another case:
Code:
case "Send Officer back in slot":
            if(DEBUG_SMUGGLING>0) trace("SMUGGLING officer becomes passenger again");
            NPChar = characterFromID(PChar.quest.Contraband.officerID);
            DeleteAttribute(NPChar,"StoredFellow");
            AddPassenger(PChar, NPChar, 0);
            LAi_SetOfficerType(NPChar);
            SetOfficersIndex(Pchar, -1, sti(NPChar.index)); // PB: Use index instead of reference
            NPChar.dialog.currentnode = "hired";            // PB: Reset his dialog
            BLI_UpdateOfficers();
        break;

The problem was that removing the officer will set it's location to "none" already, so when the changecharacter addressgroup is called it sees the character is in location none already so it will try to teleport it to the locator instead of logoff the character.
By calling the removing only after the officer left the location it will work.
 

Attachments

  • quests_common.c
    228.4 KB · Views: 211
Back
Top