Staredit Network > Forums > SC2 Assistance > Topic: Dialog Inventory System
Dialog Inventory System
Feb 1 2011, 4:01 am
By: Riney  

Feb 1 2011, 4:01 am Riney Post #1



So this is what I have right now



Now, as obvious as it is, there are 4 slots, all empty at this moment. Ill be using buttons when there is actually an item occupying a slot that calls up a trigger and then proceeds to do appropriate actions.

Now heres where the questions that I have come in. I want to make this as efficient as possible before having to scrap parts of the code to remake it better. Right now I have issues with: How to make stacked items drop as Items in the world, How to detect those items that are dropped when picked up, and has anyone here ever done a system like this before?

Thanks in advance. This system is going to be used on a collaboration project between a friend of mine, myself, and muh bro. Honesty if you'd rather come on Teamspeak 3 (LingieSRV.DynDNS.org:8767) and talk instead of typing that would be great.



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 1 2011, 5:05 am Roy Post #2

An artist's depiction of an Extended Unit Death

This sounds like it would fit better under Theories, but I see why you put it here.

Are you familiar with code design at all? Or rather, have you ever designed something before attempting to implement it?

Described succinctly, a design code is a document that sets rules for the design of a new development. It is a tool that can be used in the design and planning process, but goes further and is more regulatory than other forms of guidance commonly used in the English planning system over recent decades. It can be thought of as a process and document and therefore a mechanism which operationalises design guidelines or standards which have been established through a masterplan process. The masterplan or framework is the vision. It should be accompanied by a design rationale that explains why, followed by a code that gives instructions to the appropriate degree or precision and that is operational.


You want to know every single requirement, and then how everything is going to interact with each other. Ideally, you do not want to refactor or have duplicate code, but these things will occur unless you're a ninja at designing.

Quote from Riney
How to make stacked items drop as Items in the world, How to detect those items that are dropped when picked up...
This sounds perfect for a hashmap or dictionary, but I don't think SC2 has those. So I would suggest having a function to convert the item to whatever you need the button to be (an icon?), and vice-versa. Then, whenever an item is picked up or dropped, you can call those functions to automatically get the value you need.

Quote from Riney
... has anyone here ever done a system like this before?
Not me! At least not in SC2.




Feb 1 2011, 9:36 pm Ahli Post #3

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Item Utility Library can do some things or at least teach you how a few things can be done.
I'm dropping items with that but I've played the demo map and there you had a stack of grenades.




Feb 2 2011, 1:10 am Riney Post #4



Quote from Roy
Not me! At least not in SC2.

Go play Night of the Dead :P

Quote from Roy
This sounds perfect for a hashmap or dictionary, but I don't think SC2 has those. So I would suggest having a function to convert the item to whatever you need the button to be (an icon?), and vice-versa. Then, whenever an item is picked up or dropped, you can call those functions to automatically get the value you need.

Dont need to worry about picking the items up right now, simply throwing them down. I know there has to be a way to detect how many of a stack of an item there is in your inventory, but Im still curious as to how. I suppose I should have just put at the end: Need to know how to detect item stack, instead of going into such detail first.

Quote from Ahli
Item Utility Library can do some things or at least teach you how a few things can be done.
I'm dropping items with that but I've played the demo map and there you had a stack of grenades.

Now I did, for one map I tried to make, use this library, but I found it to be rather difficult in its own way. I suppose this could help in this map of course.



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 11 2011, 1:36 am Riney Post #5



Alright so Ive made progress on my 'concept' of sorts, and I must say I like it so far.



And heres the map if you're curious: [attach=7692]

Attachments:
afterlifetest.SC2Map
Hits: 3 Size: 222.5kb



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 11 2011, 6:13 am payne Post #6

:payne:

Looks very clean. :>



None.

Feb 11 2011, 11:27 am NicholasBeige Post #7



I tried making a system like this when Starcraft 2 was released. For stacks of items you'll need to use a variable to store an integer alongside each item slot. And then refer to this variable whenever the item in that slot is used, dropped or acquired.

The number will also have to be displayed (which I think you've managed).

Then you just call a function whenever a player uses his dialogue inventory panel, check what button he pressed, whether he left or right clicked (not sure if that functionality is possible). So, create a 'tick box' that will toggle dropping - on or off, boolean obviously. When 'drop mode' is on, left clicks on a dialogue button which contains a stack of items, should open a new dialogue - allowing the player to choose how many items from the stack to drop - probably use a slider. You can make 'drop-mode' automatically turn off after 5 seconds / or 5 seconds after the player unit is issued an order / or if the player unit is attacked. So when in combat, you're not still on 'drop-mode' and if you try to use a medikit, you won't end up throwing it on the floor like a 4 year old child angry at his toys.

Are you using Data Tables?

Post has been edited 1 time(s), last time on Feb 11 2011, 11:57 am by Cardinal.



None.

Feb 11 2011, 10:39 pm Riney Post #8



Right now Its just variables and a dialog. Ive never really looked at data tables.

And to be honest, I think I may have found a way to make it so you could click and drag the item onto the ground and leave the whole drop mode out of the whole thing.



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 11 2011, 10:48 pm Ahli Post #9

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Quote from Riney
Right now Its just variables and a dialog. Ive never really looked at data tables.

And to be honest, I think I may have found a way to make it so you could click and drag the item onto the ground and leave the whole drop mode out of the whole thing.
how?




Feb 11 2011, 11:20 pm Riney Post #10





Im sure I could make it a lot cleaner with array usage, but Im being lazy right now.



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 11 2011, 11:48 pm NicholasBeige Post #11



Quote from Ahli
Quote from Riney
And to be honest, I think I may have found a way to make it so you could click and drag the item onto the ground and leave the whole drop mode out of the whole thing.
how?

Yes. How?



None.

Feb 11 2011, 11:56 pm Riney Post #12



Oh that. Ill get back to you when I (If I CAN) figure it out :P



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 12 2011, 12:04 am NicholasBeige Post #13



Hunch: Somehow make a trigger to activate when two events occur simultaneously - Player clicks mouse button down AND player interacts with Dialogue Button. Then create image at mousePos and update it until Mouse click Up - create relevant item at mouse location / order unit to move to mouse location etc.



None.

Feb 12 2011, 12:13 am Riney Post #14



That was the idea. But Im having trouble detecting what button you clicked based on a condition because when I choose what to compare it to, its always a blank box that says string.



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 12 2011, 1:14 am Riney Post #15



I decided, Im just going to make it work like this. If you click an item you use it. If you push I or B (Inventory or bag idk) it opens up the command card for inventory management. D will make your next click drop an item. A will cAncel any choice you may have made. S will Split a stack you choose. M (Maybe) will move a stack to the designated slot).

This just annoyed me too hard, and I dont want to halt production over something I cant figure out when I dont need it, ya know?


But I am having a problem that needs to be corrected. I cant figure out how to create an image on a dialog for a specific player.

Edit: Ive actually resolved my own problem, somehow the one time I tried this method it didnt work, and now this time it did (Odd).

Heres where we're at now



I had to move the numbers because they werent exactly right aligned, and looked nasty when they were higher than a single digit.

Disregard the stupid message in the command card, thats for others that I wanted to fuck with ;o

Post has been edited 4 time(s), last time on Feb 12 2011, 1:45 am by Riney.



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 12 2011, 2:02 am Ahli Post #16

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

You can create 1 dialog for every player and store everything in arrays. That's pretty much a must, if the content is dynamic and not every player sees the same.




Feb 12 2011, 3:01 am payne Post #17

:payne:

Quote from Riney


Im sure I could make it a lot cleaner with array usage, but Im being lazy right now.
Start using arrays now or get enormous headaches in some near futur. ;o



None.

Feb 12 2011, 5:27 am Riney Post #18



Quote from payne
Quote from Riney


Im sure I could make it a lot cleaner with array usage, but Im being lazy right now.
Start using arrays now or get enormous headaches in some near futur. ;o




Teehee



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Feb 12 2011, 6:03 pm payne Post #19

:payne:

Quote from Riney
Quote from payne
Quote from Riney


Im sure I could make it a lot cleaner with array usage, but Im being lazy right now.
Start using arrays now or get enormous headaches in some near futur. ;o




Teehee
MOAR!
You should use 2 arrays on each item in order to reduce the repetitivness of those "Slot 1 to 4".



None.

Feb 12 2011, 7:57 pm Riney Post #20



Quote from payne
Quote from Riney
Quote from payne
Quote from Riney


Im sure I could make it a lot cleaner with array usage, but Im being lazy right now.
Start using arrays now or get enormous headaches in some near futur. ;o




Teehee
MOAR!
You should use 2 arrays on each item in order to reduce the repetitivness of those "Slot 1 to 4".

You're going to kill me xD



Riney#1693 on Discord. (Discord Community)
Riney on Steam (Steam)
Youtube Channel

-- Updated as of October 2019 --

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:36 am]
O)FaRTy1billion[MM] -- u
[04:26 am]
RexyRex -- me
[2020-8-08. : 4:47 pm]
NudeRaider -- F1 2018 currently for free: https://www.humblebundle.com/store/f1-2018-free-game
[2020-8-08. : 10:55 am]
NudeRaider -- the :wob: ? I'm in! :wob:
[2020-8-08. : 8:29 am]
UndeadStar -- Tried magic boxes again, lost :thumbdown: , so back to where I was before trying. Only thing left to do, the ˸wob˸ :wob:
[2020-8-07. : 5:38 pm]
MTiger156 -- :wob: wob n' bob :wob:
[2020-8-07. : 12:43 am]
Wing Zero -- u
[2020-8-06. : 10:34 pm]
RIVE -- :wob:
[2020-8-06. : 9:42 pm]
lil-Inferno -- :wob:
Please log in to shout.


Members Online: Roy