Modding:Defining Names: Difference between revisions

From SkyCorp Global
Jump to navigation Jump to search
(WIP on name type guide)
 
(LUA example for Custom (Entity or Adv. Monster))
 
Line 92: Line 92:
-- Ex: UI&Unspecified is "Fox" and GameText is "Veronica"
-- Ex: UI&Unspecified is "Fox" and GameText is "Veronica"
end
end
</syntaxhighlight>More practically, you could also sometimes set the name, but otherwise fall through to do special modes only in certain circumstances, ex:<syntaxhighlight lang="lua">
</syntaxhighlight>More practically, for advanced monsters, you could also set the name normally, and when needed, override it in certain circumstances, ex:<syntaxhighlight lang="lua">
WIP
function name(nameType)
</syntaxhighlight>
if blepping == true then
return "Blepper";
end
return this.defaultGetName(nameType);
end
</syntaxhighlight>Most mods won't need to override the name function like this though to accomplish normal game behavior.

Latest revision as of 01:41, 9 January 2026

This page will detail some general information about how names are defined for mods.

Most situations will fit into one of the following patterns:

Simple Monster Mod - Static Name

A simple monster mod (no code) who always has the same name can do something like this:

{
   ...,
   "name": "Harpy"
   },
   ...
}

See Spider or SCLab for examples.

Entities - Static Name

Physical objects (ex: a painting) probably just need a single name, in which case they will not define a dynamic function and just use use the 'literalString' functionality.

{
   ...,
   "name":
   {
      "literalString": "Fox Painting"
   },
   ...
}

Example: Radio

Advanced Monsters - Static Name

Most monsters don't change names. In this case, it is fine to use the 'initialValues' to set their base name. This has the advantage that when the UI name changes, the existing logic will handle this because name is not being overridden. For instance, when the monster sleeps, or becomes your owner. Example:

{
  ...,
  "initialValues":
  {
	"name": "Wyvern",
	...
  },
  ...
}

Example: Wyvern Shemale

Advanced Monsters - Personal Name

You may want to have a monster appear to be generic at first, but use a personal name once they become the player's owner or in gametext. In this case, you can use the personal name feature:

{
  ...,
  "initialValues":
  {
	"name": "Fox",
	...
  },
  "personalName": {
    "literalString": "Tina"
  },  
  "pronoun": {
    "literalString": "she"
  },
}

Advanced Monsters - Random Name

You may want to have many monsters of a specific type (ex: Fox), but each of those monsters have their own individual random name (ex: Veronica, Amy, etc). In this case, you can use the random name feature:

{
  ...,
  "initialValues":
  {
	"name": "Fox",
	...
  },
  "usesRandomizedName": {
    "literalBoolean": true
  },  
  "pronoun": {
    "literalString": "she"
  },
}

Pronoun is also set so that the correct name gender will be pulled from the random list.

Example: SetOwnerWithScene

Custom (Entity or Adv. Monster)

You can also completely override how name is shown and displayed by implementing name(nameType)

function name(nameType)	
	if nameType == NameType.UI then
		return "Blep-Button";
	end
		
	if nameType == NameType.GameText then
		return "Blep-Personal";
	end
	
	return "Blep-General"; 
	-- For testing purposes only.  In a real situation, the
	-- UI and Unspecified types should usually be the same thing.
	-- Ex: UI&Unspecified is "Fox" and GameText is "Veronica"
end

More practically, for advanced monsters, you could also set the name normally, and when needed, override it in certain circumstances, ex:

function name(nameType)	
	if blepping == true then
		return "Blepper";
	end
	
	return this.defaultGetName(nameType);
end

Most mods won't need to override the name function like this though to accomplish normal game behavior.