mob
proc
Fire()
switch(ChargeLvl) // When you hold a key, a number goes up and the ChargeLvl changes at certain intervals; 5 seconds for 1, 15 seconds for 2, 45 seconds for Chargelvl 3.
if(0)
var/obj/Projectile/A = new()
if(src.Lvl == 4) A.icon += rgb(15,185,255)
else A.icon += rgb(255,185,15)
A.icon_state = "Fire0" // This line is where my actual problem comes up.
A.Attribute = "Fire"
A.loc = loc
A.atk = Atk * 0.8
if(S1 == "Hard-Hitting") A.kb = 1
A.Owner = src
A.OwnerName = src.name
walk(A,dir,0,2)
spawn(50) del(A)
cd = 10
if(1)
var/obj/Projectile/A = new()
if(src.Lvl == 4) A.icon += rgb(15,185,255)
else A.icon += rgb(255,185,15)
A.icon_state = "Fire1"
A.Attribute = "Fire"
A.loc = loc
A.atk = Atk * 1.8
if(S1 == "Hard-Hitting") A.kb = 1
A.Owner = src
A.OwnerName = src.name
walk(A,dir,0,2)
spawn(50) del(A)
cd = 25
if(2)
var/obj/Projectile/A = new()
if(src.Lvl == 4) A.icon += rgb(0,0,0)
else A.icon += rgb(135,45,255)
A.icon_state = "Fire2"
A.Attribute = "Fire"
A.loc = loc
A.atk = Atk * 4.2
if(S1 == "Hard-Hitting") A.kb = 1
A.Owner = src
A.OwnerName = src.name
walk(A,dir,0,2)
spawn(50) del(A)
cd = 60
if(3)
var/obj/Projectile/A = new()
if(src.Lvl == 4) A.icon += rgb(185,185,185)
else A.icon += rgb(255,95,15)
A.icon_state = "Fire3"
A.Attribute = "Fire"
A.loc = loc
A.atk = Atk * 12.8
if(S1 == "Hard-Hitting") A.kb = 1
A.Owner = src
A.OwnerName = src.name
walk(A,dir,0,2)
spawn(50) del(A)
cd = 300
Problem description:
I have one icon file; Projectiles.dmi with a bunch of icon_states for different projectiles (Fireball, Earth Spikes, etc.). Sometimes, when creating a projectile, the icon_state gets "stuck". No matter what ChargeLvl the skill has charged up to, the resulting projectile will have the "Fire2" icon state. There are a number of other skills, Water, Earth, etc. etc., and they each have their own isolated but identical incident. All Water skills will get stuck with Water1 icon, or Earth skills will be stuck on the Earth0 icon, and so on.
My first question is; can anyone tell what's causing this based on the description of the issue?
Second question; My first thought is to take each different icon_state and give them their own icon files. Is that already my best option, or is there a better way to deal with it?
Thanks in advance.