scene_add_skill
Define instant or normal character skills in a save copy by linking key-triggered client graphs to server-side actions, animations, effects, and hit boxes.
Instructions
Define a skill (技能) in a copy of a save: the platform's way for a player to act beyond walking and the "press F" prompt. A key press runs the skill's client graph, which tells the server, and a server graph on the character does the work. Two types are made. "instant" (瞬发技能, the default): no animation, the graph runs the moment the key is pressed. "normal" (普通技能): the character plays one animation (animation = its id: 1001 one-handed sword attack, 1006 raking the ground, 1023 watering, 1025 reaching out a hand; these are the ones the official samples use) and the graph runs at the start of it or graphAtMs milliseconds in (a sword swing that hits when the blade comes down); animationPortion is the number the editor stores for the clip (1 in most samples; the three tools of the farming sample have 0.167, 0.96 and 0.25); effect shows an effect asset at an attach point of the character for some milliseconds of the animation (the official attack skills show the sword 10002152 at "GI_WeaponR" for 1833 ms). The long-press, combo and aiming types, cooldowns and use counts are not made. To make the skill hit things, its client graph triggers a hit box, f.triggerSectorHitboxAtSpecificLocation(...) at the character's own place and rotation: read_knowledge {id:"example-strike"} has the call with the values of the official attack (a sector 3 m long, 50 damage, once per target); it damages creatures, and objects that have a hurtBox (scene_add_components). graphId is a client skill graph made first with scene_add_graph {kind: "characterSkill"}; its source is g.characterSkill({id, name, prefix:false}).on('start',(evt,f)=>{f.notifyServerNodeGraph('word','','');}) (a client graph cannot create or change things). A server graph hands the skill to a character at run time, f.addCharacterSkill(character, skillId, CharacterSkillSlot.Skill1E, TopOfStackSkillDestructionType.Destroy): slots are NormalAttack (the attack button), Skill1E, Skill2Q, Skill3R, Skill4T and CustomSkillSlot1 to 15; f.deleteCharacterSkillBySlot takes it away. A server graph on the character template (scene_add_graph attachToPrefab "character") hears whenSkillNodeIsCalled with evt.callerEntity and evt.parameter1 to 3. The records written are byte for byte those of the official samples: the instant skill 放下工具 and the normal skill 耙子-开垦 of 耕种-采集流程, and the timed attack with a sword of 命中与受击. Writes a new .gil in the workspace; the official save is not touched. Verified in play: the instant type on 2026-10-10 (given on the E key, pressed, heard by the character graph); the normal type on 2026-10-11 (examples/skills: the three animations play, the sword shows in the hand, each graph reaches the server; the sword attack carries the character 0.65 m forward and the raking 0.55 m). A skill has no cooldown of its own here; a graph gives it one: when the skill has been used (whenSkillNodeIsCalled on the character's graph), f.setCharacterSkillCd(character, CharacterSkillSlot.Skill1E, seconds, false) makes the slot wait that long, and a press during the wait is refused (verified in play on 2026-10-12, examples/skills/skills_cd_test.json; with the last argument true nothing happens, because the skill has no longest cooldown to be held to). Slots on a PC: Skill1E the E key, Skill2Q Q, Skill3R R, Skill4T the Z key (not T).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| type | No | instant | |
| effect | No | ||
| graphId | Yes | ||
| mapPath | No | ||
| animation | No | ||
| graphAtMs | No | ||
| outputName | No | ||
| animationPortion | No |