Vehicle Plug-in WIP
What it is:
Basically? Its a plug-in for DBP, that provides a large command-set to help with creating vehicles - in both 2d and 3d - for your games. The system is based on "entries". You create an entry, set it's position and other various options, and the plug-in will provide you with a lot of info; if someone is in-range of an entry, if they're entering, who is in an entry, etc. You can even set the scancode required to be pressed to enter the vehicle, and the amount of game-loops the entry will wait before completing the entry (if you'd like to play enter/exit animations for example).
The entry system is the first half, tags are the second. Basically, a tag is what represents a possible passenger in the game. You call the handle entry(x#,y#,z#,tag) command, providing your player's xyz location (or xz and no y for 2D) and a tag ID (can be any integer). If a tag is detected entering an entry, the entry stores the tag in it's passenger list, for access later.
Along with the setup and handling commands, theres a tonne of data-retrieval and helper commands as well. Below is a list of all of the commands currently;
Setting Commands >>
- create entry(ID)
- set entry(ID,range,keystate)
- delete entry(ID)
- position entry(ID,x,y,z)
- exclude entry(ID)
- handle entries(x,y,z)
Retrieval Commands >>
- in range(ID,x,y,z)
- in entry(ID)
- entry occupied(ID)
- entry excluded(ID)
- entry x(ID)
- entry y(ID)
- entry z(ID)
Helper Commands >>
- camera travel(camera number, toX, toY, toZ, loops)
- glue Entry to object(ID,obj,xOffset#,yOffset#,zOffset#)
- unglue entry from object(ID)
Using the above commands, creating a rudimentary vehicle system is really simple;
`create our player object
MAKE OBJECT SPHERE 1,10
`create an entry object and entry ID
MAKE OBJECT SPHERE 2,10
POSITION OBJECT 2,40,0,0
create entry(1)
set entry(1,10,18)
DO
`move user object around with keys here
`store player object's position in x#,y#,z#
`handle entries for player 1, using 1 for a tag.
handle entries(x#,y#,z#,1)
`check if the player is in a vehicle...
IF in_entry(1,1)
POSITION OBJECT 2,x#,y#,z#
glue_entry_to_object(1,1,0,0,0)
ELSE
unglue_entry_from_object(1)
ENDIF
SYNC
LOOP
The system is almost finished, Im just adding a few more helper commands and I need to tweak the entry loops system to work better for animations. Other than that, possibly an addition of a timer for the enttry key being pressed instead of a toggle, and it'll be done.
The idea is, of course, to take it further. Ideally you'd set up limbs at seats in your vehicle model. You'd then position entries at the limbs, play enter/exit animations when the user is entering/exiting, use the camera travel command to pan the camera back when the user enters a vehicle, and then detect when a user is in a vehicle using the in entry() command, handling vehicle physics/control appropriately if so.
I
might charge for it, depending on how useful people think it might be. If I do it'll only be 4 or 5 dollars (unless I pimp it out with a lot of other commands), but we'll see.
Please post any ideas for other commands, comments on the system, etc here. Im pretty much looking for feedback before I polish it off.
- RUC'