ID:263409
 
Code:
mob
var
fired=0
projicon
projiconstate=""

obj/projectile
icon = null

mob/verb/Shoot_Projectile()
src.shoot()

mob
proc
shoot() //name of proc
var/obj/H = new/obj/projectile //set the bullet to H (H is the bullet)
src.projicon=H.icon
src.projiconstate=H.icon_state
if(src.fired == 0) //if the usred fired is 0 (keeps the usr from holding down 5 for lots of shots)
src.fired = 1 //makes fired equal 1
spawn(5) //waits 1 seconds before going to the code underneath it
src.fired = 0 //makes the player's fired 0 so the player can shoot again
H.dir = src.dir //the bullets(H) direction equals the player's direction
H.loc = src.loc //the bullets(H) location equals the player's location
while(H) //while the bullet is still "alive"
step(H,H.dir) //H steps towards H's direction
var/turf/T = H.loc //for the turf that is in H's location
if(T.density == 1) //if that turfs density = 1 (ex: a wall)
del(H) //deletes the bullet
break //breaks out of the while loop
for(var/mob/M as mob in T) //for and M in that turf
if(M == src) //if that M is the person who fired, it continues as if nothing was there
continue
src<<"You shot [M.name]!" //says you shot M
view(M) << "[M.name] was shot!"
//Here is where you would want to add damage or such ect..
del(H) //deletes the bullet
sleep(1) //sleeps 1/10th of second before re-doing the loop
verb
Define_Projectile(ico as icon)
var/a = icon_states(projicon)
if ("null") a+= "\[Blank\]"
var/t = input("Which icon state would you like to use?","Icon States") as null|anything in a
if(t == "\[Blank\]") src.projiconstate = ""
else src.projiconstate = t
src.projicon = ico


Problem description:
The projectile's icon does not appear, even after the Define verb is used.

Eternal_Dread wrote:
The projectile's icon does not appear, even after the Define verb is used.

The actual projectile's icon is never being set. You're only setting the projicon var, but never using it.

Lummox JR
In response to Lummox JR
Alright, but I don't see how I'm not setting it's icon. Could you perhaps see if you can figure out how I would?
In response to Eternal_Dread
Eternal_Dread wrote:
Alright, but I don't see how I'm not setting it's icon. Could you perhaps see if you can figure out how I would?

projectile.icon = projicon


It's the one step you're not taking.

Lummox JR
In response to Lummox JR
Amazing how a simple misplacement of a var can do. Thanks for that.