//!tgscript v1 //! script name=Chest //! region graph //! node 1 OnUpdate pos=(60,80) export function onUpdate(ctx) { //! node 2 FindEntity pos=(260,80) entity=Hero const n2_value = ctx.findEntity("Hero"); //! node 3 GetEntityPosition2D pos=(460,80) const n3_value = ctx.getEntityPosition2D(n2_value); //! node 4 GetPosition2D pos=(460,200) const n4_value = ctx.getPosition2D(); //! node 5 Vec2Distance pos=(660,120) const n5_out = ctx.vec2Distance(n3_value, n4_value); //! node 6 ConstNumber pos=(660,240) const n6_value = 1.00; //! node 7 Less pos=(860,120) const n7_out = (n5_out < n6_value); //! node 8 Branch pos=(1060,80) if (n7_out) { //! node 9 ConstNumber pos=(1060,240) const n9_value = 1.00; //! node 10 SetGlobal pos=(1260,80) global=won ctx.setGlobal("won", n9_value); } } //! endregion