Monster Advanced JSON Mod Format

From SkyCorp Global
Revision as of 00:06, 29 December 2018 by SkyCorp (talk | contribs) (→‎Dynamic Fields)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Monster Advanced is a special type of entity which combines the power of LUA driven entities with the existing Monster Mods system. It is one of the hardest types of entities to create, so it is recommended to start with a simpler mod type before creating a Monster Advanced.

Monster Advanced JSON supports a variety of parameters to create custom monsters. JSON definitions can specify each as programmable (LUA) or literal values.

(All Entity JSON parameters are also supported!)

Example

See this sample for an example of this monster in action.

Fixed Fields

Note that Monster Advanced entities uses a type of 'MONSTERADVANCED' instead of 'ENTITY'

id and customPublicFunctions are also supported (see entity JSON docs for details), don't forget to set id if you plan to have multiple custom monsters loaded at a time.

For setting up the below values, you may want to use SCLab to generate a base simple monster (Monster Code), test it a bit, then update its type to MONSTERADVANCED, and move the parameters around into the correct structure.

initialValues

This collection of values follow the format of Monster Mods. These key-value pairs are supported:

  • name
  • escapeChance
  • hp
  • lustMax
  • meleeAttackPlayerDamage
  • meleeAttackPlayerAccuracy
  • lustAttackPlayerDamage
  • lustAttackPlayerAccuracy
  • lustAttackChance
  • meleeAttackMonsterAccuracy
  • lustAttackMonsterAccuracy
  • inseminationAttemptOnPlayerVictory
  • inseminationAttemptOnPlayerDefeat

defaultText

This collection of text follows the format of Monster Mods. These key-value pairs are supported:

  • alert
  • lustOk
  • lustFails
  • attackOk
  • attackFails
  • playerUse
  • playerDefeat

defeatTf

If set, and if the default monster victory function is called, then will cause the player to TF.

This collection follows the format of Monster Mods. These key-value pairs are supported:

  • tfTime
  • tfTotal
  • tfEscapeFailure
  • tfEscapeSuccess
  • tfAccept
  • bodyType

Dynamic Fields

In addition to the usual Entity JSON fields, monster fields are also included:

Return Type Parameter
void tickRest

Called when the monster is resting, waiting for the player. Note: this is called even if player isn't in same room as monster.

void tickAttack

Called when the monster is attacking the player. Note: this is called even if player isn't in same room as monster (and would normally change the state to resting).

void tickDefeat

Called when the monster is defeated by player while still usable by player Note: this is called even if player isn't in same room as monster.

void tickSleep

Called when the monster is asleep (after being defeated by player). Note: this is called even if player isn't in same room as monster.

void resetHPLust

Called when the monsters HP & Lust should return to fully healed values. IE: On sleep.

boolean isAttackable

Determines whether attack & lust buttons will be shown in UI. Defaults to showing them whenever not in sleep state.

void doAttackPhysical

The player has executed a physical attack on this object. Will check if the player is prevented from attacking and if the strike hits. There's a lot of logic here, so if you override this and still want to do the usual logic, call this.defaultDoAttackPhysical() to fall through to the usual attack logic.

void doAttackLust

Same as doAttackPhysical, but for lust.

void beginSleep

Enters sleep state (sets state and amount of sleep turns to sleep for).

void doMonsterVictory

The monster just won, so let them have their way with the player. This could be a one-scene defeat & respawn, or a full transformation sequence. (Note, as of r35, the functions necessary to have a multiple page sequence are not currently exposed, but could fall through to the default version of this function to do a full TF sequence).

If overriding this function and not calling the default monster victory, be sure to:

  • Game will soft lock if you do not end this function with a continue! Either do a:
    • player respawn (not currently exposed in r35)
    • continue scene
  • You should probably also reset the monster's health via this.resetHPLust().
  • You should probably also reset player's lust, hp, and pregnancy
  • Set monster state to REST
void rewardDrop

Called on the winning attack by the player -- drops a random reward (ie: cash, item, etc). Override this to drop something specific.

Note that while the usual name dynamic field is supported, it is not recommenced to be used. If set, it will not update when the monster is defeated or asleep. Instead, use the fixed field via initialValues.name (see above).

Non-overrideable Functions

See the Monster Advanced API page for a list of functions that Monster Advanced scripts have access to, including a number of private functions. These can be accessed from the 'this' keyword.