ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Mon Jul 16, 2018 4:42 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sun Dec 11, 2016 10:57 pm 
Offline
Higher

Joined: Mon Aug 04, 2014 10:27 pm
Posts: 49
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!


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 11:17 pm 
Offline
Sher'Tul

Joined: Mon Jun 23, 2014 11:50 am
Posts: 1439
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.


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 11:37 pm 
Offline
Higher

Joined: Mon Aug 04, 2014 10:27 pm
Posts: 49
Not sure what you mean about priority.

I'm pretty sure they replace the map, both have "data/maps/towns/last-hope.lua".


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 11:52 pm 
Offline
Uruivellas

Joined: Mon Sep 21, 2015 8:45 pm
Posts: 633
Location: Middle of Nowhere
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.


Top
 Profile  
 
PostPosted: Tue Dec 13, 2016 6:51 pm 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1541
Location: A shallow water area south of Bree
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..."


Top
 Profile  
 
PostPosted: Wed Dec 14, 2016 12:18 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5720
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.

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Thu Dec 15, 2016 10:30 am 
Offline
Higher

Joined: Mon Aug 04, 2014 10:27 pm
Posts: 49
For Housepet. Addon as it stands right now.


Attachments:
tome-tinkerlasthope.zip [3.64 KiB]
Downloaded 39 times
Top
 Profile  
 
PostPosted: Fri Dec 16, 2016 1:18 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5720
Fixed and refined.


Attachments:
tome-tinkerlasthope.zip [4.25 KiB]
Downloaded 34 times

_________________
My feedback meter decays into coding. Give me feedback and I make mods.
Top
 Profile  
 
PostPosted: Tue May 09, 2017 3:27 am 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1541
Location: A shallow water area south of Bree
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:
    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:
    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},
          },
       },
    }

Overall, though, very useful addon. I can't imagine playing a tinker character in AoA without it.

_________________
"Blessed are the yeeks, for they shall inherit Arda..."


Top
 Profile  
 
PostPosted: Wed Aug 16, 2017 5:53 pm 
Offline
Wayist

Joined: Wed Jan 07, 2015 7:51 pm
Posts: 27
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:
Code:
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)


I also added the fixed{} entries to to schematics store and uploaded it as Tinker Stores in Last Hope - Tinker.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group