scene_add_graph
Add an empty node graph to a copied save, attach server graphs to entities or prefabs, and return its graphId as targetGraphId for write_graphs.
Instructions
Add an empty node graph to a copy of a save and, for a server graph, attach it. The platform is event driven and its games are many small graphs, each on the entity it is about: attachToPrefab puts the graph on a prefab (元件) so that every copy of it, placed or created later, runs its own instance and receives its own events (a coin that is picked up, a pay station, a door); attachToPrefab "player" puts it on the player template (per-player state such as score) and "character" on the character template; attachTo names one placed entity (default 关卡实体, the stage entity: level-wide things such as the clock, and the only place that hears whenEntityIsDestroyed of objects and creatures). An entity can run several graphs, and one graph can sit on several prefabs that behave alike (attachToPrefab as a list: a wooden and a stone wall, three kinds of coin). kind makes another kind of graph instead, none of which is attached to an entity: boolFilter, a client graph with a yes/no test that an option of an option tab can name so that it shows only to players for whom it is true (scene_add_components filterGraphId; verified in play); characterSkill, the client graph a skill runs (scene_add_skill names it; verified in play); item, a server graph that hears the events of one item, such as its being used from the backpack (scene_add_item useGraphId names it; verified in play); creatureSkill, creatureStatus, creatureDecision, the client graphs of complex creatures: what a skill of the creature does, one of its behaviours (a list of tactics and skills), and the graph that picks the behaviour (scene_add_creature_skill and scene_set_creature_logic wire them to a creature; verified in play, read_knowledge {id:"example-brain"}). A new map has no node graph, and write_graphs needs one to write into: call this, then use the returned graphId as targetGraphId. The name gets the prefix GSTS if it lacks it (graphs with that prefix are the ones these tools may overwrite). Writes a new .gil in the workspace and returns its path; the official save is not touched.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | server | |
| name | No | ||
| mapPath | No | ||
| attachTo | No | ||
| outputName | No | ||
| attachToPrefab | No |