OSP Code Campaign Sea trade

gaston

Sergeant
Best answers
0
Thanks, that fixed the faction thing. 

I've watched the sea traders for six game days now.  All of them are stuck on the coast and are either "travelling to..." somewhere or just "travelling."I would post a screenshot, but I can't find out how to do that.  Some of the problem is with the map, since a lot of the ports are up a river or behind a peninsula.  But the same merchant ship has been beached outside Pensacola, which is on a flat stretch of coast, for six days and is still "Travelling to Pensacola." 
Is that the way it's supposed to be?
 

Caba`drin

Count
WBM&BWF&SNWVC
Best answers
0
gaston said:
I've watched the sea traders for six game days now.  All of them are stuck on the coast and are either "travelling to..." somewhere or just "travelling."I would post a screenshot, but I can't find out how to do that.  Some of the problem is with the map, since a lot of the ports are up a river or behind a peninsula.  But the same merchant ship has been beached outside Pensacola, which is on a flat stretch of coast, for six days and is still "Travelling to Pensacola." 
Is that the way it's supposed to be?
River ports won't work without a good deal of extra coding to guide the ships up the river (AI pathfinding on water doesn't do rivers...I tried for some time). Ports anywhere on an ocean coast (peninsula, island, or otherwise) will work just fine.

For the other pieces of your questions, see this response on the previous page of this thread. Make sure that your _is_coastal slots hold the radius distance of the town to water. If the town is farther from the ocean than that slot says it should be, the ships will never do their trade and be stuck. Even when it works correctly, the ships will be parked outside the town for a few days while they do their trade (again, see the linked post).
 

gaston

Sergeant
Best answers
0
Caba`drin said:
River ports won't work without a good deal of extra coding to guide the ships up the river (AI pathfinding on water doesn't do rivers...I tried for some time). Ports anywhere on an ocean coast (peninsula, island, or otherwise) will work just fine.

For the other pieces of your questions, see this response on the previous page of this thread. Make sure that your _is_coastal slots hold the radius distance of the town to water. If the town is farther from the ocean than that slot says it should be, the ships will never do their trade and be stuck. Even when it works correctly, the ships will be parked outside the town for a few days while they do their trade (again, see the linked post).
I tend to think this won't work well enough with the map I have (US, Canada and Caribean).  Port cities tend to be on river estuaries, or sheltered behind an island or peninsula.  Ships going to New York get stuck on Long Island.  Ships going to Baltimore get stuck on the Chesapeake peninsula. 

However, Pensacola is on a straight stretch of beach very near the water.  The sea trader has been there for twenty days now.  The radius distance is set to 4, which I think is too high. How do you measure the radius? What is the unit of measurement?

I've studied the scripts and I don't see any distinction between sea trade routes and other trade routes.  They are set in diferent scripts, but both types are created in set_trade_route_between_centers.  I've got caravans from inland towns stuck on the beaches all over the place trying to get to the West Indies.  There are no trade routes between their starting town and the islands.  Did I miss something?  What is supposed to prevent a caravan from trying to go to Cuba? 
Since all the towns in Calradia are on the same land mass, this probably isn't an issue in Native.  I think it's a show stopper for me.

Thank you for your assistance.
 

Waldzios

Baron
Best answers
0
gaston said:
Caba`drin said:
River ports won't work without a good deal of extra coding to guide the ships up the river (AI pathfinding on water doesn't do rivers...I tried for some time). Ports anywhere on an ocean coast (peninsula, island, or otherwise) will work just fine.

For the other pieces of your questions, see this response on the previous page of this thread. Make sure that your _is_coastal slots hold the radius distance of the town to water. If the town is farther from the ocean than that slot says it should be, the ships will never do their trade and be stuck. Even when it works correctly, the ships will be parked outside the town for a few days while they do their trade (again, see the linked post).
I tend to think this won't work well enough with the map I have (US, Canada and Caribean).  Port cities tend to be on river estuaries, or sheltered behind an island or peninsula.  Ships going to New York get stuck on Long Island.  Ships going to Baltimore get stuck on the Chesapeake peninsula. 

However, Pensacola is on a straight stretch of beach very near the water.  The sea trader has been there for twenty days now.  The radius distance is set to 4, which I think is too high. How do you measure the radius? What is the unit of measurement?

I've studied the scripts and I don't see any distinction between sea trade routes and other trade routes.  They are set in diferent scripts, but both types are created in set_trade_route_between_centers.  I've got caravans from inland towns stuck on the beaches all over the place trying to get to the West Indies.  There are no trade routes between their starting town and the islands.  Did I miss something?  What is supposed to prevent a caravan from trying to go to Cuba? 
Since all the towns in Calradia are on the same land mass, this probably isn't an issue in Native.  I think it's a show stopper for me.

Thank you for your assistance.
I'm using this one to calculate radius (it writes results to log).
Code:
  ("TEST_print_sea_distance",
    [
      (display_debug_message, "@{!}TEST : ------------------TEST_print_sea_distance-------------------"),
      (try_for_range, ":cur_town", towns_begin, towns_end),
            (party_get_position, pos0 , ":cur_town"),
            (assign, ":end",10),
            (try_for_range, ":counter", 1, ":end"),
               (map_get_water_position_around_position, pos1, pos0, ":counter"),
               (assign, ":end",":counter"),
               (str_store_party_name, s1, ":cur_town"),
               (assign, reg3,":counter"),
               (store_sub,reg2,":cur_town",towns_begin),
               (val_add,reg2,1),
               (display_log_message, "@{!} town:{reg2} distance:{reg3} name:{s1}"),
            (try_end),
      (try_end),
      (display_debug_message, "@{!}TEST : ------------------TEST_print_sea_distance-------------------"),
    ]),
 

gaston

Sergeant
Best answers
0
How do I execute that code?
What log does it print to?

Do you know what the unit of measurment for radius is?  What for example is the sea distance for Praven.  If I knew that I could just look at the map and eyeball radii.
 

Waldzios

Baron
Best answers
0
gaston said:
How do I execute that code?
What log does it print to?

Do you know what the unit of measurment for radius is?  What for example is the sea distance for Praven.  If I knew that I could just look at the map and eyeball radii.
You can add it at beginning of script game_start in module_scripts.py. and run game
Code:
      (call_script, "script_TEST_print_sea_distance"),
or add it somewhere in module_game_menus.py (choose menu you like)
Code:
      ("sea_distance",[(eq,"$cheat_mode",1)],"Shore distance check.",
       [(call_script, "script_TEST_print_sea_distance"),
        ]
       ),
The log is print to rgl_log.txt (edit mode has to be enabled).

Of course you can calculate it manually, just take map cords of city and cords of water spawn point and calculate distance, but if you have many towns it may be pretty long and pointless work.
 

gaston

Sergeant
Best answers
0
Oh, thanks.  I didn't realize the radius was map coordinates.  It seems obvious now that you point it out.  Thank you very much.
 

Duh

Duke
M&BWB
Best answers
0
Update on the modding wiki:
http://mbmodwiki.ollclan.eu/Seafaring

Latest version of seafaring can be found in the floris mod v2.5 beta. Will be slightly updated in the final release, but is working bugless so far.
 

voin-varg

Recruit
Best answers
0
Duh said:
Update on the modding wiki:

Latest version of seafaring can be found in the floris mod v2.5 beta. Will be slightly updated in the final release, but is working bugless so far.
Can I use this in my own mod?
 

Duh

Duke
M&BWB
Best answers
0
Most of it shows you the insertion into natively existing code.

So script ids should give you a pretty clear id on where to add what. If you dont know - slots and constants can be added pretty freely (pay attention to existing ranges though). You can also compare your work to what we did in Floris (the source is freely available) and there is a more in depth explanation, which includes the full system of sea travel, not just sea trade, on the modding wiki. You may want to start with something easier though.
 

HyperCharge

Section Moderator
M&BWBWF&SNWVC
Best answers
0
I have added the code.it not gives error.but ships are doesn't form to earths map icon.when they reach to the end of sea region.

What should i do ?
 

Duh

Duke
M&BWB
Best answers
0
HyperCharge said:
I have added the code.it not gives error.but ships are doesn't form to earths map icon.when they reach to the end of sea region.

What should i do ?
I am not sure what you are trying to say. Maybe you could post a screenshot of the issue? If you altered the worldmap, make sure to update town to water distance here:
Code:
     (party_set_slot, "p_town_1", slot_town_is_coastal, 4), #Sargoth
     (party_set_slot, "p_town_2", slot_town_is_coastal, 2), #Thir
     (party_set_slot, "p_town_6", slot_town_is_coastal, 3), #Praven
     (party_set_slot, "p_town_12", slot_town_is_coastal, 3), #Wercheg
     (party_set_slot, "p_town_13", slot_town_is_coastal, 5), #Rivacheg
     (party_set_slot, "p_town_15", slot_town_is_coastal, 4), #Yalen
     (party_set_slot, "p_town_19", slot_town_is_coastal, 8), #Shariz
Also note that the AI pathfinding does not support River texture iirc.

Masterancza said:
It working now... but I had to fix an error in the text.
A rather pointless comment, if you arent sharing the error/fix so that others can more easily fix it.
 

HyperCharge

Section Moderator
M&BWBWF&SNWVC
Best answers
0
Here :  http://i.hizliresim.com/YPG7YA.jpg

http://i.hizliresim.com/VpJ1oP.jpg

They can't go to towns.
 

HyperCharge

Section Moderator
M&BWBWF&SNWVC
Best answers
0
Okay.I'll try it.

I'd like to give you a suggestion;

İt would be a shipyard.Ships may come there.And they forming to caravan icon.(and they may spawn likes villagers and go to towns.)

But,its not easy as it looks.(code..  :???:)

Thank you for your interest.
 

Augustulus

Recruit
Best answers
0
Hi,

I've implemented your code into my mod (copy and paste :oops:).
It's great, but the ships don't start to trade.

I've insert these two lines:

module_simple_triggers
(else_try), ## SEA TRADE
  (display_message,"@SEA_CARAVAN: Begin sea trade."),
  (party_slot_eq, ":party_no", slot_party_type, spt_merchant_caravan),
  (display_message,"@SEA_CARAVAN: Party_type: spt_merchant_caravan."),
When I run the game, the first message is displayed. The second not.

The party_type is not "spt_merchant_caravan".
Why?

I use the module_system 1.158.
 

Corbul

Sergeant
WBVC
Best answers
0
Sorry to necro the topic, but I've run into some issues. Basically, I copy-pasted the codes provided in the OP into Diplomacy's mod_sys. Compiled. Only issue that came up was the custom troops, but I replaced them with existing ones, and it compiled correctly. I start the game, and the ships indeed start appearing, albeit a few in-game days pass. So far, so good. Once they appear, they travel between towns, and stay "docked" at the destination towns' shores. Ok, I haven't verified if they're "docked" or just stuck at shore, but it's not much of an issue. Edit: They do have the 'Traveling to' flag, but they also disappear after a few days. No, I haven't edited the map in any way.
The issues are, as follows:
[list type=decimal]
[*]When I attack one of these ships (I cheated a bit by teleporting to one of the ships in water), I don't get a relation penalty with the faction the ship belongs to - this is strange, since raiding a kingdom's caravan is an easy way to provoke aggression.
[*]There is no naval combat scene - should probably be mentioned in the OP, or, in the ideal case, added. I'd add one myself, thankfully, there are OSP packs for ship scenes, as well as native ship meshes, but I have no idea how to do it for a land battle, let alone a sea one.
[*]I constantly get several errors related to script code 23, finding towns at peace, or whatnot - this doesn't hinder ships from spawning or traveling, but it's still a bit annoying to see the message pop-up like 3-7 times in a row.
[/list]
Any help? :???:

Edit: Here's a picture for #3: