//!tgscript v1 //! script name=Quest //! region graph //! node 1 OnUpdate pos=(60,80) export function onUpdate(ctx) { //! node 2 FindEntity pos=(60,220) entity=QuestText const n2_value = ctx.findEntity("QuestText"); //! node 3 GetGlobal pos=(60,320) global=hasSword const n3_value = ctx.getGlobal("hasSword"); //! node 4 GetGlobal pos=(60,420) global=slain const n4_value = ctx.getGlobal("slain"); //! node 5 GetGlobal pos=(60,520) global=coins const n5_value = ctx.getGlobal("coins"); //! node 6 GetGlobal pos=(60,620) global=won const n6_value = ctx.getGlobal("won"); //! node 7 ConstNumber pos=(60,720) const n7_value = 0.50; //! node 8 ConstNumber pos=(60,820) const n8_value = 2.00; //! node 9 ConstNumber pos=(60,920) const n9_value = 3.00; //! node 10 Less pos=(260,320) const n10_out = (n3_value < n7_value); //! node 11 Less pos=(260,420) const n11_out = (n4_value < n8_value); //! node 12 Less pos=(260,520) const n12_out = (n5_value < n9_value); //! node 13 Less pos=(260,620) const n13_out = (n6_value < n7_value); //! node 30 GetGlobal pos=(60,1020) global=started const n30_value = ctx.getGlobal("started"); //! node 31 Less pos=(260,1020) const n31_out = (n30_value < n7_value); //! node 32 Branch pos=(460,1020) if (n31_out) { //! node 33 SetText pos=(660,1020) text="Meadow Quest" ctx.setText("Meadow Quest", n2_value); } else { //! node 14 Branch pos=(460,80) if (n10_out) { //! node 15 SetText pos=(660,80) text="Talk to the farmer" ctx.setText("Talk to the farmer", n2_value); } else { //! node 16 Branch pos=(660,240) if (n11_out) { //! node 17 SubNumber pos=(660,420) const n17_out = (n8_value - n4_value); //! node 18 SetTextNumber pos=(860,240) prefix="Slimes left: " ctx.setTextNumber("Slimes left: ", n2_value, n17_out); } else { //! node 19 Branch pos=(860,400) if (n12_out) { //! node 20 SubNumber pos=(860,560) const n20_out = (n9_value - n5_value); //! node 21 SetTextNumber pos=(1060,400) prefix="Coins to find: " ctx.setTextNumber("Coins to find: ", n2_value, n20_out); } else { //! node 22 Branch pos=(1060,560) if (n13_out) { //! node 23 SetText pos=(1260,560) text="Open the chest!" ctx.setText("Open the chest!", n2_value); } else { //! node 24 SetText pos=(1260,720) text="You did it!" ctx.setText("You did it!", n2_value); } } } } } } //! endregion