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

Drinking in a tavern

Grey Roger

Sea Dog
Staff member
Administrator
Storm Modder
If you talk to one of the regulars in a tavern which has regulars, he'll randomly either want to drink or gamble with you. Gambling has been getting all the attention lately. Time to look at the other option.

I'd noticed that, near the top of "Habitue_dialog.c", there are a list of taverns for which quests are allowed. I found out what that's for. If the guy at the table chooses to drink, the conversation can go various ways. He can ask for another drink, he can accuse you of trying to steal his money, or he can ask you to help with a soldier who offended him, which you decline. If quests are allowed then there are a few other options. You can pass out, be robbed and be woken by the tavern girl; you can be attacked by a would-be mugger; or you can choose to help your drinking partner with the offensive soldier. Since I added tavern partners to Port au Prince, Santiago and Havana, I've started by adding the necessary code to "quests_common.c" for these taverns, and ended up rewriting a lot of the existing code.

If you choose to help with the soldier, you get teleported outside the tavern, where you meet a soldier character specifically set up for the encounter. There's one soldier for each different tavern. Rather than define yet more soldier characters who only serve one purpose, I created a single character "Drink Soldier" and customised him for each of the newly added taverns. Then I changed the previously existing taverns to use the same character. This means the individual soldiers can be removed, freeing up some character slots. They all have the same dialog for the encounter anyway so it doesn't matter that they're all the same character using the same new, small dialog file. The exceptions are the pirate soldiers in Nevis Pirate Settlement and Bonaire Pirate Fort, who use a different, more piratey dialog.

The case in which you pass out and the tavern girl then tells you that you've been robbed is even easier. Instead of numerous quest cases for each tavern, I've been collapsing almost all of them into one piece of code which uses 'GetTownOfficiant(GetCurrentTownID())' to figure out who the local tavern girl is. The exception is the brothel in Nevis Pirate Settlement which will still have its own code as it doesn't use the town officiant - she's in the tavern along the street.

And then I found a piece of weirdness in Santiago tavern. When I talked to the new drinker/gambler and sat down, the room went very dark. A bit of experimenting with console to teleport me to various locators showed that both the "sit" locators on the left of the tavern facing towards the back did this. If I used TOOL to turn them round to face the front of the tavern, they worked fine. OK, this is stupid, so try a stupid solution. To turn a locator to face backwards, you change its XX and ZZ values to -1. I changed them to -0.99, then changed XZ and ZX to 0.01 to compensate - and it worked!

Now I'm on a pub crawl to check that the various encounters work properly in every tavern which I've changed. A lot of rum is going to be involved. Hic!
 
Update: the pub crawl is complete, I've recovered from all that drinking, and all drinking encounters in all taverns which support the full range appear to work correctly.

The brothel needed a lot of fixing. The code for passing out and then being informed that you've been robbed didn't work. The brothel wants to use "wench2", who didn't appear, partly because she's limited to certain times but mainly because "PROGRAM\Characters\init\QuebradasCostillas.c" contains two definitions for each wench using the same ID, the second version being located in the bedroom and also limited by time. Also, "wench_dialog.c" did not contain the necessary part for telling you that you've been robbed. I've changed all the upstairs ID's by adding a "U", e.g. the upstairs version of "wench2" becomes "wench2U", and copied the stuff from "eng_officiant_dialog" into "wench_dialog" for the encounter. Additionally, I added code to "barwench_dialog" for the encounter where the drinker accuses you of wanting to rob him, you threaten to kill him, and the bar tender threatens to throw you both out. That sorted out the drinking.

If you talk to the mistress and try to hire a girl, nothing happens. I don't mean tame stuff suitable for our younger viewers, I mean nothing - you pay the money and stay right where you are. "Mistress_dialog.c" calls function 'GotSlut', which is defined in "Dialog_func.c". 'GotSlut' looks through all the reloads for your current location to find one which leads somewhere containing "_upstairs" or "_bedroom", then sends you there. For this brothel, there is no such reload. Reloads, and pretty much everything else, for location "QC_Brothel" are defined in function 'InitQCBrothel' in "MAXIMUS_Functions.c". So I added a reload definition there to point to "QC_brothel_upstairs", and can now get value for the money I pay to the mistress. The girls in the main area have new models instead of the basic "towngirl" types, schedules are re-arranged so that each of four girls is on duty 12 hours a day, with schedules staggered so that you'll see a different two out of the four depending on what time of day you visit. Not that you'll notice because there are also a lot of randomly generated fantom girls too - I tried to get rid of them, failed, and wasn't too bothered because they liven the place up.
So as of next update, Nevis Pirate Settlement brothel is fully operational and open for business. :bounce
 
Something else I noticed in "Habitue_dialog.c". The tavern character has a 50/50 chance to be a drinker or gambler. Later on you added code to give him another chance to be a gambler, if the player is also a gambler:
Code:
               if (CharPlayerType == PLAYER_TYPE_GAMBLER)
               {
                   // npchar.quest.last_theme = "1";
                   if (makeint(Rand(5)) < 3)npchar.quest.last_theme = "1";
               }
That's another 50/50 chance. So in effect, if you're a gambler, he has a 75% chance to be a gambler.

Also at the top:
Code:
    if(PChar.location == "Cartagena Casino")
   {
       npchar.quest.last_theme = 1;
   }

Putting the whole lot together in one place and adding an explanatory variable in place of fixed values:
Code:
   int GAMBLER_CHANCE = 50;                   // Even chance that character will be gambler or drinker
   if (CharPlayerType == PLAYER_TYPE_GAMBLER) GAMBLER_CHANCE = 75;   // Higher chance of gambler if you're a gambler
   if (PChar.location == "Cartagena Casino") GAMBLER_CHANCE = 100;   // Guaranteed gambler in Cartagena Gaming House

   if (npchar.quest.Meeting != lastspeak_date)
   {
       npchar.quest.last_theme = 0;
       if (makeint(Rand(99)) < GAMBLER_CHANCE) npchar.quest.last_theme = "1";
       npchar.quest.Meeting = lastspeak_date;
       npchar.money = rand(10)*100;
       if(CheckCharacterPerk(PChar,"HighStakes")) npchar.money = sti(npchar.money) * 5; //Added by Levis
       //Log_SetStringToLog("Money of character " + npchar.id + " is " + npchar.money + "!!!");
   }
That should have the same net effect: 50/50 chance of being a gambler normally, 75% chance if you're a gambler, guaranteed if you're in Cartagena Casino. It also makes adding further exceptions based on location, quest or anything else, very easy.
 
Back
Top