ID:271284
 
Okay, I got the Icons made and I have it to where I can buy them from the shopkeeper but when I do it dosnt show their icon when they are in the invetory and it dosnt show them when they are equipted to me (If it even is equpiting when I double click it).

So what I wanna know is how I can fix all that and make them equipable.
You are adding the items to the contents right? Also, did you make the contents visible?
mob
Stat()
statpanel("Inventory", usr.contents)
In response to Chrome Solider
Chrome Solider wrote:
You are adding the items to the contents right? Also, did you make the contents visible?
> mob
> Stat()
> statpanel("Inventory", usr.contents)
>


He clearly stated that he already has an inventory panel as far as I can see. I am just wondering, but did you set an icon and icon state to the weapons such as:

obj/weapon
icon = 'weapon.dmi'
icon_state = "sword"
name = "Sword"

//I prefer this kind of inventory panel below, but you could use whatever.

mob/Stat()
statpanel("Inventory")
stat("[src]'s Inventory")
stat(src.contents)
stat("Item Amount:",src.contents.len)


Also, this demo should help you.
In response to Quest Industries
Umm I dont think it works and that demo didnt help with everything.

Here are the codes I have in:

Weapon Codes:

obj
Sword
name="Sword"
icon='Allicons.dmi'
icon_state="sword"
Shield
name="Shield"
icon='Allicons.dmi'
icon_state="shield"
Armor
name="Armor"
icon='Allicons.dmi'
icon_state="armor"

When ever I buy one of them from the shopkeeper I cant equipt them.
In response to Lanzo Kuryuu
You have to actually make procs or verbs that equip (no t) them. The game doesn't know what you want your objs to do by itself.

I suggest you read chapter 4, 5, and 6 of the DM Guide, and Wizkid0123's demo on equipment (only one I could find... hope it's good, heh).



In response to Zagreus
On that demo it dosnt show the item on the player, that is my main problem I need help with.
In response to Lanzo Kuryuu
I don't understand when people put all their icons in one dmi. I would highly recommend using different dmi files for each object, so you can use the icon_states for different uses of that object. Then, suppose you have an icon for a piece of armor. You can have an icon_state for what it looks like in your inventory, and another for what it looks like on your character.

overlays += image(weapon.icon,"equipped")


You can then use the image proc, something like that to add an image of that object, in it's proper icon_state to your character. I would recommend clearing all your overlays and re-adding them by cycling through equipped items with a for loop, and making this check only when items are worn or removed.
In response to Lanzo Kuryuu
Lanzo Kuryuu wrote:
On that demo it dosnt show the item on the player, that is my main problem I need help with.

If you mean overlays then you'd have to make them yourself.
In response to DerDragon
DerDragon wrote:
I don't understand when people put all their icons in one dmi.

Well, its mostly a matter of preference.

I would highly recommend using different dmi files for each object, so you can use the icon_states for different uses of that object.

You can still do that with a single dmi file for multiple objects.
> overlays += image(weapon.icon,"equipped")
>

You can then use the image proc, something like that to add an image of that object

Yeah. Note that in image() the icon_state is the 3rd argument.

I would recommend clearing all your overlays and re-adding them by cycling through equipped items with a for loop, and making this check only when items are worn or removed.

Why?
In response to Kaioken
Kaioken wrote:
Well, its mostly a matter of preference.

I just prefer things to be easier to work with.

You can still do that with a single dmi file for multiple objects.

Yes, but then you'd need to have icon_states with an identifier both for the object and it's particular state. This presents an issue when you want things simple in your code. For instance, if I were to have several pieces of equipment that each have a state for an overlay being worn and just being in your inventory, I'd have to have something to the effect of "hat_worn" and "hat_inv". Then, when I wanted to set the state of that object to the proper one, I'd have to use something like "[src.name]_worn" rather than just "worn".

Yeah. Note that in image() the icon_state is the 3rd argument.

I could be wrong but I think image works a little like range() about that. I was probably confusing it with icon() though, which, although I wouldn't recommend it, would work too.

Why?

The overlays list acts kind of weird. Once you add overlays to the list, there's no nice way of keeping track of them anymore. It really doesn't take much time to cycle through a list and re-add overlays. I'd know, I've done it in most of my BYOND games, in some of them, in pretty much happened with every movement. Even if it does take a few milliseconds, you'll probably only be running the check when the equipment changes, when you wear or remove an item.
In response to DerDragon
DerDragon wrote:
The overlays list acts kind of weird. Once you add overlays to the list, there's no nice way of keeping track of them anymore.

Keeping track no, unless you have a custom list to do that. But they can mostly be easily removed, unless you want to update all of them there isn't really a reason to flush them.
In response to Kaioken
But they can mostly be easily removed

How exactly would you go about that? In all my experience with overlays, that has never worked out how I needed it to.
In response to DerDragon
DerDragon wrote:
But they can mostly be easily removed

How exactly would you go about that?

Highly depends on the way you've added them in the first place, and there're multiple ways to.

In all my experience with overlays, that has never worked out how I needed it to.

Well, sorry to be rude and obvious, but you've obviously had something wrong, then.
In response to Kaioken
Highly depends on the way you've added them in the first place, and there're multiple ways to.

Could you provide an example?

From the overlays entry in the reference: "The individual items in the list may not be directly accessed, since they are stored in a special internal format."

All I'm getting at is, once you've added something to your overlays list, there's no way of going back into that list and referencing it, which is critical for removing the specific items you're concerned with. You could go about storing the order you added overlays in some external way, but it's really not worth the extra effort, you won't be saving yourself any trouble by doing it this way.
In response to DerDragon
DerDragon wrote:
Highly depends on the way you've added them in the first place, and there're multiple ways to.

Could you provide an example?

Really, make some effort on your own; that very reference entry itself has examples already (are you blind?).

From the overlays entry in the reference: "The individual items in the list may not be directly accessed, since they are stored in a special internal format."

Yes, and just 1-2 lines after that there are examples of ways to remove overlays... Anyway, what that quoted part means, is that you can't individually access overlays, ie grab an overlay icon from overlays, or modify an overlay. You can remove them, however, just not actually access them.

So yes, please read WHOLE reference entries.

there's no way of going back into that list and referencing it,

Pretty much, yes.

which is critical for removing the specific items you're concerned with.

Nah. You know which "items" are in the "list" because you're adding them yourself. Anyway, you mostly just basically have to copy the line you used to add the overlay, and change the '+=' there to '-=', thats about it.
In response to Kaioken
" Since the loc argument could never be a text string, the statement can be further shortened:
image('pants.dmi',"red")
"
In response to Kaioken
Ah, I neglected that because I usually made changes to the icons before adding them to the overlays list anyways, and there is no point in me keeping the reference of what I used to add that overlay. I suppose most people on BYOND just use their icons as-is.

you mostly just basically have to copy the line you used to add the overlay, and change the '+=' there to '-=', thats about it.

This is of course assuming you're doing this within the same section of code, which would be meaningless, or you're adding an overlay defined globally, which aside from object types, would also be silly.
In response to Keeth
Thank you, I thought that was correct
In response to DerDragon
I'm not too experienced with the visual aspects of BYOND, seeing as I usually only work on the engines, but what little experience I do have on the subject:

You can't just go digging around in the overlays list, which means unless you have an existing referance of the object/image/icon you're trying to get rid of (which you can't actually learn from the overlay list, which means it all has to be attained through external sources, although in most scenarios, you will know what you're trying to get rid of), it will be very hard to remove it.

And sometimes you don't have control over the overlays being added to something. I can't think of a scenario off of the top of my head, but god knows there's one out there.

As for images, unless you know the values of the original image (the icon and icon state, etc).. well... you can't very well get rid of it, can you?

You will need an outside reference of the image somewhere to get rid of it in most cases.

Like I said, I'm not a guru when it comes to the handling of icons and such. That's just the result of logical thinking. I could be and probably am wrong about something there.
In response to Keeth
That doesn't contradict my post. =P
Page: 1 2