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
Gun sprite isn't showing
- MisterPerson
- Board Moderator
- Joined: Tue Apr 15, 2014 4:26 pm
- Byond Username: MisterPerson
Re: Gun sprite isn't showing
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.
I code for the code project and moderate the code sections of the forums.
Feedback is dumb and it doesn't matter
Feedback is dumb and it doesn't matter
- ngdaniel96
- Joined: Tue Oct 11, 2016 2:59 pm
- Byond Username: Ngdaniel96
Re: Gun sprite isn't showing
Thank you so much! I found the problem, it turns out that I got the icon state sprite wrong and now it's fixed!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.
I made a video showing the gun.
Who is online
Users browsing this forum: No registered users