ID:170007
 
turf
wall
icon_state="brickwall"
density=0
Enter(mob/M)
if(!M.onwall)
M.icon_state="spiderman walk on walls"
M.onwall=1
Exit(mob/M)
M.icon_state=""
M.onwall=0



Is there anything i can do so that i can move around once i enter() the turf? Right now after i enter it, It just seems dense and i can't walk through it.

~>Jiskuha
//Try this

turf
wall
icon_state="brickwall"
density=0
Enter(mob/M)
M.icon_state="spiderman walk on walls"
M.onwall=1
Exit(mob/M)
M.icon_state=""
M.onwall=0
Jiskuha wrote:
> turf
> wall
> icon_state="brickwall"
> density=0
> Enter(mob/M)
> if(!M.onwall)
> M.icon_state="spiderman walk on walls"
> M.onwall=1
> Exit(mob/M)
> M.icon_state=""
> M.onwall=0
>

Is there anything i can do so that i can move around once i enter() the turf? Right now after i enter it, It just seems dense and i can't walk through it.

~>Jiskuha

You should check out ToPText I sent you, it has a nifty proccess with the boats and stuff like this.
turf
wall
icon_state="brickwall"
density=0
Enter(mob/M)
if(!M.onwall)
M.icon_state="spiderman walk on walls"
M.onwall=1
return 1
Exit(mob/M)
M.icon_state=""
M.onwall=0
return 1


That should work.
You should NEVER EVER use Enter()/Exit() to process post-entering events! Use Entered() and Exited() to process events after the player has entered. The ONLY reason to supercede Enter() and Exit() is if you are making special circumstances to allow or disallow entry and exit.

For instance, let's say I have a spike pit trap turf:

mob
var
trapsense = 0
climbskill = 0
proc
trapcheck()
return rand(1,20)+src.trapsense
climbcheck()
return rand(1,20)+src.climbskill
turf
spikepit
Enter(var/atom/movable/O)
if(istype(O,/mob))
var/mob/M = O
if(M.trapcheck()>10) //if the player can see the trap
var/turf/T = get_step(src,get_dir(M,src))
//allow the player to leap over the pit trap.
if(T)
if(M.Move(T))
M << "You leap right over a pit trap!"
else
M << "You notice a pit trap in front of you and stop immediately!"
return 0
return ..() //call this to continue movement normally.
Exit(var/atom/movable/O)
//When a player has successfully fallen into a pit trap, they have to climb out.
if(istype(O,/mob))
var/mob/M = O
if(M.climbcheck()>10)
return 1 //exit normally allows exiting no matter what.
else
M << "You fail to climb out of the pit trap!"
return 0 //disallow exit.
Entered(var/atom/movable/O)
//Player falls into the pit.
if(istype(O,/mob))
var/mob/M = O
//take damage or whatever in here
M << "You fall into a hidden pit trap!"
..() //superfluous, but oh well...
Exited(var/atom/movable/O)
if(istype(O,/mob))
var/mob/M = O
M << "You climb out of the pit trap!"
..()


This is a simple example. You can do so much more with the Entry/Exit procs... Just remember, Enter/Exit() are only for BEFORE the player enters/exits the turf, they determine if they CAN enter/exit it, while Entered/Exited() are for AFTER the player enters/exits the turf, and any events called by successful entry should be defined here.

Understand this as well: the object entering a turf may not be a mob or obj. You should ALWAYS define Enter/Exit/Entered/Exited() with the argument as an atom/movable, and then check to see what kind of object it is inside of the procedure. Otherwise, some problems can occur due to simple type mismatch.

~Ter
In response to Hell Ramen
But he'll ALWAYS be able to walk on all walls... Is this desirable? And secondly, he should be doing this:

mob
var
wallwalking
turf
wall
Enter(var/atom/movable/O)
if(ismob(O))
var/mob/M = O
if(M.wallwalking)
for(var/atom/movable/F in src)
if(F.density)
return 0
return 1
return ..()
Entered(var/atom/movable/O)
if(ismob(O))
O.icon_state = "wallwalking"
Exited(var/atom/movable/O)
if(ismob(O))
if(!istype(O.loc,/turf/wall))
O.icon_state = ""


Since exited, to my knowledge, is called after Entered(), you can't just turn the icon_state off unless the player isn't on a wall any more.
In response to Kaiome
That's really hardly any different from what he posted. You didn't take a look at this or try to figure it out at all. It's great that you want to help people, but if you're going to do so, please actually pay attention to the code instead of posting random thoughts.

Lummox JR
In response to Ter13
This is much closer to correct, but returning 1 instead of ..() is still wrong. You wouldn't want to walk on the wall if someone else is already there.

Lummox JR
In response to Lummox JR
Go back and look, I account for other dense movable atoms in the enter procedure. The first movable atom it finds with a density of 1, it returns with 0.
In response to Ter13
Ter13 wrote:
Go back and look, I account for other dense movable atoms in the enter procedure. The first movable atom it finds with a density of 1, it returns with 0.

Ah, I see; my bad. I was misreading this because you were going with a standard dense wall. Definitely a good choice there, too.

Lummox JR