ID:266532
 
obj
Door
icon = 'turfs.dmi'
icon_state = "closed"
density = 1
Bump(atom/obstacle)
if(usr.Trooper == 1)
src.density = 0
src.icon_state = "open"
usr.loc=locate(src.x,src.y,src.z)
sleep(25)
src.density = 1
src.icon_state = "closed"
else
...


it compiles but doesnt work in the game
The problem is that you're thinking Bump() does the opposite of what it does. The Bump() proc is called when the object bumps into something! I don't think your door is going to be out bumping into a whole lot, if it's like most doors. What you should do is make a Bumped() proc. I've written how to do that quite a few times recently, try searching Newbie Central for Bumped().
In response to Foomer
What you should do is make a Bumped() proc. I've written how to do that quite a few times recently, try searching Newbie Central for Bumped().

You know, Bumped() is used often enough that I think it should be integrated directly into the language.
In response to Spuzzum
Yeah, but then these people would never learn to do anything for themselves :oP
In response to Foomer
Gah no idea how to make the bumped thing and couldnt find it
Sorry to bump its just that i really need this code and i have no idea how to make it sorry :(
In response to Thief Jack
Think about it. If you wanted to make a bumped proc for everything, it would be an atom proc. Then, under the mob, you would want it to call whatever it bumped bumped() proc. Its basically common sense.

-Rcet
In response to Rcet
I have little idea of how to arrange that and how to make it please give an e.g. but is this it?
    proc
Bumped(atom/obstacle)

obj
Door
icon = 'turfs.dmi'
icon_state = "closed"
density = 1
Bumped()
if(usr.Trooper == 1)
src.density = 0
src.icon_state = "open"
usr.loc=locate(src.x,src.y,src.z)
sleep(25)
src.density = 1
src.icon_state = "closed"
else
...
In response to Thief Jack
"usr" is a really bad reference to use in this situation, first of all. You'll probably want to use a reference to whatever activated the Bumped() proc, or in other words, whatever it was that bumped the turf.

atom/movable/Bump(atom/O)
..()
O.Bumped(src)
Notice that the Bumped() part contains "src" inside the ()'s. That tells it that src is the atom that bumped it.
Now use that in your proc.

obj/door
icon..
icon_state...
density = 1
Bumped(mob/M) // notice refering to the mob that bumped it
if(ismob(M)) // make sure it's a mob
if(M.Trooper)
src.density = 0
src.icon_state = "open"
M.loc = src.loc
sleep(25)
src.density = 1
src.icon_state = "closed"
else
..()
The ismob() check is to make sure that you're working with a mob here, since the Bumped() proc allows any type of atom. If it isn't a mob, it will just ignore this stuff, instead of giving invalid variable errors and such.
In response to Thief Jack
Bumping isn't really necessary unless the post has floated off the page or been forgotten long enough that no one will respond to it. If you bump it up just because it's not at the top of the page, it's more annoying than anything, and won't help you get any more attention - in fact, it's more likely to make people not help you because you're being annoying.
In response to Foomer
Bumped Undefined Proc
O.Bumped Undefined Proc, i would code it.....if i could please help
In response to Foomer
I know I know but im trying to get the door to work on Star Ship Troopers
In response to Foomer
I learn something new every day.
In response to Thief Jack
atom/proc/Bumped() return