Making an addon, pretty much done but one issue left
Moderator: Moderator
Making an addon, pretty much done but one issue left
If this is the wrong forum, I apologize.
So I decided I wanted to make an addon that added tinker shops to Last Hope. I have no experience coding or anything, but after looking at Razakai's Improved Stores addon it proved to be fairly simple.
I succeeded in what I wanted to do: adding four shops to last hope. One for Steamsaws, one for Steamguns, one for Implants, and one for Schematics.
The addon works fine except for one issue. Whenever I load both my addon and Improved Stores and create a new character, only one of the addons seems to load. Both show up on the "Requires addons:" line for the character. It's just either my addon's Last Hope with its new shops loads, or Improved Stores' with its new shops. Not both.
I have no idea how I would go about fixing this, if it's even possible. Any help would be appreciated!
So I decided I wanted to make an addon that added tinker shops to Last Hope. I have no experience coding or anything, but after looking at Razakai's Improved Stores addon it proved to be fairly simple.
I succeeded in what I wanted to do: adding four shops to last hope. One for Steamsaws, one for Steamguns, one for Implants, and one for Schematics.
The addon works fine except for one issue. Whenever I load both my addon and Improved Stores and create a new character, only one of the addons seems to load. Both show up on the "Requires addons:" line for the character. It's just either my addon's Last Hope with its new shops loads, or Improved Stores' with its new shops. Not both.
I have no idea how I would go about fixing this, if it's even possible. Any help would be appreciated!
Re: Making an addon, pretty much done but one issue left
does either have priority?
because if the addons "replace" a map, instead "adding a patch" onto it, then they will load one, and the other will replace the whole thing erasing the effect of previous.
if i remember correctly, the last to load will be the "effective" one.
because if the addons "replace" a map, instead "adding a patch" onto it, then they will load one, and the other will replace the whole thing erasing the effect of previous.
if i remember correctly, the last to load will be the "effective" one.
Re: Making an addon, pretty much done but one issue left
Not sure what you mean about priority.
I'm pretty sure they replace the map, both have "data/maps/towns/last-hope.lua".
I'm pretty sure they replace the map, both have "data/maps/towns/last-hope.lua".
Re: Making an addon, pretty much done but one issue left
I would recommend looking at HousePet's Midnight addon. Check out how he adds the exits for Midnight and The Orchard to the map of The Gates of Morning. I believe the method he uses only replaces the specific tiles that need to be changed, rather than replacing the whole map. I don't really know much about it myself, but it seems like the kind of thing you would want to do. You can try to catch HP in the IRC channel; he could definitely be of more help than me.
-
- Sher'Tul Godslayer
- Posts: 2520
- Joined: Thu Jan 23, 2003 8:13 pm
- Location: A shallow water area south of Bree
- Contact:
Re: Making an addon, pretty much done but one issue left
Your best bet is the "MapGeneratorStatic:subgenRegister' hook, which is used to add "submaps" to an existing fixed map. That's how the Items Vault addon adds the fortress side room with the command orb in it, so you can look there to see how it works. I've used this hook in a couple addons that I eventually abandoned, and I can confirm that it can be successfully used to add stores to a town. And depending on whether overloads are processed before hooks, it might also survive the presence of another addon that overloads the town map file.
"Blessed are the yeeks, for they shall inherit Arda..."
Re: Making an addon, pretty much done but one issue left
Attempted to rewrite the addon via irc last night.
It doesn't seem to be recognising the store/traps at the moment.
Ran out of time.
It doesn't seem to be recognising the store/traps at the moment.
Ran out of time.
My feedback meter decays into coding. Give me feedback and I make mods.
Re: Making an addon, pretty much done but one issue left
For Housepet. Addon as it stands right now.
- Attachments
-
- tome-tinkerlasthope.zip
- (3.64 KiB) Downloaded 244 times
Re: Making an addon, pretty much done but one issue left
Fixed and refined.
- Attachments
-
- tome-tinkerlasthope.zip
- (4.25 KiB) Downloaded 274 times
My feedback meter decays into coding. Give me feedback and I make mods.
-
- Sher'Tul Godslayer
- Posts: 2520
- Joined: Thu Jan 23, 2003 8:13 pm
- Location: A shallow water area south of Bree
- Contact:
Re: Making an addon, pretty much done but one issue left
Since this seems to be the closest thing to an official forum thread for the Tinker Stores in Last Hope addon, I figured this would be the best place to make a few suggestions for the next release:
- I accidentally left this addon enabled on a character that had Embers disabled, which left Last Hope with four forlorn signless empty tinker-related stores — harmless, but aesthetically unsatisfying. Since you're explicitly using Embers stuff, you probably want to mark your addon as unusable with Embers disabled, so it'll get filtered out by the engine as needed. You can do that by adding the following line to your init.lua:
Code: Select all
requires_addons = { 'orcs' }
- Since Last Hope stores default to tier-3 stock, your schematic store is unlikely to stock some really important tier-1 schematics, like the detrimental effect removal salves. [sound F/X: source diving] Ah, Kruk Pride's schematic store actually adds those in a fixed{} field; I'd suggest following that precedent:
Code: Select all
newEntity{ define_as = "TINKER", name = "tinker", display = '5', color=colors.GREY, store = { purse = 25, empty_before_restock = false, fixed = { {id=true, defined="SCHEMATIC_RANDOM_FROST_SALVE"}, {id=true, defined="SCHEMATIC_RANDOM_FIERY_SALVE"}, {id=true, defined="SCHEMATIC_RANDOM_WATER_SALVE"}, {id=true, defined="SCHEMATIC_RANDOM_STEAMSAW"}, {id=true, defined="SCHEMATIC_RANDOM_STEAMGUN"}, }, filters = { {type="scroll", subtype="schematic", id=true}, {type="scroll", subtype="implant", id=true}, }, }, }
"Blessed are the yeeks, for they shall inherit Arda..."
Re: Making an addon, pretty much done but one issue left
Since there isn't a thread for this addon I'm posting here too. First thanks for making it, its very useful. However it has an issue where it won't be compatible with anything else that modifies last hope in the same way since it overwrites Last Hope's self.post_process. I made a workaround by changing it to preserve and call any other post_process after it does its thing like so:
I also added the fixed{} entries to to schematics store and uploaded it as Tinker Stores in Last Hope - Tinker.
Code: Select all
class:bindHook("Zone:create", function(self, data)
if self.name == "Last Hope" then
local prev = self.post_process -- preserve any other
self.post_process = function(level)
game:onTickEnd(function()
local spot = game.level:pickSpot{type="pop-store", subtype="shop1"}
local g = game.zone:makeEntityByName(game.level, "trap", "IMPLANT_STORE")
game.zone:addEntity(game.level, g, "trap", 12, 24)
game.nicer_tiles:updateAround(game.level, 12, 24)
local spot = game.level:pickSpot{type="pop-store", subtype="shop2"}
local g = game.zone:makeEntityByName(game.level, "trap", "STEAMSAW_STORE")
game.zone:addEntity(game.level, g, "trap", 30, 14)
game.nicer_tiles:updateAround(game.level, 30, 14)
local spot = game.level:pickSpot{type="pop-store", subtype="shop3"}
local g = game.zone:makeEntityByName(game.level, "trap", "STEAMGUN_STORE")
game.zone:addEntity(game.level, g, "trap", 39, 28)
game.nicer_tiles:updateAround(game.level, 39, 28)
local spot = game.level:pickSpot{type="pop-store", subtype="shop4"}
local g = game.zone:makeEntityByName(game.level, "trap", "SCHEMATIC_STORE")
game.zone:addEntity(game.level, g, "trap", 29, 38)
game.nicer_tiles:updateAround(game.level, 29, 38)
end)
if prev ~= nil then prev(level) end
end
end
end)