ID:178559
 
obj
Drops
Ammo
icon = 'Drops.dmi'
icon_state = "Ammo"
density = 1
Bump(M)
usr.Ammo += 15
if(usr.Ammo >= 100)
usr.Ammo = 100
del(M)

I wanted to make it so if a mob bumps into it, it disapears and adds 15 ammo to the bumper's stats. But when i play it wont do anything when i bump it. Is there a way to fix this?
Bump() doesn't make things happen when objects are bumped into, it makes things happen when the object bumps into something. If you want to make things happen when something is bumped into, create a Bumped() proc.

Do a search on newbie central for Bumped(), since I've described how to do it several times, and I'm not going to do it again :oP
In response to Foomer
atom/proc/Bumped()
usr.Bumped(src)
..()
mob
Bump(mob/M)
M.Bumped()
..()
obj
Drops
Ammo
icon = 'Drops.dmi'
icon_state = "Ammo"
density = 1
Bumped(mob/M)
M.Ammo += 15
if(M.Ammo >= 100)
M.Ammo = 100
del(src)

It compiles good but it still wont work in the game.
In response to Tazor07
You got a little confused implimenting it.

Tazor07 wrote:
atom/proc/Bumped()
usr.Bumped(src)
..()

This is just the prototype proc for Bumped(). It needs an argument, and it shouldn't have the usr.Bumped(src) line.

atom/proc/Bumped(mob/M)
..()

mob
Bump(mob/M)
M.Bumped()
..()

The argument is wrong. You want it to react when it Bump()s any atom, not just mobs. using a mob argument won't filter only mobs, but it could give you potential problems.

You also need to tell the bumped item what bumped into it by passing src as the Bumped() argument.

mob
Bump(atom/A)
A.Bumped(src)
..()


The ammo obj seems just fine.
In response to Tazor07
I'm getting really mad, i just cant seem to make it work
In response to Tazor07
<code>atom/Bumped() return // define the Bumped() proc. atom/Bump(atom/O) O.Bumped() // atom bumps O, O is bumped. mob/Bumped(atom/O) src << "[O] just bumped you!"</code>
In response to Foomer
i get 3 errors saying each is undefined procs
In response to Tazor07
atom/<font color=red>proc</font>/Bumped() return // define the Bumped() proc.

atom/Bump(atom/O)
O.Bumped() // atom bumps O, O is bumped.

mob/Bumped(atom/O)
src << "[O] just bumped you!"

I think that will do it.
In response to English
English wrote:
atom/<font color=red>proc</font>/Bumped() return // define the Bumped() proc.

<font color = red>atom/Bump(atom/O)</FONT>
O.Bumped() // atom bumps O, O is bumped.

mob/Bumped(atom/O)
src << "[O] just bumped you!"

I think that will do it.

The red line i get a error saying that Bump is a undefined proc. any other suggestions?
In response to Tazor07
Change it to:

atom/movable/Bump(atom/O)

Only movable atoms (objs and mobs) have a bump proc. Since turfs and areas can never move, they don't have one.

-AbyssDragon
In response to AbyssDragon
This is why I don't like re-writing it :oP
In response to Foomer
Foomer wrote:
This is why I don't like re-writing it :oP

Then send them to http://www.deadron.com/byond/ByondBwicki.dmb?HowToBump

I have a section at the end about making a Bumped() proc. ;)