Mod:Nebula's Mission Board/ Handcrafted jobs: Difference between revisions
Add override info |
m Fixes |
||
| Line 8: | Line 8: | ||
After handling all the rules you care about respecting, you can move on to actually creating the job. This is done with the following function: | After handling all the rules you care about respecting, you can move on to actually creating the job. This is done with the following function: | ||
<pre>MissionGen:MakeNewJob(zone, segment, floor, job_type, client, target, target_item, reward_type, rewards, title, flavor, hide_floor)</pre> | <pre>MissionGen:MakeNewJob(zone, segment, floor, job_type, client, target, target_item, reward_type, rewards, title, flavor, hide_floor)</pre> | ||
As you can see, there are a lot of parameters, though the great majority of them is optional. Those that are will have a <code>?</code> beside | As you can see, there are a lot of parameters, though the great majority of them is optional. Those that are will have a <code>?</code> beside their type. Any missing parameter that is required for the given job type to function will be generated randomly: | ||
* <code>zone</code> - <code>string</code>: The id of the zone this job takes place in. | * <code>zone</code> - <code>string</code>: The id of the zone this job takes place in. | ||
| Line 17: | Line 17: | ||
* <code>job_type</code> - <code>string</code>: The id of the type of this job. It must always be equal to one of the following values: "RESCUE_SELF", "RESCUE_FRIEND", "ESCORT", "EXPLORATION", "DELIVERY", "LOST_ITEM", "OUTLAW", "OUTLAW_ITEM", "OUTLAW_ITEM_UNK", "OUTLAW_MONSTER_HOUSE", "OUTLAW_FLEE". | * <code>job_type</code> - <code>string</code>: The id of the type of this job. It must always be equal to one of the following values: "RESCUE_SELF", "RESCUE_FRIEND", "ESCORT", "EXPLORATION", "DELIVERY", "LOST_ITEM", "OUTLAW", "OUTLAW_ITEM", "OUTLAW_ITEM_UNK", "OUTLAW_MONSTER_HOUSE", "OUTLAW_FLEE". | ||
* <code>client</code> - <code>string|monsterIDTable</code>: Data that will be used for the client of this job. If it's not a mosterIdTable (see below), it must be either "ENFORCER", "OFFICER" or "AGENT". A law enforcement character will be selected using different rules depending on the string. | * <code>client</code> - <code>string|monsterIDTable?</code>: Data that will be used for the client of this job. If it's not a mosterIdTable (see below), it must be either "ENFORCER", "OFFICER" or "AGENT". A law enforcement character will be selected using different rules depending on the string. | ||
* <code>target</code> - <code>string|monsterIDTable</code>: Data that will be used for the target of this job. If it's not a mosterIdTable (see below), it must be either "ENFORCER", "OFFICER" or "AGENT". A law enforcement character will be selected using different rules depending on the string. This value will be used only if the job type requires a target. | * <code>target</code> - <code>string|monsterIDTable?</code>: Data that will be used for the target of this job. If it's not a mosterIdTable (see below), it must be either "ENFORCER", "OFFICER" or "AGENT". A law enforcement character will be selected using different rules depending on the string. This value will be used only if the job type requires a target. | ||
* <code>target_item</code> - <code>string?</code>: The id of the item that will be used as target. This value will be used only if the job type requires an item. | * <code>target_item</code> - <code>string?</code>: The id of the item that will be used as target. This value will be used only if the job type requires an item. | ||
| Line 36: | Line 36: | ||
<pre>{ | <pre>{ | ||
Species:string, | Species:string, | ||
Form:integer, | Form:integer?, | ||
Skin:string, | Skin:string?, | ||
Gender:integer, | Gender:integer?, | ||
Nickname:string? | Nickname:string? | ||
}</pre> | }</pre> | ||
Latest revision as of 10:47, 1 January 2026
The Mission Generation Library contains a method that allows the creation of basic jobs with arbitrarily chosen parameters. These jobs do not have to abide by any of the rules that the normal job generation uses, so do keep in mind that you might have to run a few checks to make sure you're not going off script, or to simply give the job to the player only when the rules are all respected. You can also choose not to care, of course, but that might have some consequences depending on what isn't being respected.
Here's a quick rundown of the rules followed by the library, and how to check if your desired job data would break them:
- No two jobs should be on the same floor - If this is not respected, the player will only be able to keep one of the jobs active at the same time.
- Check with:
MissionGen:IsDestinationOccupied(zone, segment, floor)
- The number of guest jobs in the same dungeon should not be higher than "max_guests" - This might make the adventure more difficult if "guests_take_up_space" is true, because the game might remove more party members than expected.
- Check with:
MissionGen:GetDungeonsGuestCount()[zone]
After handling all the rules you care about respecting, you can move on to actually creating the job. This is done with the following function:
MissionGen:MakeNewJob(zone, segment, floor, job_type, client, target, target_item, reward_type, rewards, title, flavor, hide_floor)
As you can see, there are a lot of parameters, though the great majority of them is optional. Those that are will have a ? beside their type. Any missing parameter that is required for the given job type to function will be generated randomly:
zone-string: The id of the zone this job takes place in.
segment-integer: The specific segment this job takes place in.
floor-integer: The destination floor of this job.
job_type-string: The id of the type of this job. It must always be equal to one of the following values: "RESCUE_SELF", "RESCUE_FRIEND", "ESCORT", "EXPLORATION", "DELIVERY", "LOST_ITEM", "OUTLAW", "OUTLAW_ITEM", "OUTLAW_ITEM_UNK", "OUTLAW_MONSTER_HOUSE", "OUTLAW_FLEE".
client-string|monsterIDTable?: Data that will be used for the client of this job. If it's not a mosterIdTable (see below), it must be either "ENFORCER", "OFFICER" or "AGENT". A law enforcement character will be selected using different rules depending on the string.
target-string|monsterIDTable?: Data that will be used for the target of this job. If it's not a mosterIdTable (see below), it must be either "ENFORCER", "OFFICER" or "AGENT". A law enforcement character will be selected using different rules depending on the string. This value will be used only if the job type requires a target.
target_item-string?: The id of the item that will be used as target. This value will be used only if the job type requires an item.
reward_type-string?: The combination of rewards that will be awarded for this job. It must always be equal to one of the following values: "item", "money", "item_item", "money_item", "client", "exclusive". Ifrewardsis set, this value will be inferred from the items used, even if a value was already provided.
rewards-{string|itemTable?, string|itemTable?}: The item rewards that will be awarded for this job. If not set butreward_typeis, they will be generated automatically. You can either write only the id of the item, or use a full itemTable (see below). If the first item is nil, it will award money in its place.
title-string?: The string key to use for this job's title. If not set, it will be chosen randomly.
flavor-{string, string?}?: The string key, or keys, to use for this job's flavor text. If not set, they will be chosen randomly.
hide_floor-boolean?: If true, the job's floor will be hidden when viewing the job inside menus.
monsterIDTable
{
Species:string,
Form:integer?,
Skin:string?,
Gender:integer?,
Nickname:string?
}
itemTable
{id:string, count:integer?, hidden:string?}
MakeNewJob will return a fully-formed JobTable, which can then be edited further either indirectly or with other functions. Once you're done, however, you will need to add a BackReference to it, otherwise the game won't know where to send the player for the reward cutscene. This can be done in two ways, depending on what you want to accomplish; if you want to give the job directly to the player, you can do this:
MissionGen:SetBackReference(<job>, <board_id>) MissionGen:AddJobToTaken(<job>, <startActive>)
where:
jobis the JobTable.board_idis the board the job should bring the player to after completing it.startActiveis an optional boolean that tells the game whether or not to set the job as active as it gets added to the taken list. Defaults tofalse.
If, instead of giving it directly to the player, you want to add the job to a board, you can do this:
MissionGen:AddJobToBoard(<board_id>, <job>)
where:
board_idis the board the job will be added to, and that will be set as BackReference.jobis the JobTable.
With this done, the job is now fully set up and can be safely presented to the player.
Custom text
You can further customize the jobs you create by editing the text displayed in the various fields of the job menu. There are a few functions that allow you to set overrides for some of the job's sensitive information:
MissionGen:SetClientOverride(<job>, <string_key>) MissionGen:SetObjectiveOverride(<job>, <string_key>) MissionGen:SetDungeonOverride(<job>, <string_key>) MissionGen:SetDifficultyOverride(<job>, <string_key>) MissionGen:SetRewardOverride(<job>, <string_key>)
where:
jobis the JobTable you want to edit.string_keyis the localization key of the string you want to set.
