ID:170610
 
Does anyone know how to make a laser verb that when you press it then it shoots a laser 6 sqares in the direction you are facing and it deletes all of the objs it runs into?
also if anyone knows how to make doors with passwords plz let me know!
In response to Tsonic112
Look up SSJ Radditz beam demo for the laser.
And, for the doors, it's as simple as input, and checking if it is equal to another var.
var/password = "asdf"
mob/verb/guess_password(N as num)
if(N==password)
world << "[src] is winnar!11"
else
world << "[src] is phailure!!11"
In response to Hell Ramen
Uhh.....
mob
var
doorpassword=832444
verb
Open_Door(P as num)
usr << "Please input the 6 digit password to unlock the door:"
if(P==src.doorpassword)
usr << "The door has been unlocked."
else
usr << "The password is not correct."
Close_Door(P as num)
usr << "Please input the 6 digit password to unlock the door:"
if(P==src.doorpassword)
usr << "The door has been locked."
else
usr << "The password is not correct."

You cant have asdf as a number. >_>
In response to Skye Reaver
Instead of if(P==832444), don't you mean if(P==src.doorpassword)? :P
In response to Wizkidd0123
uhh, it is >_>
In response to Skye Reaver
<code>[Last edited: 1/3/05 6:31 pm]</CODE>
Kinda hard to escape, huh? :/
In response to Skye Reaver
Out of sheer curiosity: Why is the door /mob?

This will cause so many problems. A player must be of a /mob type, so... unless your players are doors (interesting game concept), you probably want a /mob/door, or, the better solution IMHO, a /obj/door.

And, if the password succeeds, then set the icon_state of the door and its density as needed.
obj/door
var
doorpassword=832444
verb
Open_Door(P as num)
usr << "Please input the 6 digit password to unlock the door:"
if(P==src.doorpassword)
usr << "The door has been unlocked."
src.icon_state = "opendoor"
src.density = 0
else
usr << "The password is not correct."
Close_Door(P as num)
usr << "Please input the 6 digit password to unlock the door:"
if(P==src.doorpassword)
usr << "The door has been locked."
src.icon_state = "closeddoor"
src.density = 0
else
usr << "The password is not correct."
In response to Nova2000
I'm sorry but could you tell me any difference between a mob and an obj that would be relevant here?
In response to DeathAwaitsU
DeathAwaitsU wrote:
I'm sorry but could you tell me any difference between a mob and an obj that would be relevant here?

He had it defined under /mob. Since a player must connect as a mob, and since those verbs were defined as /mob, they would carry down to something like /mob/player. Defining the door at the /mob level would result in all the players having an Open/Close verb. This can be avoided by merely moving it to something like /mob/door or /obj/door.

(I prefer /obj for inanimate things, but that's a preference. As the reference states, "Mobs are 'mobile objects'") There are more technical differences between /obj and /mob, such as (by defualt) mob's are dense, obj's are not.
In response to DeathAwaitsU
DeathAwaitsU wrote:
I'm sorry but could you tell me any difference between a mob and an obj that would be relevant here?

Sure.

"mob" stands for "mobile object", while "obj" stands for "object". However, they are both defined under atom/movable, so both can Move().

There are a few differences between the two, but nothing major (ie: a mob is dense by default while an obj is, by default, nondense).

The choice between /obj and /mob is mostly organizational. The convention, however, is to use mobs for characters, whether they're player or nonplayer characters, and to use objs for things that the player would have to interact with. The latter is because Bump() is restricted to atom/movable, but things like doors, for example don't have to move.

In this case, by "the convention", I mean what most people do. If there's a way that you like better, feel free to use it.

In your situation, the Door should definately be an object because doors don't have to be mobile. Obviously, they have to open and close, but there's probably no reason that a player would find a door walking around in your game as a normal NPC townsperson, for example, would.