-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: setup initial Character's inventory #2600
Comments
This can be done very easily with code generation afaict. |
Then, where would be the line between things written into the game data and added to generated code? |
Well, it can be done by adding things in game28.dta too. |
I actually am not against the idea of doing things in script in general, that sounds rather flexible, and especially suitable if we support dynamic creation of objects. But there may be caveats. We must keep in mind that anything done in script may have side effects, and that may be not good when we are initializing an initial game state, especially in the auto generated code (that user may not be aware of). For instance, AddInventory function triggers eEventAddInventory event, so it should not be used. There may be other similar cases, and there's no guarantee that something of that sort is not added in the future. In regards to inventory though, I just realized that Character data already has inventory array in game data. It was simply never used when compiling the game: Line 144 in 1d01739
ags/Common/ac/characterinfo.cpp Line 65 in 1d01739
Since it's already there, I suppose it's easier to just put this data there. |
Wait, I was an idiot. This array IS used when compiling the game, that's how the "player starts with this item" works: ags/Editor/AGS.Editor/DataFileWriter.cs Lines 1650 to 1654 in 1d01739
So, right, this is the most natural place to write it then. |
since the characters may have any items, and possibly repeating items - at minimum it would require the checkbox combobox we use for game platform settings. If we want to be able to setup the number of such item, it may require a proper custom editor for this or an overview pane of all characters and their inventories. |
Yes, I suggest a dialog with a list inside:
I am not sure if item order can be done through the editor though, because order is a separate array in the runtime data which is not present in game data... so maybe not. |
In regards to UI, i dont have any final vision. |
This suggestion is opened after a user's question.
Currently AGS only allows to mark inventory items that are added to player character at game start. This is done by setting each item's "PlayerStartsWithItem" property.
Sometimes it may be desired to have several characters begin with some items in their inventories. The character roles is mostly irrelevant, these may be playable characters, or NPCs. This may be done in script, but would be convenient for users to also have a way to set this up in the editor directly.
The idea is to have Inventory property in Character instead. This property would hold a list of inventory items. In Properties Grid this property would have a "..." button, which opens a dialog window with a list, that lets add and remove items, set their quantity and change their order.
These lists would be added to the compiled game data, and used to initialize each character's starting inventory contents.
The Character has "inv" array already present in the game data, but it's only filled for the starting player character, and only for items marked as "player starts with this item":
ags/Editor/AGS.Editor/DataFileWriter.cs
Lines 1650 to 1654 in 1d01739
The text was updated successfully, but these errors were encountered: