RPG Starter

by Falacy
An Open Source Demo/Game with everything you'll need to get started on your very own BYOND Game!
ID:292224
 
i have this code

turf
house1exit
icon = 'turfs.dmi'
icon_state = "door"
Enter()
if(src.type==/mob/Enemies)
return
else
usr.loc = locate(/turf/house1enter)
house1enter
icon = 'turfs.dmi'
icon_state = "door"
Enter()
if(src.type==/mob/Enemies)
return
else
usr.loc = locate(/turf/house1enter)

and it wont let me out of the room im pretty sure the code isnt that good so could you help me clean it up

You don't have an idea who the src is. As for usr, I would't trust it.

turf
house1exit
Enter(mob/m)
if(istype(m,/mob/Enemies))//if its enemy
return 0 //don't step; returning 0 means don't allow
return 1 //step; returning 1 means allow
Entered(mob/m)
m.loc=locate(/turf/house1enter) // a dumb decision, this will make the m's loc to the fist instance of house1enter DS finds.
m.Move(m.loc) //would be good to trigger several other things
house1enter
Enter(mob/m)
if(istype(m,/mob/Enemies))//if its enemy
return 0 //don't step
return 1 //step



In response to Quixotic
Quixotic wrote:
You don't have an idea who the src is. As for usr, I would't trust it.

> turf
> house1exit
> Enter(mob/m)
> if(istype(m,/mob/Enemies))//if its enemy
> return 0 //don't step; returning 0 means don't allow
> return 1 //step; returning 1 means allow
> Entered(mob/m)
> m.loc=locate(/turf/house1enter) // a dumb decision, this will make the m's loc to the fist instance of house1enter DS finds.
> m.Move(m.loc) //would be good to trigger several other things
> house1enter
> Enter(mob/m)
> if(istype(m,/mob/Enemies))//if its enemy
> return 0 //don't step
> return 1 //step
>

Qui, since you idnt answer me before, can you answer me now, do you have msn?
In response to Best_Killer_FGM
src is the turf (what its defined under), usr is whatever is controlling the movement (not necessarily the thing entering the door). You should use a variable from the passed arguments, like Qtips showed. Also, instead of returning 1, you should probably use return ..() This way, any higher level parent calculations still get taken into account.
In response to Falacy
Falacy wrote:
Also, instead of returning 1, you should probably use return ..() This way, any higher level parent calculations still get taken into account.

Note that point.