ID:150064
 
How do you make so If I bump into this door only certain people to open it.(teams) P.S. If you help I am eventually going to allow you to hack open the door or trick the sensers with a fake fingerprint.
Here's the code tell me if you need more info.
doors
base_door
icon = 'basedoor.dmi'
blue
icon_state = "closedblue"
density = 1
proc
open()
density = 0
icon_state = "open"
sleep(40)
density = 1
icon_state = "closedblue"
Bump(mob)
if(usr/var/dooropen == "1")
open()
Your problem is that the door doesn't bump into the mob, the mob bumps into it here's how you can do this:


turf/door
icon='door.dmi'
icon_state="closed"
density=1
opacity=1
proc/Open()
src.icon_state="open"
density=0
opacity=0
proc/Close()
src.icon_state="closed"
density=1
opacity=1

mob
Bump(atom/A)
if(istype(A,/turf/door)
if(A.icon_state="closed")
A.Open()
else
A.Close()
Exadv1 wrote:
How do you make so If I bump into this door only certain people to open it.(teams) P.S. If you help I am eventually going to allow you to hack open the door or trick the sensers with a fake fingerprint.

I would suggest not doing this with subclasses, but instead with a var like "blue" or "red".
The biggest (but not the only) problem with your code right now, though, is that you're using Bump() wrong. Bump() belongs to the mob, not the door. What you need is for mob.Bump(atom/A) to call a special A.Bumped(src) proc, and then use the obj's/turf's Bumped() proc to handle the action.
obj/door/base_door
var/teamcolor
density=1

New(l,c)
teamcolor=c
icon_state="closed[teamcolor]"

Bumped(atom/movable/A)
if(istype(A,/mob/player))
var/mob/player/M=A
if(!M.team || M.team.color!=teamcolor) return
open()

proc/open()
density=0
icon_state="open[teamcolor]"

proc/close()
density=1
icon_state="closed[teamcolor]"

You need code a little more complex than this, but it should help get you started.

Lummox JR
In response to Nadrew (#1)
Thanks
Um is there anyway you can help me understand variables Because......
EVERTIME I TRY TO USE ONE I GET A MILLION ERRORS.
In response to Lummox JR (#2)
Lummox JR wrote:
Exadv1 wrote:
How do you make so If I bump into this door only certain people to open it.(teams) P.S. If you help I am eventually going to allow you to hack open the door or trick the sensers with a fake fingerprint.

I would suggest not doing this with subclasses, but instead with a var like "blue" or "red".
The biggest (but not the only) problem with your code right now, though, is that you're using Bump() wrong. Bump() belongs to the mob, not the door. What you need is for mob.Bump(atom/A) to call a special A.Bumped(src) proc, and then use the obj's/turf's Bumped() proc to handle the action.
obj/door/base_door
> var/teamcolor
> density=1
>
> New(l,c)
> teamcolor=c
> icon_state="closed[teamcolor]"
>
> Bumped(atom/movable/A)
> if(istype(A,/mob/player))
> var/mob/player/M=A
> if(!M.team || M.team.color!=teamcolor) return
> open()
>
> proc/open()
> density=0
> icon_state="open[teamcolor]"
>
> proc/close()
> density=1
> icon_state="closed[teamcolor]"

You need code a little more complex than this, but it should help get you started.

Lummox JR

Do me a favor and um comment a few lines.Like these.
New(l,c)
teamcolor=c
icon_state="closed[teamcolor]"

Bumped(atom/movable/A)
if(istype(A,/mob/player))
var/mob/player/M=A
if(!M.team || M.team.color!=teamcolor) return
open()
In response to Exadv1 (#3)
Well let me try:

var/blah // sets a global var

mob/var/blah // sets a var that only mobs can use

obj/var/blah // see above same with turf/var, area/var, and atom/var


Setting a var within a verb/proc(including if()) can only be used within that verb or proc.

Hope that cleared a few things up.
In response to Nadrew (#5)
Nadrew wrote:
Well let me try:

var/blah // sets a global var

mob/var/blah // sets a var that only mobs can use

obj/var/blah // see above same with turf/var, area/var, and atom/var


Setting a var within a verb/proc(including if()) can only be used within that verb or proc.

Hope that cleared a few things up.
Ummmmm instead if I have a var problem I'll ask you directly what the problem is.
In response to Exadv1 (#6)
Ahhhh Luminex I have question do you know how to include it if the CHARACTERS are subclasses?forexample here it is
mob
//global stuffs
unselected
//how to select you team
blue
//blue team verbs info ect
green
//blahblahblah
//blahblahblah