Hello, having a bit of a syntax problem here trying to setup a bandolier system. Basically this starts in the data editor with 4 weapon containers (or it could be 1 weapon container with 4 slots, I'm not picky), and 4 different weapon items which could be switched at random, could be a ton of other weapons. Anyways, have 4 ability keys setup to fire dummy effects for the triggers to catch, but am having issues figuring out how to find exactly what item is in said slot at that time. We will just call the 4 containers weap1, weap2, weap3, and weap4, or if it is easier can be weap[0-3]. The abilities will be called by abil1, abil2, abil3, and abil4 respectively. Been staring at ways to do this most the night now, one could say I've thought myself stupid at this point, examples of the syntax would be great :)
Edit: I would also be okay with an all data solution, the main important thing is that the user be able to put whatever weapons in the 4 slots, and each ability key corresponds to the 4 weapon slots to allow for fast gun changing in combat. I'm almost positive a data only solution doesn't exist though, stared at varying options under requirements/loot/items/item containers/upgrades/validators to see if any solutions exist, best I could come up with was giving weapons dummy behaviors to get noticed, but this would not allow me to tell which ability should call each weapon, so not what I'm looking for.
Bumping this, maybe I used too many words in my first question. All I really need is how to access a specific slot in my inventory. Inventory at this point is very simple, 2 containers of 4 columns each, 1 for guns 1 for other.
I have been trying it with a variable of type unit followed by a case statement to no avail, I have left a screenshot of what I have in my triggers, I realize that the index is 1 and not 0, but it won't work for either slot.
You can get all items a unit has and you can get the slot for each of these items, if I am not mistaken. Loop through the inventory, all other slots are empty. Does this help you?
Yes, I know of that method, but I'm looking specifically for how to check one item slot. I could assign a global variable to this group, but seems fairly inefficient since I'd have to update this group every time they move an item, drop an item, pick up an item, sell an item, etceteras. Seems simpler just to have it be a periodic event to update current inventory. I'll try that, would love other suggestions though.
So I have made some progress, keyword some. It can at least tell which item is in which inventory slot now, but with a couple issues. First off, I am not at all thrilled that I am calling pick each unit in all items carried by triggering unit just to get a certain container number and slot of said container to shove into a single unit variable. Second, it seems to have the urge to display the message 7 times in a row no matter what. I have tried breaks, returns, moving the general switch statement to no avail. Attached another picture of what I got so far:
It triggers 7 times because the ability has 7 stages, all of which cause the event to fire. Change (triggering ability stage) to like Execute or something and the duplicate messages should vanish.
Thank you BasharTeg, setting it to Generic3 - Execute solved that half of my problem. Still seeking a better way of checking inventory then doing a for each loop every time though if anyone has any suggestions.
Going to dub this one solved even though I still hate having to use Pick each unit in (All items carried by (Triggering Unit)) and do (Actions) to get just one item in one container. If anyone knows a better way I would love to hear it. I'll post some shots of what I used for anyone who might want to do this as well, the junk boolean variable is just so I can call functions without having to use custom script.
I am using this in order to let a player put 4 weapons into a bandolier container and switch to them at will in my Horologium Super Cluster RPG if you curious what on earth all this is for.
Well, there is no function to directly check a slot, this sort of limits us to 3 options:
Check all slots
Keep track of all slots by monitoring all changes and adding them to an external database, like you mentioned before
Use a custom inventory
Aye, I decided on the check all slots route, it overall will only realistically be looping through like 100 times max for a large inventory/equipment area for one event which isn't much, and it isn't like people typically arrange items while in fierce can't have no lag combat. Keep track of all slots seemed like it would cause more lag all the time for no good reason. Custom inventory, as fun as that sounds, I am going to avoid that headache and a half to focus more on parts of the RPG that really matter.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello, having a bit of a syntax problem here trying to setup a bandolier system. Basically this starts in the data editor with 4 weapon containers (or it could be 1 weapon container with 4 slots, I'm not picky), and 4 different weapon items which could be switched at random, could be a ton of other weapons. Anyways, have 4 ability keys setup to fire dummy effects for the triggers to catch, but am having issues figuring out how to find exactly what item is in said slot at that time. We will just call the 4 containers weap1, weap2, weap3, and weap4, or if it is easier can be weap[0-3]. The abilities will be called by abil1, abil2, abil3, and abil4 respectively. Been staring at ways to do this most the night now, one could say I've thought myself stupid at this point, examples of the syntax would be great :)
Edit: I would also be okay with an all data solution, the main important thing is that the user be able to put whatever weapons in the 4 slots, and each ability key corresponds to the 4 weapon slots to allow for fast gun changing in combat. I'm almost positive a data only solution doesn't exist though, stared at varying options under requirements/loot/items/item containers/upgrades/validators to see if any solutions exist, best I could come up with was giving weapons dummy behaviors to get noticed, but this would not allow me to tell which ability should call each weapon, so not what I'm looking for.
@Deadzergling: Go
Bumping this, maybe I used too many words in my first question. All I really need is how to access a specific slot in my inventory. Inventory at this point is very simple, 2 containers of 4 columns each, 1 for guns 1 for other.
I have been trying it with a variable of type unit followed by a case statement to no avail, I have left a screenshot of what I have in my triggers, I realize that the index is 1 and not 0, but it won't work for either slot.
You can get all items a unit has and you can get the slot for each of these items, if I am not mistaken. Loop through the inventory, all other slots are empty. Does this help you?
@Kueken531: Go
Yes, I know of that method, but I'm looking specifically for how to check one item slot. I could assign a global variable to this group, but seems fairly inefficient since I'd have to update this group every time they move an item, drop an item, pick up an item, sell an item, etceteras. Seems simpler just to have it be a periodic event to update current inventory. I'll try that, would love other suggestions though.
@Deadzergling: Go
So I have made some progress, keyword some. It can at least tell which item is in which inventory slot now, but with a couple issues. First off, I am not at all thrilled that I am calling pick each unit in all items carried by triggering unit just to get a certain container number and slot of said container to shove into a single unit variable. Second, it seems to have the urge to display the message 7 times in a row no matter what. I have tried breaks, returns, moving the general switch statement to no avail. Attached another picture of what I got so far:
It triggers 7 times because the ability has 7 stages, all of which cause the event to fire. Change (triggering ability stage) to like Execute or something and the duplicate messages should vanish.
@BasharTeg: Go
Thank you BasharTeg, setting it to Generic3 - Execute solved that half of my problem. Still seeking a better way of checking inventory then doing a for each loop every time though if anyone has any suggestions.
@Deadzergling: Go
Going to dub this one solved even though I still hate having to use Pick each unit in (All items carried by (Triggering Unit)) and do (Actions) to get just one item in one container. If anyone knows a better way I would love to hear it. I'll post some shots of what I used for anyone who might want to do this as well, the junk boolean variable is just so I can call functions without having to use custom script.
I am using this in order to let a player put 4 weapons into a bandolier container and switch to them at will in my Horologium Super Cluster RPG if you curious what on earth all this is for.
Well, there is no function to directly check a slot, this sort of limits us to 3 options:
@Kueken531: Go
Aye, I decided on the check all slots route, it overall will only realistically be looping through like 100 times max for a large inventory/equipment area for one event which isn't much, and it isn't like people typically arrange items while in fierce can't have no lag combat. Keep track of all slots seemed like it would cause more lag all the time for no good reason. Custom inventory, as fun as that sounds, I am going to avoid that headache and a half to focus more on parts of the RPG that really matter.