ID:145594
 
Code: Explosion proc. Makes a bang the size of 1.
obj/explode//States the object and its path
icon = 'Explosion.dmi'//States where the icon can be found
layer=MOB_LAYER+1// Makes it so that it covers the top layer of that tile.
proc//Begining the proc...
Explosion()//Naming the Proc...
for (var/turf/X in range(src,1))//If it is withing 1 tile of the "Explosion"...
X.overlays+=/obj/explode//Overlay the Explosion icon
spawn(5)//Wait a little bit
X.overlays.Cut()//Delete the explosion, not all things last forever :)

obj/LAW
icon = 'Bullets.dmi' //set an icon for the bullet so it can be seen in the game
icon_state = "LAW"
density = 1 //this have to be set to 1 so the bullet can hit people
Bump(mob/M)
if(istype(M,/mob/)) // Make sure what is hit is a mob
M.hp -= rand(75,130) + M.defence //Minus one point of health if hit.
if(M.hp<=0) //Check if the player's health is eual to or less than 0
var/obj/c = new/obj/Corpse
var/obj/b = new/obj/Blood
c.loc = M.loc
b.loc = M.loc
c.icon_state = M.icon_state + " Dead"
M.loc = locate(6,3,1)
M.hp = 100
M.icon_state = null
M.team = ""
M.gun = "Unarmed"
M.armour = "None"
M.defence = 0
world << "[M] was killed by [usr]'s [usr.gun]."
if (M.team == usr.team)
usr << "<FONT COLOR = red><B>Teamkill! Half your money taken.</B></FONT>"
usr.cash /= 2
else
usr.cash += M.cash / 2
usr << "<B>[M.cash / 2] found from [M].</B>"
view() << sound ('Explode.wav',0)
Explosion()
del(src)// this will delete the bullet when it hits something


Problem description: When the Explode.wav, Explosion and Del is called, only Del runs and neither of the others.

No put usr in proc. Ungh.

Lummox JR
In response to Lummox JR
What about the sound...? Transfer to the proc?
In response to RedlineM203
Well, there's nothing wrong with the sound proc, is your sound pref. on or your volume loud enough?

On a side note, you don't need to add ",0" since the default is 0 for repeat... so you can just do view()<<sound(file) OR even better: view()<< sound file

And if I were you, I would use ?hearers() instead of view()

PS: If you have the new BYOND beta, try looking up the x,y,z,falloff variables for sound dantums, they could make your explosions sound more...realistic

- GhostAnime
In response to GhostAnime
If I can hear the LAW being fired, I can hear the LAW hitting something.

I'll look into that.

EDIT: No difference. The Explosion works but the sound STILL don't work.

obj/LAW
icon = 'Bullets.dmi' //set an icon for the bullet so it can be seen in the game
icon_state = "LAW"
density = 1 //this have to be set to 1 so the bullet can hit people
Bump(mob/M)
if(istype(M,/mob/)) // Make sure what is hit is a mob
M.hp -= rand(75,130) + M.defence //Minus one point of health if hit.
if(M.hp<=0) //Check if the player's health is eual to or less than 0
var/obj/c = new/obj/Corpse
var/obj/b = new/obj/Blood
c.loc = M.loc
b.loc = M.loc
c.icon_state = M.icon_state + " Dead"
M.loc = locate(6,3,1)
M.hp = 100
M.icon_state = null
M.team = ""
M.gun = "Unarmed"
M.armour = "None"
M.defence = 0
world << "[M] was killed by [usr]'s [usr.gun]."
if (M.team == usr.team)
usr << "<FONT COLOR = red><B>Teamkill! Half your money taken.</B></FONT>"
usr.cash /= 2
else
usr.cash += M.cash / 2
usr << "<B>[M.cash / 2] found from [M].</B>"
hearers() << sound ('Explode.wav')
src.Explosion()
del(src)// this will delete the bullet when it hits something
proc//Begining the proc...
Explosion()//Naming the Proc...
overlays+=/obj/explode//Overlay the Explosion icon
sleep(5)//Wait a little bit
overlays -= null//Delete the explosion, not all things last forever :)
return
In response to RedlineM203
> obj/LAW
> icon = 'Bullets.dmi' //set an icon for the bullet so it can be seen in the game
> icon_state = "LAW"
> density = 1 //this have to be set to 1 so the bullet can hit people
> Bump(mob/M)
> if(istype(M,/mob/)) // Make sure what is hit is a mob
> M.hp -= rand(75,130) + M.defence //Minus one point of health if hit.
> if(M.hp<=0) //Check if the player's health is eual to or less than 0
> var/obj/c = new/obj/Corpse
> var/obj/b = new/obj/Blood
> c.loc = M.loc
> b.loc = M.loc
> c.icon_state = M.icon_state + " Dead"
> M.loc = locate(6,3,1)
> M.hp = 100
> M.icon_state = null
> M.team = ""
> M.gun = "Unarmed"
> M.armour = "None"
> M.defence = 0
> world << "[M] was killed by [usr]'s [usr.gun]."
> if (M.team == usr.team)
> usr << "<FONT COLOR = red><B>Teamkill! Half your money taken.</B></FONT>"
> usr.cash /= 2
> else
> usr.cash += M.cash / 2
> usr << "<B>[M.cash / 2] found from [M].</B>"
> hearers() << sound ('Explode.wav')
> src.Explosion()
> del(src)// this will delete the bullet when it hits something
> proc//Begining the proc...
> Explosion()//Naming the Proc...
> overlays+=/obj/explode//Overlay the Explosion icon
> sleep(5)//Wait a little bit
> overlays -= null//Delete the explosion, not all things last forever :)
> return
>


Bumping... sound don't work.
In response to RedlineM203
RedlineM203 wrote:
If I can hear the LAW being fired, I can hear the LAW hitting something.

I'll look into that.

EDIT: No difference. The Explosion works but the sound STILL don't work.

> obj/LAW
> icon = 'Bullets.dmi' //set an icon for the bullet so it can be seen in the game
> icon_state = "LAW"
> density = 1 //this have to be set to 1 so the bullet can hit people
> Bump(mob/M)
> if(istype(M,/mob/)) // Make sure what is hit is a mob
> M.hp -= rand(75,130) + M.defence //Minus one point of health if hit.
> if(M.hp<=0) //Check if the player's health is eual to or less than 0
> var/obj/c = new/obj/Corpse
> var/obj/b = new/obj/Blood
> c.loc = M.loc
> b.loc = M.loc
> c.icon_state = M.icon_state + " Dead"
> M.loc = locate(6,3,1)
> M.hp = 100
> M.icon_state = null
> M.team = ""
> M.gun = "Unarmed"
> M.armour = "None"
> M.defence = 0
> world << "[M] was killed by [usr]'s [usr.gun]."
> if (M.team == usr.team)
> usr << "<FONT COLOR = red><B>Teamkill! Half your money taken.</B></FONT>"
> usr.cash /= 2
> else
> usr.cash += M.cash / 2
> usr << "<B>[M.cash / 2] found from [M].</B>"
> hearers() << sound ('Explode.wav')
> src.Explosion()
> del(src)// this will delete the bullet when it hits something
> proc//Begining the proc...
> Explosion()//Naming the Proc...
> overlays+=/obj/explode//Overlay the Explosion icon
> sleep(5)//Wait a little bit
> overlays -= null//Delete the explosion, not all things last forever :)
> return
>


I noticed that one of your sounds is put like
sound ()
it should be
sound()
In response to Budboinker
That never makes any difference. Spaces don't do anything. Indents are for somethings. Return is everywhere.
In response to RedlineM203
[link]
        hearers() << sound ('Explode.wav')


hearers() defaults to 'usr'.
In response to RedlineM203
i don't mean to be a dick or anything, but it could bas as simple as the sound file cant be found
In response to Dmingmage
Nope, the file is called Explode.wav as its meant to. This sounds stupid but I copied the name from the file (in the coding) onto the real thing.

You never know.