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

Need Help Walk on the ship

Myth

Freebooter
Good evening. I can not solve this problem: It is necessary that a certain character walk in the city of lost ships, only on a certain ship. Something similar is in women's taverns. The waitress walks between the tables. Thank you.
 
I assume on the deck?

The problem is that typical characters will randomly choose a "goto" locator from the model location where they are loaded, from all available in the model file, and there are probably 100 of those in LSC model and that will be something like goto1 - goto100. So, make a new type, similar to how the waitress chooses table locators.

First, you need to figure out what locators are on the deck of the ship you want, from LostShipsCity_locators.gm. Let's pretend there are three you want: goto_5, goto_32, goto_76.

Make a copy of LAi_waitress.c for your new type: LAi_MyNewType.c

Change relevant functions and names, for instance:

#define LAI_TYPE_MYNEWTYPE "mynewtype"

LAi_type_mynewtype_Init(aref chr)

An important function for the new type will be the update cycle in LAi_type_waitress_CharacterUpdate

Your new function, LAi_type_mynewtype_CharacterUpdate will want to investigate the "goto" action and call its own function for locators, like how the waitress does:

if(chr.chr_ai.tmpl == LAI_TMPL_STAY)...you will change to if(chr.chr_ai.tmpl == LAI_TMPL_GOTO) and call a function to select from the only locators you want.

You can use LAi_type_waitress_GotoTable(aref chr) as an example, but you will not use random find.

string locator = LAi_FindRandomLocator("tables");
chr.chr_ai.type.locator = locator;

Instead of LAi_FindRandomLocator, you might do this:

switch(rand(2)) {
case 0:
locator = goto_5; //From your investigation of the model for proper locator names on the
break;
ship
case 1:
locator = goto_32;
break;
case 2:
locator = goto_76;
break;
}
 
Last edited:
That sounds clever, @ChezJfrey! :onya

I once tried to do something similar to have a character patrol between two specific locators.
For some reason, I couldn't make it work at the time...
 
LAi_SetLSCoutType alredy have need code

Well that is good news. I did not know about that file and now that I look at it, they even give notes about what locator names belong to each ship. That is handy. They handle with a similar approach where if chr_ai.tmpl == LAI_TMPL_GOTO in CharacterUpdate, they call LAI_TYPE_LSCout_Goto and the function limits to certain locator names.
 
Back
Top