Page 1 of 1

Gun sprite isn't showing

Posted: Tue Oct 11, 2016 3:34 pm
by ngdaniel96
So I tried to add in a new gun in my personal little server, I made sprites for its icon state and item state.

http://i.imgur.com/5lwm6C2.png

http://i.imgur.com/Nys0CjH.png

http://i.imgur.com/uhfB72P.png


Then I copied pasta the sniper's code for gun because I wanted players to aim down while using the AK54:

http://i.imgur.com/KfffbQJ.png

// AK54 //

/obj/item/weapon/gun/projectile/automatic/AK54
name = "AK54 Rifle"
desc = "Ten years old Kashlanikov model, cheap but reliable"
icon_state = "AK54"
item_state = "AK54"
mag_type = /obj/item/ammo_box/magazine/wt550m9
burst_size = 0
fire_sound = 'sound/weapons/ak47_01.ogg'
origin_tech = "combat=7"
can_unsuppress = 1
can_suppress = 1
zoomable = TRUE
zoom_amt = 7 //Long range, enough to see in front of you, but no tiles behind you.
actions_types = list()


/obj/item/weapon/gun/projectile/automatic/AK54/update_icon()
if(magazine)
icon_state = "AK54-e"
else
icon_state = "AK54"


But after compiling everything and running the game, when I spawn an AK54, there's no icon sprite, only item sprite.

http://i.imgur.com/ATMGKvP.png

http://i.imgur.com/d1rUfOT.png

Where did I go wrong in the code ? Is there a fix to this ?

Also, sorry for the urls instead of Img BBcode, it kept showing the error message "unable to determine image dimension" whenever I use [img] BBcode

Re: Gun sprite isn't showing

Posted: Tue Oct 11, 2016 8:27 pm
by MisterPerson
When you spawn the gun, view variables it to see what its icon_state currently is when it's invisible. That should give you a major clue as to what's wrong.

Re: Gun sprite isn't showing

Posted: Wed Oct 12, 2016 6:02 pm
by ngdaniel96
MisterPerson wrote:When you spawn the gun, view variables it to see what it's icon_state currently is when it's invisible. That should give you a major clue as to what's wrong.
Thank you so much! I found the problem, it turns out that I got the icon state sprite wrong and now it's fixed!

I made a video showing the gun.