ID:138633
 
How do I get it so overlays perform the same icon_states as the mobs they are overlaid on? This poses a problem when I have the swinging animation everyone was screaming for in Maeva I.
On 4/19/00 8:40 am DerDragon wrote:
How do I get it so overlays perform the same icon_states as the mobs they are overlaid on? This poses a problem when I have the swinging animation everyone was screaming for in Maeva I.


Just set the loc of the overlay to the mob it applies to -- I believe this does the trick.

See Guy T's Pants demo for complete code.
In response to Deadron
Just set the loc of the overlay to the mob it applies to -- I believe this does the trick.

See Guy T's Pants demo for complete code.


Here's the link to the demo: PantsQuest!

It works with changing directions--e.g., if the mob faces east, his shirt will face that way too--but I really don't know if it will work with animations in general. If you have some animations already made, though, it should be pretty easy to plug them into the code and see how it goes. Good luck!
In response to Guy T.
Thats my problem, it works fine with direction and movement, but thats because its set to the src. It follows it same movement patterns so it faces the same directions, however, there is no way, that I know of, to set the icon_state for it, swinging isn't a movement state but it has the icon in different positions. I intend on keeping my mobs clothed, and swinging is just one of my animations, theres also sleeping and sitting. I was wondering if you could set the icon_state in the code as such.
var/i = image(O.icon,src)
i.icon_state = src.icon_state
view() << i

This recieves an error that i doesn't have an icon_state variable. Anways, HELP and stuff
In response to DerDragon
On 4/19/00 12:56 pm DerDragon wrote:
Thats my problem, it works fine with direction and movement, but thats because its set to the src. It follows it same movement patterns so it faces the same directions, however, there is no way, that I know of, to set the icon_state for it, swinging isn't a movement state but it has the icon in different positions. I intend on keeping my mobs clothed, and swinging is just one of my animations, theres also sleeping and sitting. I was wondering if you could set the icon_state in the code as such.
var/i = image(O.icon,src)
i.icon_state = src.icon_state
view() << i

This recieves an error that i doesn't have an icon_state variable. Anways, HELP and stuff

Here's an idea to try. Since you can use an object instance as the source of the image, you can probably create a "dummy" object, set its icon and icon_state to what you want, then use the dummy object to create your image. I think that should work (if I remember right, it's what I do in PantsQuest). Something like this:

var/obj/tempObj = new /obj() //no need to give it a location--you only want it for its looks. :)
tempObj.icon = 'playerActions.dmi'
tempObj.icon_state = "swinging"
var/i = image(tempObj,src)
view() << i

Good luck!