- This topic has 3 replies, 2 voices, and was last updated 9 years, 8 months ago by Anonymous.
-
AuthorPosts
-
April 6, 2015 at 3:31 pm #5371AnonymousInactive
The reason being, that mods can only be loaded to the current game AFTER the loading of the save has occured, and if while loading the game encounters an item type that it doesn’t recognize, it goes batshit insane and crashes, basically.
Take the following code:
items["MyNewItem"]= { id: Object.keys(items).length, x: 0, y: 0, name: "My first item", weight: 0.5 } itemGet({type:"MyNewItem",quality:'Exceptional'},"hi")
Here we create a new item, giving it an iterative ID so that all the for loops work fine and it doesn’t override any other ID. We then give it to the player, and everything is hunky dory, it’s a regular item, woot. But the second that we reload the game everyone dies. Which is a MASSIVE limitation on modding.
IN CONCLUSION: If modding is to be a serious thing, it should definitely be at the main menu.
April 6, 2015 at 3:57 pm #5373Vaughn “Drathy” RoykoKeymasterHello Yairm,
Modding is definitely not finalized and as it stands there is no API or consistency with any of that (as of 1.9.2), although, in 2.0 we are looking at addressing these issues by integrating fully into the Steam Workshop. This will allow modders to share/install/uninstall mods in a more permanent fashion by loading brand new files, or overwriting files completely with custom content/features (on/during game load, not after). Of course there will be plenty of compatibility issues to solve there, but at least modders and mod users will have the option.
April 7, 2015 at 12:09 am #5374AnonymousInactiveOK, thanks! =)
April 7, 2015 at 2:56 am #5375AnonymousInactiveSince I’m on a roll here anyway, I’ll put the generic pseudo-mod code here:
If you load it at the title screen through the browser console, then you can successfully load and save the game.
Hope this helps get some mods on the road later, if the API isn’t completely different by then, that is.
Note: if we use multiple mods, then each one needs to save its own so that we can ‘unload’ each mod seperately and not have to wipe the slate clean. Probably should be a Mods object which contains mods keyed by name, each with its own items and skills, for easier loading and unloading.
InitMod = function(){ newItems = { // All the items we'll want to add will need to be saved, at least by name, in order to unload them later MyNewItem: { x: 0, y: 0, name: "My first item", weight: 0.5 }, MyFirstOverpoweredSword: { x: 24, y: 0, name: "Totally Not A Golden Sword At All", weight: 3, durability: 1500, equip: "held", attack: 50, damageType: ['piercing', 'slashing'], use: ["carve"], group: ["sharpeneditem", "treasure"], recipe: { requires: [ ["polelike", 1, 1] ], skill: "blacksmithing", level: "intermediate" } } } for(i in newItems){ items[i] = newItems[i] items[i].id = Object.keys(items).length // This will allow us to load MULTIPLE mods, and in a different order each time! Since the id gets assigned dynamically } } WeWasNeverHere = function(){ // For deleting all 'new' items on the player, so that the save file can load normally even without the mod. Does not delete items in environment though. cont=true while(cont){ cont=false for(i in player.invItems){ debugger; if(newItems[player.invItems[i].type]){cont=true; removeItem(i, 'INV', false); break;} } } }
-
AuthorPosts
- You must be logged in to reply to this topic.