1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

WIP Improvements to Smuggling.

Discussion in 'Build Beta and Brainstorming' started by Hylie Pistof, Oct 13, 2017.

  1. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    yeah I tried keeping it in the function but I couldnt make it work :p what it does now works, but apart from the &&|| thing it looks like a solid plan, so definitly feel free to optimize it!


    alright, gonna see what I can do :) :type1
    would something like this work?
    Code:
    // DeathDaisy: 3d6 persuasion system based on leadership and luck so far
        int PersuadeInt;
        int ThreeDice;
        int pLeadership = CalcCharacterSkill(PChar,SKILL_LEADERSHIP);
        int pLuck = CalcCharacterSkill(PChar,SKILL_SNEAK);
        int PersuasionChance = 3+(rand(pLuck*10)/10)+pLeadership-(getSmugglingState(smugisland)-1);
        if(CheckCharacterPerk(PChar,"Trustworthy")) PersuasionChance = PersuasionChance+1;
        if(CheckCharacterPerk(PChar,"IronWill")) PersuasionChance = PersuasionChance+1;
        PersuasionChance = iClamp(4,16,PersuasionChance);
    Code:
    // DeathDaisy: Roll 3 six-sided dice to determine success for a nice bell curve
                ThreeDice = round(((rand(50)+10)+(rand(50)+10)+(rand(50)+10))/10);
    youre very right, the stats and costs are pretty much just placeholders, they dont actually do anything other than exist rn :p was planning on locking the second one for later levels and increasing the costs somewhat. and deffo gotta go through and add more uses for them in dialogs all around before they make sense :type1 I'll make a thread for help with what they should do and balancing if/when theyre a bit better implemented
     
  2. Hylie Pistof

    Hylie Pistof Curmudgeon Staff Member QA Tester Storm Modder

    Joined:
    Jan 15, 2010
    Messages:
    13,766
    Gender:
    Male
    I didn't think of the smuggling issues. This idea goes against long established game play.

    You know the random goods floating in the sea? Usually that is contraband. So when you go to port it gets confiscated and you get fined. You might as well delete all that stuff floating in the sea because it will be just left there.

    Sometimes a store will have something for a very good price and I will buy it, just because, then sail around with it until it fetches a good price. This could cause me to dock at ports where it is contraband on the way to the store with the good price. So the cargo is taken and I am fined heavily.

    What happens when I go bankrupt and can not pay the fine? Will the thugs take my ship too?

    Oh, who gets the trustworthy perk? I'm at level 64 or so and do not have it.
     
  3. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    I think those are all very fair points :yes those mechanics can maybe be fun if you plan on going all-out smuggler on a character or just like getting kicked in the teeth by games(I know I have those days, my modded skyrim was torture), but otherwise its a recipe for disaster what with all the random goods you pick up here and there and most dont keep track of whats contraband in the ports they dock at. if @Levis wanna work on it anyway tho as I still think it could be kinda cool, since buildsettings are fairly easy to add and there are like 1000 already, could there be like a "super advanced smuggling" option to activate there when youre planning to play a smuggler char etc?

    another thing I remembered; I have no idea if the smuggling things I added for sweden/america works so might be worth taking a look at.
     
  4. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,696
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    At the moment it wont work. If I save my game right after the dialog is done (before the 5 second check to reenable it is done) and then load the game the check won't continue.
    The smuggler check it self (from what I remember) has a build in function to store it being running while saving so it will resume after loading a game. So you want to keep all your logic in this function so it will always run.
     
  5. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,696
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    Like I said already I will think about it a bit more and see if I can revise the idea. For now there is still enough other stuff to do like interface enhancements to give you more information about the smuggling.
     
    DeathDaisy and Pieter Boelen like this.
  6. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    hadnt considered for a second what would happen with saves! Ill change it to your thing :onya
     
  7. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    I changed it to this
    Code:
    void CheckCoastGuard()
    {
        ref PChar = GetMainCharacter();
        float chance_get_caught = GetEventData();
        if(PChar.location == PChar.quest.contraband.CurrentPlace && !dialogRun && !dialogSelf)
        {
            if(Rand((100*SMUGGLING_TIME_CHANCE_MULT))<=chance_get_caught)
            {
                if(DEBUG_SMUGGLING>1) TraceAndLog("SMUGGLING Coastguard found you!");
                Lai_QuestDelay("Rand_ContrabandInterruption",1.0);
                StopCoastGuardCheck();
            }
            if(DEBUG_SMUGGLING>1) TraceAndLog("SMUGGLING caught chance is "+chance_get_caught+" in "+(100*SMUGGLING_TIME_CHANCE_MULT));
            if(DEBUG_SMUGGLING>1) TraceAndLog("SMUGGLING Evaded the Coastguard (for now)");
        }
        else{
            if(DEBUG_SMUGGLING>1) TraceAndLog("SMUGGLING caught chance paused");
        }
        PostEvent("CheckCoastGuard",5000,"f",chance_get_caught);
    }
    I moved the chance_get_caught float outside the if statement, otherwise it forgot the caught chance when it was paused and returned crazy numbers. it shouldnt give any reprecussions, rite?

    also attaching the guard dialog with the new dice generator with larger rands :) it seems to work well! and gives nicer random numbers when running a series through the console, so good call xD
     

    Attached Files:

    Levis likes this.
  8. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    Just a reminder: '-price' doesn't work, it has to be '-1.0 * price', so I have to fix this every time I WinMerge one of your "random_guards_group_dialog.c" variants with the one I'm trying to build up. ;)

    You don't have to stick with 6-sided dice. If you want a larger random number, many RPG's use 20-sided dice. Or percentage dice. (Ever seen a 100-sided die? Good luck rolling it, or rather, good luck getting it to stop, let alone figure out which side is on top. xD More usually, percentages are rolled with a pair of 10-sided dice, one for 10's and one for units.)
     
  9. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    oh right! I havent changed the one in wongame since I wasnt sure if you should lose money when betting and was gonna check it out, but then I forgot because Im a ditz :ko I think its simply a mistake and should be commented out tbh, but Im not 100%. feels weird that you should lose money even tho you gamble instead of bribe..

    Im a huge roleplaying dork xD have played both d20 and d100 systems (100-sided die are pretty much just balls :rofl). what I really like about the 3 6-sided ones is that the odds as you get better are in a bellcurve as opposed to linear as with DnDs d20 and percentage dice like WH Fantasy and CoC. so each stat and bonus you add to your target number makes a much larger difference than in a linear progression. with a 20-sided dice you have a 5% chance to roll any number. with 3d6 you have a 9.3% chance to roll under 6, a 50% chance to roll under 10 and a 90.7% chance to roll under 14 frex. Im not gonna claim its necessarily better :p but I really like the feeling of growth non-linear odds give
     
    Pieter Boelen likes this.
  10. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    The point is, D6 is apparently too small for PoTC's random number system to work properly. Personally, I'm not so sure of that, and other parts of the game probably won't work if it's true, starting with the 'rand(4)' which determines which of your random dialogs will be used. Have you noticed any bias towards any particular persuasion line?

    If 6-sided dice can't be used, use 20-sided dice instead. You don't have to duplicate a paper RPG system. If you want three dice and you don't trust the system to roll a D6 properly, you can use 3D20 instead. Or 3D16. Or whatever number you like. (By the way, there really is such a thing as a D16. I've got one.)

    All you need to turn the existing code into 3D50 is to change 'rand(50)+10' into 'rand(50)+1'. (And then probably add a +27 modifier because '(rand(50) + 10) + (rand(50) + 10) + (rand(50) + 10)' is really 'rand(50) + rand(50) + rand(50) + 30', so you need the +27 to bring the result back into range.)
     
  11. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,696
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    Solved - Random or Quasi Random Numbers?

    Here is an old thread about the RNG. It's not that big of a problem but from what I remember doing that research having an rng for only 3 numbers could skew sometimes. Having a higher number to roll from looks to be more random, or even better using the frand.
     
  12. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    hard to say with the lines, I havnt been paying attention but its not something Ive reacted at. Im gonna keep it in mind tho

    about the dice tho, its not as much about copying gurps as its that I just find 3d6 easier than 3d50 to wrap my head around when coming up with and balancing modifiers and such, it works well with the 1-10 scale of skills and perks already in the game I think. adding a +/-1 is as easy as it gets :shrug there is a randnorm() function for random bellcurves to check out if the rand(50)+10)/10 isnt good, but I dont think I understand it well enough to ever have any hope of balancing it :ko (googled for the 16 sided dice, they look unusual and weird xD what systems are they used for? damage in DnD?)

    would the frand work better for 1-6, or is it the same problem with small numbers?

    the gambling system should probably be looked at too, I think it also uses rand(5)+1 or even rand(6)
     
  13. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @LarryHookins might be able to help.
     
  14. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,696
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    don't worry that much about the RNG, it's not that much of a problem if its not easy for you to change ;).
     
  15. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    @DeathDaisy: there's a slight problem with 'random_guards_group_dialog.c':
    Code:
    RUNTIME ERROR - file: dialogs\random_guards_group_dialog.c; line: 23
    missed attribute: contraband
    Line 23 is this:
    Code:
    ref smugisland = GetIslandByIndex(sti(Pchar.quest.Contraband.islandindex));
    The error happened when I was playing a character who had never smuggled. When I went into a tavern, a random soldier talked to me, and that was the result. If you haven't done any smuggling, "Pchar.quest.Contraband" doesn't exist, so that line fails. It doesn't crash the game or block the guard's dialog, but it would be nice if talking to the guard didn't spawn an error.
     

    Attached Files:

  16. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    right you are!

    I put all the smuggling stuff I added in the beginning into an if I stole from sumwhere else that seems to check if the quest exists
    Code:
    if(CheckAttribute(Pchar, "quest.Contraband.Active") && Pchar.quest.Contraband.Active == true)
        {
            ref smugisland = GetIslandByIndex(sti(Pchar.quest.Contraband.islandindex));
            
            string PatrolState = "";
            // DeathDaisy: 3d6 persuasion system based on leadership and luck so far
            int PersuadeInt;
            int ThreeDice;
            int pLeadership = CalcCharacterSkill(PChar,SKILL_LEADERSHIP);
            int pLuck = CalcCharacterSkill(PChar,SKILL_SNEAK);
            int PersuasionChance = 3+round(rand(pLuck*10)/10)+pLeadership-(getSmugglingState(smugisland)-1);
            if(CheckCharacterPerk(PChar,"Trustworthy")) PersuasionChance = PersuasionChance+1;
            if(CheckCharacterPerk(PChar,"IronWill")) PersuasionChance = PersuasionChance+1;
            //if(CheckCharacterPerk(PChar,"Charisma")) PersuasionChance = PersuasionChance+2;
            //if(CheckCharacterPerk(PChar,"WitCharm")) PersuasionChance = PersuasionChance+3;
            //if(sti(Pchar.model.nation) == sti(NPChar.nation) && PChar.model.playertype == PLAYER_TYPE_MARINE) PersuasionChance = PersuasionChance+3;
            PersuasionChance = iClamp(4,16,PersuasionChance);
            //trace(PersuasionChance);
        }
    I dont get the errors when not having the quest anymore but the quest dialog still works when it should afaict:onya
     

    Attached Files:

  17. Grey Roger

    Grey Roger Sea Dog Staff Member Storm Modder

    Joined:
    Feb 12, 2007
    Messages:
    6,408
    Thanks! I'll give that a try when I'm next playing the game.
     
  18. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    If you tell me exactly what results you want, I can tell you either how to use RandNorm() or what dice to roll.

    RandNorm is fairly simple. You specify a mean and a standard deviation. The mean is the number around which you wish the random number to vary, and the standard deviation is the expected amount. The version used in PotC will produce numbers as far off as 4 standard deviations from the mean. Basically, 66% of the results will be within one standard deviation of the mean, 95% will be within two standard deviations, and 99% will be within three. The remaining 1% will be up to about four.

    So, RandNorm(100, 10) should produce 2/3 of it's results between 90 to 110, 95% will be 80 to 120, 99% will be 70 to 130, with limits of about 60 to 140. While there are ways to get the curve to be flatter or sharper, or to cluster more to one side or the other, I've totally forgotten what they are in the last 8 years and the last time I tried to figure it out again I failed. If there are any mathematicians in the house, I'd be much obliged.

    Rolling a large quantity of dice will produce something approaching the bell curve, and it's closer as more dice are rolled. But if you want a bell curve, RandNorm will do it in far fewer calculations.

    Hook
     
    Pieter Boelen likes this.
  19. DeathDaisy

    DeathDaisy Freebooter Storm Modder

    Joined:
    Aug 18, 2017
    Messages:
    287
    Gender:
    Female
    since Ive done lots of dice rolling and very little other math the last decade, I used three six-sided dice equivalents (ie (rand(5)+1)+(rand(5)+1)+(rand(5)+1)) to get a number between 3 and 18 to get a bellcurve with 10 in the middle. since the rng can be funky with small numbers I turned it into round((rand(50)+10)+(rand(50)+10)+(rand(50)+10)/10). it does seem to work alright and keeps it at a level I can understand, but its maybe not very pretty :p its probably accurate enough for what it does, the persuasion system is no big deal tbh, but if I can do similar numbers better with randnorm() I wont mind using that instead. and I often find myself wanting non-linear calcs so learning how to use it would be ideal overall xD would randnorm(10,2) give something similar? would it have the same problem with small numbers as the normal rand system?
     
  20. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,696
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    btw something which came to mind.
    If the officer returns from scouting, does this officer also receive experience for this scouting? If not than I think this should be added, could be another reason why you send the officer for scouting ;).
     
    DeathDaisy and Pieter Boelen like this.

Share This Page