...
The JSON functions will use the save game state of the object , since it has to be actively spawned to convert to JSON. You cannot JSON convert UTC files themselves. when using ObjecToJson (ie an actively spawned creature). To convert from a template to JSON use TemplateToJson. This means some of the fields on the base UTC file isn't are not available on the save game which is an instance.
Fields
game version, and some have altered names.
Fields
Example is from the example ObjectToJson from a spawned NPC. You do not need all these values to have a valid template to spawn, and can check some older UTC files in the game files to see what is a more minimal creature (eg nw_ac_badger01.utc is the level 1 badger animal companion)Example is from the example ObjectToJson from a spawned NPC.
Most of the values would be sought by first getting the key-value pair, extract the "value" entry then JsonToXXX it. Structs and lists need further loops to extract/change things.
...
| Key Name | JSON Type | nwscript Type | Example | nwscript Get | nwscript Set | Description and Notes | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Age | int | int | 0 | GetAge | It appears NPCs can have an age, it just defaults to 0. You could use JSON to set it, although age isn't really used by the game. | |||||||
| AmbientAnimState | byte | int | 0 | Instanced information about what animation the creature is doing | ||||||||
| AnimationDay | dword | int | 0 | Presumably day of the month the animation will end | ||||||||
| AnimationTime | dword | int | 0 | Presumably milliseconds the animation will end | ||||||||
| Appearance_Head | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | Head appearance ID | ||||||
| Appearance_Type | word | int | 1 | GetAppearanceType | SetCreatureAppearanceType | appearance.2da line identifier | ||||||
| AreaId | dword | object | 1 | |||||||||
| ArmorClass | short | int | 13 | GetAC | ||||||||
| ArmorPart_RFoot | byte | int | 1 | |||||||||
| BaseAttackBonus | byte | int | 0 | GetBaseAttackBonus | ||||||||
| BodyBag | byte | int | 0 | See bodybag.2da for what this integer refers to | ||||||||
| BodyBagId | dword | object | 2130706432 (OBJECT_INVALID) | Presumably if they have a "Lootable corpse" it's the body bag spawned in relation to this creature if they're dead, so the body can be removed if this is. 2130706432 is "invalid object"object". | ||||||||
| BodyPart_Belt | byte | int | 0 | GetCreatureBodyPart | SetCreatureBodyPart | Note the bodyparts can be set to armor parts, which are shown if no armor part is covering it. | ||||||
| BodyPart_Belt | byte | int | 0 | GetCreatureBodyPart | SetCreatureBodyPart | BodyPart_LBicep | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |
| BodyPart_LFArm | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_LFoot | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_LHand | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_LShin | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_LShoul | byte | int | 0 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_LThigh | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_Neck | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_Pelvis | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_RBicep | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_RFArm | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_RHand | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_RShin | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_RShoul | byte | int | 0 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_RThigh | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| BodyPart_Torso | byte | int | 1 | GetCreatureBodyPart | SetCreatureBodyPart | |||||||
| Cha | byte | int | 10 | GetAbilityScore | Charisma | |||||||
| ChallengeRating | float | float | 1.0 | GetChallengeRating | Note the toolset has the default assigned rating plus an adjustment value, which is compiled into a final value in game which this is. | |||||||
| ClassList | list | json | GetClassByPosition | The list contains the json array for a class, level, and their memorised spells and spell school/domain choices. See secondary table below. | ||||||||
| Color_Hair | byte | int | 1 | PLT colour for hair | ||||||||
| Color_Skin | byte | int | 1 | PLT colour for skin | ||||||||
| Color_Tattoo1 | byte | int | 1 | PLT colour for tattoo 1 | ||||||||
| Color_Tattoo2 | byte | int | 1 | PLT colour for tattoo 2 | ||||||||
| CombatInfo | struct | json | This contains a number of combat-related pieces of info like weapons equipped, damage dice applicable to certain slots, arcane spell failure etc.. Nothing too exciting.failure etc.. Nothing too exciting. Used at the character select screen to give a rough overview of what they do usually. | |||||||||
| CombatRoundData | struct | struct | This presumably is only populated in combat - in a save game this would contain things like "I'm currently attacking creature ID xxx" | |||||||||
| Con | byte | int | 14 | GetAbilityScore | Consitution | |||||||
| Conversation | resref | string | testnpc | Dialogue file resref; may be useful with BeginConversation etc. | ||||||||
| CreatnScrptFird | byte | int | 1 | Not sure | ||||||||
| CreatureSize | byte | int | 3 | GetCreatureSize | Ususally tied to appearance.2da line | |||||||
| CurrentHitPoints | short | int | 4 | GetCurrentHitPoints | SetCurrentHitPoints | |||||||
| DataMigration | int | int | 1 | Not sure, presumably migration from 1.69 data | ||||||||
| DeadSelectable | byte | int | 0 | SetIsDestroyable | Selectable by Dead property of the creature. You can only set this not get it in default nwscript. | |||||||
| DecayTime | dword | int | 5000 | Presumably milliseconds to decay corpse. In the toolset you can only use seconds, default is 5, so this is in miliseconds. | ||||||||
| Deity | cexostring | string | GetDeity | SetDeity | Not able to be set in the toolset (And likely stripped) but nwscript can set it for PCs and NPCs. | |||||||
| Description | cexolocstring | json | { } | Needs testing; probably localised string(s) for description field, so array value 0 would be English. | ||||||||
| DescriptionOverr | cexostring | GetDescription | SetDescription | Override description presumably when SetDescription is used | ||||||||
| DetectMode | byte | int | 0 | SetActionMode | Noting as per usual Elves (which this is) who have "passive == active" detect modes will have this always set to 0. | |||||||
| Dex | byte | int | 14 | GetAbilityScore | Dexterity. | |||||||
| Disarmable | byte | int | 1 | GetIsCreatureDisarmable | General disarmable flag on the creature properties. | |||||||
| EncounterObject | dword | object | 2130706432 (OBJECT_INVALID) | This presumably is "if I was spawned from an encounter, this is what object to tell I've died when I die". It likely is used to validate GetIsEncounterCreature but there is no usual way to get this object. | ||||||||
| Equip_ItemList | list | json | List of equipped items, eg; your crossbow in your hand. Rather large and involved array. | |||||||||
| Experience | dword | int | 0 | May be copied from PCs with ObjectToJson, needs testing. NPCs do not usually have experience obviously. | ||||||||
| FactionID | word | int | 4 | ChangeToStandardFaction(for 1 - 4) | This is the internal faction ID. Faction IDs apart from the base 4 are generated on starting the module but shouldn't change after that, and are otherwise not retrievable. | |||||||
| FamiliarName | cexostring | string | GetFamiliarName | PCs get the option of setting this during levelup, NPCs do not (it's stripped from the toolset UTC generated files). You can workaround setting this by spawning the familiar then using SetName on it. | ||||||||
| FamiliarType | int | int | 0 | GetFamiliarCreatureType | Index into hen_familiar.2da but cannot be set in toolset (it's stripped) but NPCs can validly have one. | |||||||
| FeatList | list | json | Current feats the creature has. Not sure if it is altered on levelup and down or what. | |||||||||
| FirstName | cexolocstring | json → json first value 0 → string | TestNPC (After checking array) | The creatures first name, localised array though so you need to parse the entry to get the language ID you need. Note GetName gets FristName + " " + LastName, although conversations can generate tokens which are only the first name. | ||||||||
| FootstepType | int | int | -1 | GetFootstepType | SetFootstepType | No need for JSON, although interestingly it defaults to -1 apparently if not set (so it auto looks up the right value from appearance.2da I guess) | ||||||
| FortSaveThrow | char | int | 1 | GetFortitudeSavingThrow | Fortitude Saving Throw. | |||||||
| Gender | byte | int | 0 | GetGender | Finally you might be able to do a belt of gender swap (with NPCs at least!) | |||||||
| Gold | dword | int | 0 | GetGold | GiveGoldToCreature, TakeGoldFromCreature | |||||||
| GoodEvil | byte | int | 100 | GetGoodEvilValue | AdjustAlignment | Good/Evil alignment value. | ||||||
| HitPoints | short | int | 4 | This is Max Hit Points - constitution bonuses apparently, so the base rolls of the creatures levelups (like d4 = 4 for this Wizard) plus additional HP from the UTC file. See MaxHitPoints for the "true" maximum hit points. | ||||||||
| Int | byte | int | 16 | GetAbilityScore | Intelligence value | |||||||
| Interruptable | byte | int | 1 | Is the "No Interrupt" flag on the creature blueprint. | ||||||||
| IsCommandable | byte | int | 1 | GetCommandable | SetCommandable | Commandable flag, note the engine commonly sets this (effects, functions the game does) a lot. | ||||||
| IsDM | byte | int | 0 | GetIsDM | Probably would break things if you flag an NPC as a DM. Or it'll ignore it. | |||||||
| IsDestroyable | byte | int | 1 | GetIsRaiseable | SetIsDestroyable | Can only set this not get this in nwscript; it stops DestroyObject from running on the creature, and helps with lootable/raisable corpses. | ||||||
| IsImmortal | byte | int | 0 | GetImmortal | SetImmortal | Immortality flag | ||||||
| IsPC | byte | int | 0 | GetIsPC | If they are a PC. Not sure if DM possession messes with this, but leaving IsPC set on an NPC can affect GetIsPC (since this means when a PC is possessing their familiar the original "host body" still is a PC) so clear it on NPCs. | |||||||
| IsRaiseable | byte | int | 1 | GetIs | SetIsDestroyable | Allows raising of this creature via. EffectRessurection presumably. Can't get this only set it in default nwscript. | ||||||
| ItemList | list | json | All the items in their inventory with all sorts of arrays for properties and everything else. Likely even in a small inventory to be the majority of the json. Also in nwscript you can edit items very easily so little use for this. | |||||||||
| LastName | cexolocstring | json → json first value 0 → string | "" | The creatures last name, localised array though so you need to parse the entry to get the language ID you need. Note GetName gets FristName + " " + LastName, although conversations can generate tokens which are only the last name. | ||||||||
| LawfulChaotic | byte | int | 0 | GetLawChaosValue | AdjustAlignment | Lawful/Chaos alignment value. | ||||||
| Listening | byte | int | 0 | SetListening | Can only set if they're listening not get if they are. Applies to listening strings used by the AI mainly. | |||||||
| Lootable | byte | int | 0 | GetLootable | SetLootable | Is the "Leaves Lootable Corpse" setting in the toolset, but can be set (before their killed) via. nwscript | ||||||
| MClassLevUpIn | byte | int | 0 | Not sure, something to do with multiclassing | ||||||||
| MasterID | dword | object | 2130706432 (OBJECT_INVALID) | GetMaster | AddHenchman and others | The master object. There are like other fields to classify the creature. | ||||||
| MaxHitPoints | short | int | 5 | GetMaxHitPoints | This appears to be HitPoints + Constitution bonuses/penalties. | |||||||
| MiscVisuals | struct | json | Contains HiLite colour info and Mouse Cursor info. See SetObjectHiliteColor and SetObjectMouseCursor | |||||||||
| MovementRate | byte | int | 4 | GetMovementRate | Index into creaturespeed.2da - see Creature Movement. | |||||||
| NaturalAC | byte | int | 0 | Will be added onto the AC of the creature (See ArmorClass for the total). Presumably is equal to the amount set in the toolset on the creature properties. Not sure if altered by levelups in Dragon Disciple etc. but likely is. | ||||||||
| NoPermDeath | byte | int | 0 | Is the "No Permanent Death" option in the toolset on a creature. Will stop them exploding from damage/death, but otherwise does not affect DestroyObject. | ||||||||
| OverrideBAB | byte | int | 0 | SetBaseAttackBonus / RestoreBaseAttackBonus | Unlike what the function and name mentions it actually is the amount of base attacks granted to a creature with the function SetBaseAttackBonus. | |||||||
| PM_IsPolymorphed | byte | int | 0 | Are they under the effect of EffectPolymorph. Presumably has additional fields when polymorphed. | ||||||||
| PerceptionList | list | json | A list of active things the creature perceives, so a list of objects they can see/hear. | |||||||||
| Phenotype | int | int | 0 | GetPhenoType | SetPhenoType | Creatures phenotype | ||||||
| Plot | byte | int | 0 | GetPlotFlag | SetPlotFlag | Plot flag | ||||||
| PortraitId | word | int | 36 | GetPortraitId | SetPortraitId | Index into portraits.2da. | ||||||
| PregameCurrent | short | int | 5 | No idea but matches MaxHitPoints | ||||||||
| Race | byte | int | 1 | GetRacialType | racialtypes.2da line ID, may allow changing racial type (but you'd need to manually alter some of the other bits - such as stats, feats, etc.) | |||||||
| RefSaveThrow | char | int | 3 | GetReflexSavingThrow | Reflex Saving Throw | |||||||
ScriptAttacked ScriptDamaged ScriptDeath ScriptDialogue ScriptDisturbed ScriptEndRound ScriptHeartbeat ScriptOnBlocked ScriptOnNotice ScriptRested ScriptSpawn ScriptSpellAt ScriptUserDefine | resref | string | GetEventScript | SetEventScript | The scripts the creature uses | |||||||
| SitObject | dword | object | 2130706432 (OBJECT_INVALID) | Must be used with ActionSit of course. | ||||||||
| SkillList | list | json | GetSkillRank | List of all skills (at least at the time of saving in case skills.2da changes later) along with their ranks in JSON lists/structs. Presumably this is the "Live" rank thus including all relevant bonuses (ability scores etc.) and penalties. | ||||||||
| SkillPoints | word | int | 0 | Presumably the The amount of skill points "leftover" from levelups, not applicable to NPCs mind you only PCs. | ||||||||
| SoundSetFile | word | int | 110 | GetSoundset | SetSoundset | The index into soundset.2da of the soundset the creature is using. It gets set to 65535 if it is blanked out on the UTC, thus invalid. | ||||||
| StartingPackage | byte | int | 10 | GetCreatureStartingPackage | Used in LevelUpHenchman if CLASS_TYPE_INVALID is passed in for the first class slot being levelled up, and is a line in packages.2da | |||||||
| StealthMode | byte | int | 0 | GetActionMode | SetActionMode | If the creature is in stealth mode or not | ||||||
| Str | byte | int | 10 | GetAbilityScore | Strength | |||||||
| Subrace | cexostring | string | "" | GetSubRace | SetSubRace | Subrace is a text field pretty much unused by the game by default (it's not even shown on the character sheet). | ||||||
| Tag | cexostring | string | TestNPC | GetTag | SetTag | Tags are used to identify objects or find them with GetObjectByTag. | ||||||
| Tail_New | dword | int | 0 | GetCreatureTailType | SetCreatureTailType | Creature tail type | ||||||
| TemplateResRef | resref | string | testnpc | GetResRef | Creatures resref which should point to the UTC file it was spawned from | |||||||
| VisualTransform | struct | json | GetObjectVisualTransform | SetObjectVisualTransform | Visual transform info (scaling, translation etc.) | |||||||
| WillSaveThrow | char | int | 3 | GetWillSavingThrow | Will saving throw | |||||||
| Wings_New | dword | int | 0 | GetCreatureWingType | SetCreatureWingType | Creature wing type | ||||||
| Wis | byte | int | 12 | GetAbilityScore | Wisdom | |||||||
XOrientation XPosition YOrientation YPosition ZOrientation ZPosition | float | float | X, Y coordinates, or radian based orientation | These obviously get overriden if you are spawning in a creature object with JsonToObject. ZPosition isn't used (creature snaps to the walkmesh) but was "envisioned to be used". The orientation is set as a facing in GFF blueprints. | ||||||||
| __data_type | special | string | UTC | Only value that isn't a type/value pair. Straight string. | ||||||||
| fortbonus | short | int | 0 | Fortitude saving throw bonus, presumably the toolset field, not sure if XXXSavingThrow has the grand total or this is added on dynamically. | ||||||||
| refbonus | short | int | 0 | Reflex saving throw bonus, presumably the toolset field, not sure if XXXSavingThrow has the grand total or this is added on dynamically. | ||||||||
| willbonus | short | int | 0 | Will saving throw bonus, presumably the toolset field, not sure if XXXSavingThrow has the grand total or this is added on dynamically. |
...