client/Center() //which macro to set, in this case it is 5 on numberpad
mob.shoot() //when 5 is press, it goes to the mob proc shoot
mob/verb/Shoot() //also a verb for Shoot
shoot() //goes to the shoot proc
mob
proc
shoot() //name of proc
var/obj/H = new/obj/bullet //set the bullet to H (H is the bullet)
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(15) //waits 1.5 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]!" //says you shot M
//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
mob/Login()
usr.loc = locate(2,2,1) //sends the player to 2,2,1 on map
mob/var
fired = 0 //the variable for the fire
mob
icon = 'icons.dmi'
icon_state = "person"
obj/bullet //the bullet
icon = 'icons.dmi'
icon_state = "bullet"
mob/man
icon = 'icons.dmi'
icon_state = "person3"
turf/grass
icon = 'icons.dmi'
icon_state = "floor"
turf/wall
icon = 'icons.dmi'
icon_state = "wall"
density = 1 //so if the bullet hits here, the bullet stops
turf
luminosity=1
Problem description:Ravensflaw shooting code. nothing will show up on my map. When i run the game.
Even I, JaxxMarron, the notorious library stealer have learned that LIBS NEVER WORK THE WAY YOU WANT THEM TO, unless you know how to properly manipulate. And I have gone to just coding my own stuff.
Even if the code works fine, it's probably a problem with your icon states and such.
Are:
the .dmi file and icon state of your 'person'?
If not, THAT'S your problem.
Please make sure you have tried to fix it for at least half an hour, or you have gone through 20 or more lines of code, before posting problems here.
You sure you did that?