JSON example and query

I posted an example of using a JSON to tweak a random NPC prior to spawning.

Also, a question about why changing FactionID in the JSON doesn’t seem to work.

Comments welcome (on the original thread, if convenient)

I don’t know my beamdog forum password right now so I have to write here.

If you compare the jsons before and after ChangeToStandardFaction() you’ll see that FactionID has changed from 1 to 2.

Setting FactionID to 2 right away would create a non-hostile NPC.

[edit]Just remembered the password so I’ve made the post at beamdog forum too :smiley: [/edit]

The actual engine constants for the standard factions are 1 higher than the nwscript ones.

Engine:
STANDARD_FACTION_HOSTILE = 1;
STANDARD_FACTION_COMMONER = 2;
STANDARD_FACTION_MERCHANT = 3;
STANDARD_FACTION_DEFENDER = 4;

Nwscript:
STANDARD_FACTION_HOSTILE = 0;
STANDARD_FACTION_COMMONER = 1;
STANDARD_FACTION_MERCHANT = 2;
STANDARD_FACTION_DEFENDER = 3;

You’d use the engine constants for any gff related editing.

Who knew? :slightly_smiling_face: