ID:1017701
 
Code:
obj/overlays

icon = 'cardico.dmi' //GLOBAL SETS FOR OVERLAYS IN GENERAL
layer = FLOAT_LAYER -4

animation

pixel_x = -32
pixel_y = -32

icon = 'summon.dmi'

SS/icon_state = "_SS"
NS/icon_state = "_NS"


FS
icon = 'summon_.dmi'
icon_state = "_FS"

mob/var/tmp/obj/cards/Monster1

mob/verb/Summon_Animation()

usr.Monster1.overlays += /obj/overlays/animation/NS


Problem description:

In my game, clicking the verb above I would expect the overlay to play. It does not.

Normally the above is done within the procs of the game during gameplay, and I noticed that after a certain version of BYOND (v493 I think) that they just stopped working in certain procs.


What makes this issue really annoying is that sometimes the overlay WILL show up. I have not been able to find out why, and have spent many hours trying to pinpoint the conditions that would cause the proc to work at one time but not another. But it seems to make no sense at all - in general though the above code does NOTHING.

The overlays are animated, and 96 x 96 pixels.

[b]EDIT:[/b]

Ok I just changed (in real time) the icon_state of the icon the overlay was applied to, and the overlay appeared!!! It will only play when I mess around with the icon_state. This explains why it plays at certain times in my game, as in some situations the icon_state of the object is changed to reveal the icon as the animation is played.

Can someone please explain what is going on and why this is happening? My standard non-animated overlays do not seem to be affected.

:( This used to all work fine for many many years (6 of them! My game has been going for a long time).
From what I understand, overlays and underlays conform their icon state to match the player's. You could make a image with the icon_state you need to add to the overlay or simply make it seperate icons and apply them as such. Other than that, you'd have to change the mob/obj's icon_state var to whatever you need.
Well the thing is the overlay shows up when I change the obj's icon_state to anything. Null, or its own icon_state as long as its visibly changed to one thing from what it is - the overlay will show up and play through its frames. I say visibly changed because I tried to flick the icon_state back and forth in code (so it happened instantly changing the objs icon_state to NULL then adding the overlay then changing the objs icon_state back to initial() all at the same time) however this did not work.

Also the overlays for other things work fine, but they are not animated and are 32 x 32.

Either-way it makes no sense that this worked fine for at least 2 years, then with a BYOND release (about 4 months ago) just stopped functioning. I did not investigate more at that time because it was exactly around that time that I took a break from BYOND.

Now I am finding this issue a headache. I am starting to think this is a BYOND bug, or something they changed with how overlays work thats broken it.
In response to UnknownDuelist
I've not experianced any issues with overlays like such, but I've also never attempted an overlay with its own icon_state. Have you attempted to fiddle with the image() proc? OR, tried giving the overlays seperate icons all together?
I have moved the overlays to seperate icon files with no icon_states, and they still will not appear. I am not quite sure what use the image() proc would be in this case?

The only way I can get the overlays to play is seemingly to add them to the object in question (using += /obj/overlays...) then change the icon_state of the object its been added to to anything and it will suddenly play over it. It has to be a visible icon_state change though -if its done flicked in code instantly it does not work.

Adding overlays and underlays are fine, as long as they are 32 x 32.

The reason it was working with other things (and so confusing the situation) was because my game made the icon invisible in some cases (by setting it to null) for game play purposes. It seems this action resulted in the overlay being shown because the icon_state was being changed at the right time (fluke really).

Edit: Ah-ha! Ok so I got the 64x64 overlay to show up again by making it 1 frame! And again by making it not looped once....