NPC taking the boat

Users who are viewing this thread

MrRoy

Sergeant Knight at Arms
Would it be possible to make NPCs take the boat to travel to an other continent for example, like to make them think "If I want to go there I need to take a boat" then "Where is the nearest place where I can buy a ship" then the NPC would buy a boat, and go to the other continent.

If yes, any ideas how?
 
Well, first you need to set the reason for going over seas.  When that condition is met, then have them search for the closest party (town) that has a flag (slot) labeling it as a ship building town.  There's the start for you.
 
Well, for one, you should definitely take a look at some of the AI scripts in module_scripts.
You should also set a slot for towns that have ports. (something like "slot_town_has_port")
Also, maybe create some new AI states.
While you're at it, you should create some invisible parties on the ocean to serve as navigation guide points for the lord-ship-parties.

Here's some concept scripting I whipped up in a moment of blind passion and fury; you can try applying it to some of the AI scripts. No guarantee it'll work.

  # script_party_set_ai_state
  # Input: arg1 = party_no, arg2 = new_ai_state, arg3 = action_object (if necessary)
  # Output: none (Can fail)

      (party_get_attached_to, ":attached_to_party", ":party_no"),
      (assign, ":party_is_in_town", 0),
      (try_begin),
        (is_between, ":attached_to_party", centers_begin, centers_end),
        (assign, ":party_is_in_town", ":attached_to_party"),
      (try_end),

(assign ":party_is_in_port", 0),

(try_begin),
(party_slot_eq, ":attached_to_party", slot_town_has_port, 1),
(assign ":party_is_in_port", 1),
(try_end),

...

(else_try),
(eq, ":new_ai_state", spai_sail_from_port), #or something.
(eq, ":party_is_in_port", 1),
(party_get_position, pos1, ":party_no"),
(map_get_water_position_around_position, pos2, pos1, 6),
(party_set_position, ":party_no", pos2),
(party_set_icon, "party_no", "icon_ship"),
(party_set_ai_patrol_radius, ":party_no", 5),
(try_end),

When it comes to the AI on the water and disembarking, that's when you've got to create some invisible parties floating on the water to serve as location points to help navigation and movement.

Hopefully someone will find my mad outburst to be somewhat enlightening/helpful.
 
I'm going to tell you to use MartinF's idea:

http://forums.taleworlds.com/index.php/topic,61247.msg1584277.html

That's what I use for RoY, and it works splendid.
 
Ruthven said:
I'm going to tell you to use MartinF's idea:

http://forums.taleworlds.com/index.php/topic,61247.msg1584277.html

That's what I use for RoY, and it works splendid.

Of course, the disadvantage being that you end up replacing a terrain texture, and the lords will freely disembark and re-embark as they please.

But yeah, it works pretty well, and is quite simple to implement.
 
Ruthven said:
I'm going to tell you to use MartinF's idea:

http://forums.taleworlds.com/index.php/topic,61247.msg1584277.html

That's what I use for RoY, and it works splendid.

Thanks a lot, I'll use that :smile:
 
Back
Top Bottom