|06-22-2003, 06:37 PM||#1|
Join Date: Jun 2003
I downloaded circle 3.0, implemented OLC, removed all zones and classes, created few of my
own and changed spells and skills so they fit to SF mud.
Than one day i got this idea to create vehicles so people could drive in em.
I created new item type VEHICLE, room type NOVEHICLE and other room/item/char related
Than i start to work on mount and dismount command and my first problem appeared.
This is problem:
I don't know how to put char on object. I wish that when you look in
room where character is on vehicle, you see something like:
"Razor is mounted upon the Honda CBR" and that u can look at Razor(char) and at
vehicle (honda cbr).
(I don't wish to see char and obj seperate like:
Razor is mounted upon the Honda
Honda is mounted by Razor)
I succeded to make mount command which do something like that. It puts
character into DRIVEING position, put the flag on him so it doesn't loose mv points,
change his look at room desc, but i had to remove vehicle from room.
As u see, in that situation u have char that's driveing but u can't look at vehicle
that he is driveing couse it isn't in room.
I know for code that puts obj_to_room, obj_to_char etc. and i tryed to change it
to something like char_on_obj but it's out of my reach for now.
So.....any kind of help would be helpfull. Maybe part of char_on_obj code or just
an idea how to make it....anything.
I do this just to parctice codeing (i don't have mud online and i will not), so if
i manage to make it working without of errors i will give code to whoever
want's it. It could be used for vehicles like cars in sf muds or charriots (i hope it's
spelled that way) in fantasy muds.
Well...that's all from me this time....i hope u can help.
|06-27-2003, 06:34 PM||#3|
Join Date: Jun 2003
The easiest solution?
Where it displays chars in a room, check if the player has "mounted" a vehicle, and continue past them.
This is the smoke and mirrors approach.
The clean approach to vehicles I've seen is with an item type, generate a "virtual room" using a pre-defined vnum range.
This room doesn't have exits, instead it has a "reference" to the "item" that represents it.
Then you just move the item from room to room as normal, and you move chars from room to room as normal.
Players leaving and entering the "vehicle" are actually entering a portal to the virtual room.
You'll need to modify a variety of commands (movement) to handle various other tasks.
The complexity from there is entirely up to you, you'll find some issues with combat... I've seen an implementation where they used extra fields for an npc to handle the vehicle, which should solve this. Just make sure to "purge" the virtual room when the NPC dies.
Either kill all the players and drop their corpses in the room with the dead "vehicle" or simply drop the players into the room with the vehicle.
Additionally, you can have "stations" for players to man within the vehicle. These stations could activate various abilities (the driver is capable of having the vehicle move).
-- Kwon J. Ekstrom
|06-30-2003, 07:38 PM||#4|
Join Date: Apr 2002
Location: Brisbane Australia
From the sounds of it you would want bhoth situations, it is pointless having a separate room for say a motorbike, and it is unrealistic to have 10 people visible in an APC, so for larger vehicles you will want the multiroom setup, and what ever code is required to show it.
EG: APC: visible driver, and commander (guy with MG you see sticking out top), anyone inside generally isn't visible
for the simpler motorbike you could have a few pointers in your char data, and object data [code] struct char_data *riddenBy, *ridingChar;
struct object_data *ridingObj; // in char data struct
struct char_data *riddenBy; // in obj struct
I would recommend against using objs as vehicles, make them mobs, and have a flag (INANIMATE ??) to say the mob does nothing, but make it a mob so it has moves, and HP's that way it can wear out, and be destroyed.
then in show_char_to_char (or whatever it is called, I can't remember) do a check to see if a vehicle/mount is ridden
// ... stuff up here already exists, for loop (i) to loop through chars in room
} else if (if (IsMount(i) && (i->riddenBy))
// skip this char
} else if ((i->riding) && (CanBeSeen(i) || CanBeSeen(i->riding)))
sendToChar(ch, "%s is here riding %s\r\n", GetName(i), GetName(i->riding));
} else if (.....
there are quite a few other things that are then required, special procs to "refuel" (feed) your vehicle, mount/unmount commands, stop INANIMATEs from self regen on MV's and HP's and so on...
|07-01-2003, 02:18 AM||#5|
One the mud I code for I implented vehicles by creating an entire new structure type, This allows multiple vehicles of the same type to be created and used by multiple players simultaneously, which can't be done by the object/room method described earlier. We allow players to upgrade their vehicles with enhancements and weapons mounts. Weapons mount's can be controlled by a player who is linked to the driving system of the vehicle or by someone else riding in/on the vehicle.
I originally tried using the object/room method for this but gave up quickly given the limitations of the system. In the end, your best bet is too create a new structure type for it.although this may be a bit much for someone who is new to coding, it can be good practice for adding more advanced features.
|07-02-2003, 05:55 PM||#6|
Join Date: Jun 2003
I disagree that you can't have multiple vehicles of the same type being used by multiple people using an obj/room or mob/room system.
Granted, there are several advantages to writing the system from the ground up, but there's also alot of code you'd need to rewrite to handle the new structure.
What you do is reserve a vnum block for vehicle use. That's your pool of rooms, you can either create a true pool with it, or simply create them at startup and scan through for any that are in use. I'd recommend using a true pool, but if you define retrieve/release functions this can be done later.
Once you have a room, you create a 2 way pointer between them. From there you'll need to add structures to handle components of a vehicle (mannable posts/weapons etc).
I recommend using a mob for your actual vehicle, all the prequisite behaviors are there, they fight, they move, they take damage.
-- Kwon J. Ekstrom
|need advice for vehicles - Similar Threads|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Need some advice||Milar||Legal Issues||10||08-18-2004 12:04 AM|
|Advice please?||Sammie||MUD Coding||9||02-07-2004 03:55 PM|
|Need just a bit of advice||Sammie||MUD Builders and Areas||0||02-04-2004 01:43 PM|
|Looking for Advice||Qira||Newbie Help||3||07-20-2002 12:58 AM|
|Need advice ? ask away !||kvirk||Tavern of the Blue Hand||4||05-06-2002 04:40 PM|