so basically as part of an update for my mod redemption I'm attaching techs to a set of armor via status effects I've basically got things working but since I'm using the system mighty annihilator used for the wasp wings item (with his permission) I need to basically have the armor pieces fire quests when obtained I'm not happy with how intrusive that is so I'm wondering if there's any way to get the init() and uninit() to fire without any quests running in the background (keep in mind I know next to no LUA, so if anyone is willing to edit the script used that would be nice, I'll supply it on demand)
I have no idea what your current script is doing and all that so I'll keep this basic. You can run a script with a status. Case in point /items/armors/backitems/lanternstick/lanternstick.back In there you find this Code: "statusEffects" : [ "lanternglow" ], That adds the status "lanternglow" when equipped, and obviously removes it if the piece is removed. There is no particular reason that you couldn't add this to chest armor etc. That status effect can be found here - /stats/effects/lanternglow/lanterglow.statuseffect Code: { "name" : "lanternglow", "effectConfig" : {}, "defaultDuration" : 5, "scripts" : [ "lanternglow.lua" ], "animationConfig" : "lanternglow.animation" } The script itself is just this Code: function init() script.setUpdateDelta(3) end function update(dt) animator.setFlipped(mcontroller.facingDirection() == -1) end function uninit() end So you have an easy way to call upon init() when equipping and uninit() when removing it. I don't know if you are having the script swap equipped techs, or handing whatever it does in the status script. Supposing you want a set requirement, then make seperate statuses. The chest status can also check for the status of the head and pants existing.
basically I'm using this script here (albeit modified for different techs and armor pieces, such as the legs tech and leg armor): https://pastebin.com/RQgNP92R however, it's used by a quest (hence why it's stored under /quests/scripts/items) but yeah, trying something completely different could work too if you think there's a better way
A status effect like this - Code: { "name" : "red_legTech", "effectConfig" : { "itemTech" : "armok_legTech", //I have no idea what your tech is actually named "techSlot" : "legs" }, "scripts" : [ "techEquip.lua" ] } and a script like this Code: function init() local techSlot = config.getParameter("techSlot") local itemTech = config.getParameter("itemTech") storage.techStored = player.equippedTech(techSlot) player.equipTech(itemTech) end function uninit() player.equipTech(storage.techStored) end That might do it. I "think" (don't remember for sure) that it won't be important to "enable" and "disable" the tech being available and unlocked if you intend to directly assign it via player.equipTech() One thing that might ruin this simple implementation - I also don't know off the top of my head if status scripts can access the player table. If you get an error about indexing a nil value... that's the problem. I recall that somehow player_primary.lua actually can't access the player table LOL - because the devs simply never added it there. They didn't need it for what THEY wanted to do in vanilla. I do not know offhand if the status scripts suffer from this, but if you get that error you're probably stuck with doing it via quests like you already are. But if that does work, that's a more lightweight way to do it. You can then just make a copy/pasted .statuseffect file for each piece of equipment you want to make with this intent. Just set the slot and techname for each status. The script itself reads the data from the .statuseffect file so you don't need it customized for each one.
welp, I got this error when trying to work it out: https://pastebin.com/KVTt997i I'm probably doing something wrong on my end if you ask me, or well, I hope it's just me (ignore the error with the mechrepair gun)
nevermind, got it to work but it just ends up not doing anything, looks like I'm back to using quests (although it's become clear to me that invisible quests are indeed possible, looks like I should be fine now)