Can you update the unit template to also include the following after the above line
"LuaScript": "LAST_STORED_LOCATION = ""\r\n\r\nfunction onSave()\r\n local data_to_save = {\r\n\t\tlastStoredLocation = LAST_STORED_LOCATION,\r\n }\r\n return saved_data\r\nend\r\n\r\nfunction onLoad(saved_data)\r\n\tLAST_STORED_LOCATION=""\r\n\tLOCKED = false\r\n \r\n if saved_data ~= "" and not bRefresh then\r\n\t\tLAST_STORED_LOCATION = loaded_data.lastStoredLocation\r\n\tend\r\n createMenus()\r\nend\r\n\r\n---------------------------------------------------------------------\r\n-- FNAME: createMenus\r\n-- DESC: Create menu for object\r\n---------------------------------------------------------------------\r\nfunction createMenus()\r\n\tself.clearContextMenu()\r\n\tself.addContextMenuItem("Store Location", storeLocation, false)\r\n\tself.addContextMenuItem("Recall Location", recallLocation, false)\r\nend\r\n\r\nfunction storeLocation()\r\n\tLAST_STORED_LOCATION = { position = self.getPosition(), rotation = self.getRotation()}\r\nend\r\n\r\nfunction recallLocation()\r\n\tif LAST_STORED_LOCATION == nil \r\n\t\tthen return \r\n\tend\r\n\tself.setPosition(LAST_STORED_LOCATION.position)\r\n\tself.setRotation(LAST_STORED_LOCATION.rotation)\r\nend",
Infinity-Army-Tools/resources/templates/unit_template.json
Line 23 in fb5de3f
Can you update the unit template to also include the following after the above line
"LuaScript": "LAST_STORED_LOCATION = ""\r\n\r\nfunction onSave()\r\n local data_to_save = {\r\n\t\tlastStoredLocation = LAST_STORED_LOCATION,\r\n }\r\n return saved_data\r\nend\r\n\r\nfunction onLoad(saved_data)\r\n\tLAST_STORED_LOCATION=""\r\n\tLOCKED = false\r\n \r\n if saved_data ~= "" and not bRefresh then\r\n\t\tLAST_STORED_LOCATION = loaded_data.lastStoredLocation\r\n\tend\r\n createMenus()\r\nend\r\n\r\n---------------------------------------------------------------------\r\n-- FNAME: createMenus\r\n-- DESC: Create menu for object\r\n---------------------------------------------------------------------\r\nfunction createMenus()\r\n\tself.clearContextMenu()\r\n\tself.addContextMenuItem("Store Location", storeLocation, false)\r\n\tself.addContextMenuItem("Recall Location", recallLocation, false)\r\nend\r\n\r\nfunction storeLocation()\r\n\tLAST_STORED_LOCATION = { position = self.getPosition(), rotation = self.getRotation()}\r\nend\r\n\r\nfunction recallLocation()\r\n\tif LAST_STORED_LOCATION == nil \r\n\t\tthen return \r\n\tend\r\n\tself.setPosition(LAST_STORED_LOCATION.position)\r\n\tself.setRotation(LAST_STORED_LOCATION.rotation)\r\nend",