- Jan 22, 2019
- 1,729
- 2,160
Described most of the issue in the thread title. Basically I want to allow the player to swap from say an iron helmet to a steel helmet without unequipping the iron helmet first. I have no coding experience and just really started with Sugarcube/Tweego a couple weeks ago, so I'm mostly on the basics atm (No javascript yet). My current solution is:
Basically I create a bunch of IF statements checking what the current weapon/armor piece, then I return it to the player inventory and return all the stats that previous gear piece gave the player before adding the new piece. It seems to work okay, issue is I can see this being obnoxious to scale up. Any time I add a new equip/weapon, I have to go through all the other armor/weapon pieces that use the same slot and add it to their if statements.
At a hundred armor sets, It'd be a nightmare to add new sets. I know the simple solution is just to make the player unequip a slot before adding a new piece of gear to that slot, but I want to avoid that if possible. I guess one extra click wouldn't be the end of the world if there's no easy way to scale this up without each gear piece taking longer to add to the game. I guess I could set up a widget or something to make it a bit better but I'm sure there's a much more efficient solution.
Also I know I don't need the getcheckweight in every if statement and could just put it at the end, that was something new I was testing and I'll be fixing that soon.
You don't have permission to view the spoiler content.
Log in or register now.
Basically I create a bunch of IF statements checking what the current weapon/armor piece, then I return it to the player inventory and return all the stats that previous gear piece gave the player before adding the new piece. It seems to work okay, issue is I can see this being obnoxious to scale up. Any time I add a new equip/weapon, I have to go through all the other armor/weapon pieces that use the same slot and add it to their if statements.
At a hundred armor sets, It'd be a nightmare to add new sets. I know the simple solution is just to make the player unequip a slot before adding a new piece of gear to that slot, but I want to avoid that if possible. I guess one extra click wouldn't be the end of the world if there's no easy way to scale this up without each gear piece taking longer to add to the game. I guess I could set up a widget or something to make it a bit better but I'm sure there's a much more efficient solution.
Also I know I don't need the getcheckweight in every if statement and could just put it at the end, that was something new I was testing and I'll be fixing that soon.
Last edited: