ID:264973
 
Code:
skill //object data
parent_type = /atom/movable
var
level

kidou
TigerCannon
name = "tiger_cannon"
var
image/tiger_cannon
damage = 0

New()
.=..()
tiger_cannon = image(icon = 'spells/TigerCannon/TigerCannon.dmi')
tiger_cannon.overlays = list(
image(icon = 'spells/TigerCannon/TigerCannon.dmi',pixel_x = 32, pixel_y = -64, layer=FLY_LAYER),
)
///////////////////////
mob/player
verb
zz()
set category = "Keys"
set hidden = TRUE
world << output("triggered","output")
var/skill/kidou/TigerCannon/t = new(src) //object creation?
t.loc = src.loc


Problem description:
The object was created. Now I'm trying to use it. Verb works, image is not showing. Maybe the operation is not as simple as I thought and something is missing?
First of all, technically overlays aren't actually a list of images, according to the reference, but a special format called an appearance. Therefore instead of setting the overlays list equal to another list of images you should probably use overlays.Add() instead to add the list of images to the overlays.

Secondly, image objects don't appear to a player unless you specifically output the image to them. The exception to this would be images in overlays, but you never actually output the tiger_cannon image to any players so it's totally invisible overlays and all.
In response to Cody123100
////////////////////////////////////////////////////////////// data

item
parent_type=/obj
zanpaktou
name = "Zanpaktou"
var
image/zanpaktou
weapon_damage = 0
// weapon_defense = 8
New()
.=..()
zanpaktou = image(icon = 'icons/zanpaktou/zanpaktou.dmi')
zanpaktou.overlays = list(
image(icon = 'icons/zanpaktou/slash0_c.dmi',pixel_x = 0, pixel_y = 0, layer=FLY_LAYER),
image(icon = 'icons/zanpaktou/slash0_t.dmi',pixel_x = 0, pixel_y = 64, layer=FLY_LAYER),
image(icon = 'icons/zanpaktou/slash0_l.dmi',pixel_x = -32, pixel_y = 0, layer=FLY_LAYER),
image(icon = 'icons/zanpaktou/slash0_r.dmi',pixel_x = 32, pixel_y = 0, layer=FLY_LAYER),
)

/////////////////////////////////////////////////////////// action

shinigami
parent_type=/mob/player
var/item/zanpaktou/zanpaktou
New()
.=..()
icon_state = "sheath_walk"
stance=STANCE_SWORD_SHEATHED
zanpaktou = new(src)
refreshOverlays()
refreshOverlays()
.=..()
if(zanpaktou && zanpaktou.zanpaktou)
overlays += 'sheath.dmi'
overlays += zanpaktou.zanpaktou
f11()
set hidden = TRUE
if(stance == STANCE_SWORD_SHEATHED || stance == STANCE_NORMAL)
changeState(STATE_UNSHEATH)
icon_state = "unsheath_walk"
flick("unsheath", src )
sleep(6)
changeState(STATE_NORMAL)
stance = STANCE_SWORD_UNSHEATHED
src.client.screen_P1.icon_state = "UpSlash"
src.client.screen_P2.icon_state = "LeftSlash"
src.client.screen_P3.icon_state = "DownSlash"
src.client.screen_P4.icon_state = "RightSlash"
src.client.screen_Block.icon_state = "SwordBlock"


The image doesn't output to player? For the understanding of DMs sake, If that's what I didn't do, then what is it I did do? And why does this script work (it loads all icon states perfectly) here?. (Only difference is this is a sword and not a blast or anything).
In response to Hulio-G
In this case you are actually adding the image to the overlays of a mob. In the original post you are adding the images to the overlays of another image. Mobs are by default output to all players in DM. Images, however, are not output to players by default.

The essential difference is that images in overlays don't have to be specifically output to the player. They are always visible as long as the atom the overlays are attached to is also visible. But since the original image object isn't visible in your original post the overlays aren't visible either.

You could give the TigerCannon atom an icon and an icon_state instead of trying to handle that through images and then add the image directly to the TigerCannon atom's overlays.

        TigerCannon
name = "tiger_cannon"
icon = 'spells/TigerCannon/TigerCannon.dmi'
var
//image/tiger_cannon
damage = 0

New()
.=..()
//tiger_cannon = image(icon = 'spells/TigerCannon/TigerCannon.dmi')
overlays.Add(list(
image(icon = 'spells/TigerCannon/TigerCannon.dmi',pixel_x = 32, pixel_y = -64, layer=FLY_LAYER)
))


Using something similar to this the TigerCannon would be visible (as it is a movable atom which is output by default to all players) as would any overlays added directly to the atom.


Alternatively, if you wish to control the visibility of the TigerCannon but don't want to use the invisibility variable you can use your original code and just output the TigerCannon's tiger_cannon variable to any players you want to see it.

mob/player
verb
zz()
set category = "Keys"
set hidden = TRUE
world << output("triggered","output")
var/skill/kidou/TigerCannon/t = new(src) //object creation?
t.loc = src.loc
//output image here
for(whoever is allowed to see the image)
whoever << t.tiger_cannon
In response to Cody123100
Alright thinks for the lesson. Helped me understand the issues and come up with a suitable solution. I ended up removing images due to the fact that you cant use flick() with it. (The icon was just repeating over and over, heh).

skill
parent_type = /atom/movable
var
level // skill level?
kidou
TigerCannon
name = "tiger_cannon"
layer = FLY_LAYER
var
damage = 0

New(var/newLoc,var/newDir)
switch(newDir)
if(1)
icon = 'spells/TigerCannon/TigerCannonNORTH.dmi'
pixel_x = -32
pixel_y = 32
if(2)
icon = 'spells/TigerCannon/TigerCannon.dmi'
pixel_x = 0
pixel_y = -128
if(4)
icon = 'spells/TigerCannon/TigerCannonEAST.dmi'
pixel_x = 0
pixel_y = 0
if(8)
icon = 'spells/TigerCannon/TigerCannonWEST.dmi'
pixel_x = -128
pixel_y = -16
..()
//////////////////////////

zz()
set category = "Keys"
set hidden = TRUE
var/skill/kidou/TigerCannon/t = new( src.loc, src.dir )
flick("finish",t)


In response to Hulio-G
I cant seem to get the animation order to work properly using these images. Only the last icon_state is showing.

    skill
parent_type = /atom/movable
var
level // skill level?
kidou
TigerCannon
name = "tiger_cannon"

var
image/tiger_cannon// = null
damage = 0


New(var/newDir,var/mob/player/m)
.=..()
usr << "?"
usr << "dir = [newDir]"
switch(newDir)

if(1)
usr << "??"
var/image/tiger_cannon = image('spells/TigerCannon/TigerCannonNORTH.dmi',pixel_x = -32, pixel_y = 32, layer=FLY_LAYER)
overlays += tiger_cannon
icon_state = "start"
sleep(3)
icon_state = "charge"
sleep(10)
icon_state = "finish"
sleep(3)
////////////////////////

zz()
set category = "Keys"
set hidden = TRUE
if( state == STATE_NORMAL || state == STATE_RUNNING )
var/skill/kidou/TigerCannon/t = new /skill/kidou/TigerCannon(dir,src)
src << "triggered"
overlays += t
changeState( STATE_SPELL )
changeIconState( "spell" )
spawn(5)
changeState( STATE_NORMAL )
changeIconState( "" )
overlays -= t
In response to Hulio-G
Does using pixel_x and pixel_y as named arguments in the image proc really work? If it does, it's completely undocumented.

(Sorry. This doesn't actually help with your issue.)
(Wait! It might be what's causing your problem.)
In response to Complex Robot
Complex Robot wrote:
Does using pixel_x and pixel_y as named arguments in the image proc really work? If it does, it's completely undocumented.

(Sorry. This doesn't actually help with your issue.)
(Wait! It might be what's causing your problem.)

Yeah. Lol, you are the second person to tell me that.

I told some dude "images > objs". Less cpu and all that.
He goes well "predefined objs > images".
In response to Hulio-G
I just meant how you are using the image proc there.
The only arguments are: icon,loc,icon_state,layer,dir

I thought, usually, the compiler gives an error when you try to use named arguments for non-existent arguments, but the image proc may be an exception. (It's interpreting the names pixel_x and pixel_y as having no names at all and using them instead as the positional arguments loc and icon_state.)

Actually, I just read the entry for named arguments, so if it isn't an undocumented feature, and it's not giving you a compiler error, then it is a BYOND bug.