• 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 Potentional bug in smuggling ships

Levis

Find(Rum) = false;
Staff member
Administrator
Creative Support
Programmer
Storm Modder
@Pieter Boelen oh there are vitual smugglers! you just don't know them ;).

Code:
if(rand(1000)<=SMUGGLING_AMOUNT_INCR_CHANCE)
                {
                    //See if they get caught
                    if(pow2(sisland.smuggling.state,2)<=rand(16))
                    {
                        if(CheckAttribute(sisland,"Trade.Contraband"))
                        {
                            //Make a smuggler who adds some goods to the island
                            if(DEBUG_SMUGGLING>0) trace("SMUGGLING smuggler visited "+sisland.id);
                            int iShipType, iCargoType, iTradeGoods, irank;
                            if(CheckAttribute(sisland,"smuggler.ship")) DeleteAttribute(sisland,"smuggler.ship");
                            iShipType = Force_GetShipType(7, rand(20), "trade", sti(sisland.smuggling_nation));
                            sisland.smuggler.ship.type = GetShipID(iShipType);
                            int contid = rand(getIslandAmountContraband(sisland)-1)+1;//to make sure the rand() wont give 0
                            string contrabandid = "id" + contid;
                            iTradeGoods = sisland.Trade.Contraband.(contrabandid);
                            aref smuggler;
                            makearef(smuggler,sisland.smuggler);
                            int hullspace = GetCharacterFreeSpace(smuggler, iTradeGoods);
                            //Only 60% of space is used
                            int smuggle_amount = hullspace*0.6;
                            addIslandSmugglingAmount(sisland, smuggle_amount);
                        }
                    }
                }
            }

Every day during the island update there is a small chance for an island a smuggler drops by and delivers some goods or they might get caught. This will make sure the smuggling state of the islands are a little bit dynamic.
The Force_GetShipType from this function is probably causing the problem because an island has the pirate smuggling nation. But I'm not 100% sure it's this. But this one I could imagine being the cause.

Looking at it again it does look a bit weird with maxclass being 7 but minclass being a random number between 0 and 20 .. that doesn't sound right
 
oh there are vitual smugglers! you just don't know them ;).
Indeed I didn't know that. When did you add that? :shock

Looking at it again it does look a bit weird with maxclass being 7 but minclass being a random number between 0 and 20 .. that doesn't sound right
Indeed that sounds VERY bizarre!

There should also definitely be a check added for Pirate ships so they don't exceed the intended Pirate maximum Ship Tier.
 
@Pieter Boelen it's in it from the very first version ;).
and this line hasn't be changed since so it's actually working. but I think I messed it up a bit. I will take a look at it soon. The idea is it will just generate a ship somewhere between tier 7 and 5 (smugglers most likely wont have higher tier ships anyways) so I don't know why the rand() is in there actually....
in that case it shouldn't affect pirates either.
 
So you never get to see the ship anyway? Then it doesn't technically matter.
But indeed just hardcoding it between 7 and 5 seems like a good idea.
Simple and does the trick. :cheeky
 
So you never get to see the ship anyway? Then it doesn't technically matter.
But indeed just hardcoding it between 7 and 5 seems like a good idea.
Simple and does the trick. :cheeky

For now you don't.
When I'm going to work on the worldmap things etc I want to see if I can actually make an smuggler encounter also. they will have ships which will be fast and always running away etc.
They will then be linked to this, but for now you don't see them and the only reason its used it to determine the amount of goods and those calculations goes easiest if you just have a ship because you can say I want X% of the hull being filled with good X and it will return how many of that good it will take to do that :p.
 
Back
Top