Sogaple Posted January 26, 2016 Share Posted January 26, 2016 First of all, sorry that I'm littering the forums with small, half baked questions, but I really thought this was quite a different topic, and that I't wouldn't be appropriate to just comment on my previous post. Sorry. Well, I have been trying to make and augment that increases both an Agents augmentMaxSize stat and his augmentMaxCapacity stat. I tried to copy the script from "useAugmentMachine.lua" since you know, augment grafters have the option to add extra augment slots: elseif choice == 2 then if userUnit:getTraits().augmentMaxSize >= (userUnit:getTraits().augmentMaxCapacity or simdefs.DEFAULT_AUGMENT_CAPACITY) then mission_util.showDialog( sim, "", STRINGS.UI.DIALOGS.AUGMENT_MACHINE_MAXED ) sim:dispatchEvent( simdefs.EV_UNIT_USEDOOR_PST, { unitID = userUnit:getID(), facing = facing } ) else sim:dispatchEvent( simdefs.EV_PLAY_SOUND, {sound="SpySociety/Objects/AugmentInstallMachine", x=x0,y=y0} ) userUnit:getTraits().augmentMaxSize = userUnit:getTraits().augmentMaxSize + 1 userUnit:setKO( sim, 2 ) unit:getTraits().used = true unit:getTraits().mainframe_status = "off" sim:dispatchEvent( simdefs.EV_UNIT_REFRESH, { unit = unit } ) sim:getStats():incStat("safes_looted") sim:triggerEvent(simdefs.TRG_USE_AUGMENT_MACHINE, { unit=userUnit, shop = unit, newslot = true } ) end (The script I copied Is highlighted in red) Well, I tried to post this trait into Deckard's default augment, just as a test..: augment_deckard = util.extend( commondefs.augment_template ) { name = STRINGS.ITEMS.AUGMENTS.DECKARDS, desc = STRINGS.ITEMS.AUGMENTS.DECKARDS_TIP, flavor = STRINGS.ITEMS.AUGMENTS.DECKARDS_FLAVOR, traits = util.extend( commondefs.DEFAULT_AUGMENT_TRAITS ){ userUnit:getTraits().augmentMaxSize = userUnit:getTraits().augmentMaxSize + 1, addAbilities = "scandevice", installed = true, }, profile_icon = "gui/icons/item_icons/items_icon_small/icon-item_generic_head_small.png", profile_icon_100 = "gui/icons/item_icons/icon-item_generic_head.png", }, (Here is where I added the script) I even added a comma after it, since all other traits have it too. And well, the game crashes every time I try to run it. There is clearly an issue. The script must be context sensitive, and only work in augment grafters. But why? I looked through "itemdefs.lua" and "useAugmentMachine.lua", and I can't find any reason for it to not serve its purpose in both. After all, all the script does is add another socket. And for reference, I DID look through Sharp's augment script. Its tool tip saying that it grants 6 augment slots is a lie. All it does, is add extra KO damage when the augment thresholds are met. The 6 augment slots are a part of Sharp's default stats, not his augment. I saw this as a sign from Klei that they had problems implementing augments that add extra augment slots. Since Sharp was the only one who used an augment like this, they used a quick workaround. Effective, except it leaves inexperienced madders like me in the dark. As to increasing the augmentMaxCapacity... I'm not even sure if its possible. Can someone help? Link to comment Share on other sites More sharing options...
wodzu_93 Posted January 26, 2016 Share Posted January 26, 2016 What you've done here is putting function call into a table ( as indicated by { and } brackets and commas after every entry), so game crashes because it can't interpret it. Since both augmentMaxSize and augmentMaxCapacity are agent traits, you use "modTrait" to passively increase them, like this: traits = util.extend( commondefs.DEFAULT_AUGMENT_TRAITS ){ modTrait = {{"augmentMaxSize", 2}, {"augmentMaxCapacity", 2}}, grafterWeight = 10, }, This will increase both current amount of slots (augmentMaxSize) and maximum amount of slots(augmentMaxCapacity) by 2. In general, don't use function calls inside a table. If you don't have any prior experience in programming, I suggest to skim over this this tutorial: http://www.tutorialspoint.com/lua/index.htm as Invisible Inc uses LUA language. Link to comment Share on other sites More sharing options...
Sogaple Posted January 26, 2016 Author Share Posted January 26, 2016 Thanks a lot. This Is my first time using LUA, so I'm sorry if these questions are amateurish. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.