Need some help

new shops and ui changes

Hey guys. Been doing some work on some new mods. Has anyone done any work on creating whole new shops - ie i would like to be able to purchase upgrades at towers.

Secondly, does anyone know if it is possible to increase the number of ability slots/consumable slots?

Cheers.

Exx

1,803 views 5 replies
Reply #1 Top

Ok so i have solved the first half of the problems associated with making towers a new shop.

 

They are now clickable with the coin icon however, i am getting the message

 

*AI ERROR : No Shop Type found of ugbdefence02 - Adding shop table

 

does anyone know what this refers to or a ssolution? (i think it may be the scripted shopping action or the SCREEN_UI files that are associated with shopping but i am unsure of a fix).

 

Cheers.

Reply #2 Top

What did you change to make it clickable?  Shop category?

Regardless, citadel upgrades are quite a bit different from normal shops.  What you're looking for is in lua\sim\tasks\BeginShopTask.lua, line 73.  It checks for categories.STRONGHOLD before displaying the citadel shop, otherwise it tries to display the basic store - just expand this check to categories.STRONGHOLD + categories.DEFENSE, or something like that, and see what happens.

 

As for adding new regular shops, even that could prove difficult.  They started some code in Shop.lua for determining which tabs a shop had available, but it's unimplemented in the blueprints and in SCREEN_shop_tabbed.lua, so I'd guess that all three of these things would require an extensive rewrite to actually allow a different shop unit  to display a different set of tabs.  Or you could just hack it into SCREEN_shop_tabbed, like they did for the artifact store.  Again, none of this applies to citadel upgrades though.

Reply #3 Top

Ty for your help, it gave me some interesting outlooks on how to fix my problems!

Ok so now i can summon a tower purchased as an item from the consumable store which will open a shop window with my shop tree inside (ie items). However when i click on the icon to make a purchase nothing happens. (i have managed to get a tabbed shop working :)).

The problem is that the game doesnt seem to recognize a new file with the tower shop items in them (ie what are currently itemtype_Item.lua files)

ie the error  *AI ERROR : No Shop Type found of ugbdefence02 - Adding shop table

seems to be this missing file. However, i have no clue as to how import my new file into a shop table for the towers.

 

Any ideas?

 

 

Reply #4 Top

Did you try searching for that error string?  Most warning messages are actually in the lua, not the engine.

It's in lua\sim\AI\BrainPlanner.lua, with a similar category check.  However, I think this is just for the AI - so this warning shouldn't actually be the cause of the current problem.

Have you added ugbdefense02 (or whatever other units you're using as shops) to the checks in SCREEN_shop_tabbed.lua?  Honestly, I'm not seeing anywhere else in the lua that ugbshop01 and ugbshop05 are mentioned.  If you're adding allowances for whatever unitids you're trying to shop from to SCREEN_shop_tabbed, then I'm out of ideas.

 

Edit: Try adding some log messages in SCREEN_shop_tabbed, in all of the conditions under tree.OnItemClick.  See if that's what's not letting you pick items.  I have a feeling it has to do with the ShopGUI.Shop variable, which seems to hold a reference to the shop's unitid entity id:

Code: c++
  1. ShopGUI.Shop = GetUnitById(Sync.BeginShop.Shop)

..but I don't know exactly what this would affect, as I don't see anything special about say ugbshop01 that lets it function as a shop, other than that its script is inheriting from the Shop class instead of the base StructureUnit class.  And I don't see anything in the Shop class that should enable shopping.   Welp.

 

Edit 2: There's also CanPickItem in lua/common/ValidateShop.lua, and HandleItemPurchase in lua/sim/Item.lua.  Might try logging some of their conditions/parameters if you don't have any luck with OnItemClick.

Reply #5 Top

Found the problem, i was referencing the wrong tab in the 'show' fuction in SCREEN_shop_tabbed.

Thanks for your help!

Lol will prbly need it again soon tho :)

 

Exx