ID:263724
 
Code:shooting code.dm
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.

Try making your own code.

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:
icon = 'icons.dmi'
icon_state = "person"

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?
I'm gonna have to agree with Jaxx on this one.

But, this has happened to me before when I did NOT use a library.
The problem was that I had two login codes. Do a search (CTRL+F) and check if that is your problem.
Or just try to delete the login code all together and remake it (As your OWN.)
In response to Fuzed
http://developer.byond.com/docs/guide/ - Need I say more?

*~Modulus
In response to Modulus
Look i tried everything but all it shows is a black screen....
In response to Naruto Dude2007
Naruto Dude2007 wrote:
Look i tried everything but all it shows is a black screen....

Have you even tried making a map?
In response to RedlineM203
He could be right.

If he is... Press Ctrl + N, Then type in Map.dmp in the box(You can call it something other than "Map" if you like). Then you can decide the size of your map from there.

You'll only need to do that really if you copied the code. If you just downloaded the source and ran the game it should be working perfectly fine.

*~Modulus
In response to Modulus
you might have maps but are any of them checked?
Here's a list of of why it could be:

- In the interface, you have two+ maps (which is not supported... yet... hopefully).

- In the interface, you do not have the map checked as default.

- You do not have a map made (.dmp was the old extension for the maps, the new one is .dmm)

- You have multiple atom.Login(), each overwriting the other because you did not call the parent procedure ..()

- You are using usr in procs... bad! User != usr, read it up in the DM Reference what it actually is. You want to use 'src' in most cases (src = source/container of that proc or verb). Suitable spots for usr where the person can be defined as it always "resets" is Stat(), Click()/DblClick() and verbs.


The last two I bolded because I saw the following in your snippet:
mob/Login()
usr.loc = locate(2,2,1) //sends the player to 2,2,1 on map
In response to GhostAnime
I do have a map and its check ill see if your idea work Anime.
In response to GhostAnime
GhostAnime wrote:
Here's a list of of why it could be:

- In the interface, you have two+ maps (which is not supported... yet... hopefully).

- In the interface, you do not have the map checked as default.

- You do not have a map made (.dmp was the old extension for the maps, the new one is .dmm)

- You have multiple atom.Login(), each overwriting the other because you did not call the parent procedure ..()

- You are using usr in procs... bad! User != usr, read it up in the DM Reference what it actually is. You want to use 'src' in most cases (src = source/container of that proc or verb). Suitable spots for usr where the person can be defined as it always "resets" is Stat(), Click()/DblClick() and verbs.


The last two I bolded because I saw the following in your snippet:
mob/Login()
> usr.loc = locate(2,2,1) //sends the player to 2,2,1 on map



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()
src.loc = locate(6,6,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"
luminosity=1
turf/wall
icon = 'icons.dmi'
icon_state = "wall"
density = 1 //so if the bullet hits here, the bullet stops


As you can see i have tried that and there is only one login thing for this bit of code out of the other files. And the map is checked!!! So what could be wrong then?
In response to Naruto Dude2007
For the Login(), it doesn't matter if it's the only one in the file. Login() is affected by all files containing the overwrite information.

Try adding the parent proc to all Login()
In response to GhostAnime
what you mean?
In response to GhostAnime
GhostAnime wrote:
Here's a list of of why it could be:

- In the interface, you have two+ maps (which is not supported... yet... hopefully).

- In the interface, you do not have the map checked as default.

- You do not have a map made (.dmp was the old extension for the maps, the new one is .dmm)

- You have multiple atom.Login(), each overwriting the other because you did not call the parent procedure ..()

- You are using usr in procs... bad! User != usr, read it up in the DM Reference what it actually is. You want to use 'src' in most cases (src = source/container of that proc or verb). Suitable spots for usr where the person can be defined as it always "resets" is Stat(), Click()/DblClick() and verbs.


The last two I bolded because I saw the following in your snippet:
mob/Login()
> usr.loc = locate(2,2,1) //sends the player to 2,2,1 on map



I also get this problem when I try to spawn on something with density =p
In response to Pirion
In your case, most likely than not, you are moving the mob via Move().

Move() checks turf.Enter(), sees if there's any dense object, turf.Exit() [after moving calling turf.Exited() and Entered()]. If there's a dense object or Enter/Exit returns 0, you will NOT move.

If you set loc directly, the mob will be moved there. However, the said procs that Move() calls is not called when you set the loc directly.
In response to GhostAnime
I made sure of everything but it still wont work!