How do you create an object that multiple people can enter and you can control?
Like a four doored car.
ID:158888
Jun 15 2009, 6:36 am
|
|
In response to GhostAnime
|
|
How do I get
mob people Into obj cars ? |
In response to Kokomo0020
|
|
Either make a list of the people inside the car, or just use the car's contents list.
Make a verb a person can use to get in the car, and move the person into the car's contents. I don't remember if being in an object's contents gives you a black screen. If it does, change the person's client's perspective to the eye, and change the eye's location to the car. obj/car |
In response to Kaiochao
|
|
If your loc is an obj, you don't get a black screen. I have something for this I wrote a while ago for basically the same question. I fixed a couple stupid mistakes, and here it is:
obj |
In response to Garthor
|
|
Garthor wrote:
If your loc is an obj, you don't get a black screen. (Provided that that obj is actually linked to the map) To expand, whenever you're inside a movable that is on the map, you don't get a black screen, but you see that movable on the map (as if your eye was set to it). The same thing in a situation when multiple movables are nested; for example, if there's a mob on the map that has an obj in it, and your mob is inside that obj, you see that first mob on the map. The only situations where you'll get a black screen as a direct result from movement is when you're relocated to null, an empty* area, or a movable that isn't eventually contained by a map object (e.g. a mob whose loc is null, or an obj whose loc is that same mob). *: If you're located to an area that isn't empty (meaning it contains at least one turf), you're just put at the first turf of that area, so in that case your loc isn't actually an area but a turf, so you see the map as normally. EDIT: Rewrote the post for better clarification. |
The really abstract answer is that there's a whole lot of different ways you can do it, but you will want to invent a way that's appropriate to your game.
Basically, I'd break down what you're asking for like this: How do you create an object... Answer received - lets move on to the actual question. ...that multiple people can enter... Well, the good news is that multiple people can enter objects by default. Objects are like turfs in that things can be placed inside of them by simply using Move() to move them there. If the object's .Enter() is programmed to allow it, or the object or player mob is not dense (density = 0), then in they will go. If you wanted to limit it to only 4 people entering that object, the code most logically would go on the car object's .Enter() proc. They might even be able to see outside of the object at that point (I forget if so) but if their maps just go black, you can temporary set the affected player's client.eye to be the object and client.perspective to equal EYE_PERSPECTIVE. Then when they leave the car, set the client.eye back to client.mob and client.perspective back to MOB_PERSPECTIVE. This is just one possible implementation. Again, it depends on what you really want your game to do. You could potentially have it teleport the players to a map that serves as their car - that way you can see the car interior - but how important is that to your design, really? Dynamic map handling is possible (especially if you leverage a good library like Lummox JR's Swap Map) but it's a big hassle that should really be used by your game well in order to go that far. ...and you can control? Here, we're basically talking about your control interface. Basically, when a player is in the car, you want them to take control over it (in such a way only one player can control it) and now that player will basically have access to the appropriate verbs that move the car. It's actually a lot easier than it sounds. You just create some procs or verbs on the car that govern changes to its movement and then set up a means to access those verbs/procs. Off the top of my head, the easiest way to do so would be to put the verbs on players and hide the verbs when the player is not driving a car. An even easier implementation is just to override the client.NORTH() and other such procs to behave differently if the player is currently designated as a driver of a car. Overall, what we have here isn't so much a coding problem as it is understanding how to conceptualize the relationship from code to reality. My advice: keep practicing, and before long you'll be able to come up with solutions even more elegant than I can. |
In response to Kaioken
|
|
If you're going to "correct" what I wrote, at least do it correctly. I mean, you immediately disagreed with yourself:
If loc.loc.loc... eventually reaches a turf, you don't get a black screen (assuming you aren't blind, and there's something to see). Being in an area (not on one of its turfs, but your loc actually being that area) will give a black screen as well. |
In response to Geldonyetich
|
|
Great reply there; "How do you create an object that multiple people can enter and you can control?" is indeed a really abstract and vague question.
Geldonyetich wrote: They might even be able to see outside of the object at that point (I forget if so) [link] Off the top of my head, the easiest way to do so would be to put the verbs on players and hide the verbs when the player is not driving a car. You mean "remove", not hide, right? As verbs can be hidden while still accessible. Anyway, the easier solution is to have the verbs just not available by default (by putting them on a container datum that isn't used anyway) and add them to a player when he's in the car. That way you don't need to bother removing them from a new player mob. f.ex.: VERB_CONTAINER_NODE //this dummy type is never used to create objects \ *: I defined the dummy verb container type as a /mob/player type for a specific reason: this lets you use 'src' properly (easily) inside the verbs under it. Because 'src' is always defined of a type of the node the proc is on, if you use a regular datum you won't be able to use mob properties on src without re-typecasting it. An even easier implementation is just to override the client.NORTH() and other such procs to behave differently if the player is currently designated as a driver of a car. That is only for car movement control - for other actions (like shown above), you can use verbs like discussed. |
In response to Garthor
|
|
Garthor wrote:
If you're going to "correct" what I wrote Of course, I didn't correct what you said, I simply expanded on it. For example, to show the behavior isn't obj-specific. I mean, you immediately disagreed with yourself I didn't see anything quite like that, but I see how it could be misleading in a certain way (though your statement about objs is the same), so I'll reword it entirely. Thanks for da tip-off. Being in an area (not on one of its turfs, but your loc actually being that area) will give a black screen as well. If that area is "off-map" (doesn't contain any turfs), then of course, naturally - there isn't anything to see. I thought that was obvious, but I'll cover that in my edited post. (If a movable is relocated into an area that has turfs in it, it's impossible for its loc to be that area anyway - it's just put onto the first turf in the area, so no black screen.) |
In response to Kaioken
|
|
Kaioken wrote:
If that area is "off-map" (doesn't contain any turfs), then of course, naturally - there isn't anything to see. I thought that was obvious, but I'll cover that in my edited post. PEDANTRY, GO! A turf can be added AFTER you move the mob into the area, and the mob won't be relocated to the turf. Alternatively, the mob could fail to Enter() every turf in the area. |
In response to Garthor
|
|
One can always find niche cases (an empty area would normally be meant to be left empty, etc), so good job to you, but I think my edited post covered them anyway; you get to see The Void if your loc is set directly to an area, etc.
|
(Please be more specific - like what exactly are you having trouble expressing your idea)