Text Size
Docs Instructions RKSL Cargo System V1.01 (Beta)

RKSL Cargo System V1.01 (Beta)

The Cargo System is relatively easy to use, RKSL Vehicle addons automaticaly support it were applicable. All the BIS Cargo objects are under RKSL Cargo System in the mission editor. With an additional object under Game Logics. Just drop the Transport and Cargo objects into the mission editor to start using them.

Anyone who wants to dive straight in. Now’s the time Smile

The Basic Concept

There are two types of cargo, visible and hidden. Visible cargo objects are regular Arma addons. But with additional objects, made to represent them, when loaded onto a vehicle. The visible objects occupy the cargo positions normally reserved for infantry. This does present some limitations;

  • You can’t have different objects stacked on top of each other.
  • A visible cargo object has to occupy at least one infantry position in the vehicle.
  • The number of visible cargo objects display is dependant on the number of available infantry cargo positions.
  • Hidden objects are again, regular Arma objects. Only they don’t require any additional models. So you can use them with any addon. There also handy for representing small objects like documents e.t.c
  • Hidden cargo cannot be accurately represented in the overhead dialog.
today

Dialogs

There are two types of interface, user actions and dialogs. User actions should be self-explanatory. Dialogs offer a few more options.

First Person

The first person perspective dialog, shows all the available cargo and transport within a 50m radius, along with any loaded cargo. Single click to select either transport or cargo from the lists. Double click or use the buttons, to load and unload cargo. Available cargo is automatically filtered according to the selected transport type, and it’s available capacity.

overhead

The overhead dialog allows you to position and rotate, as well as load and unload, cargo objects.

  • Hold down the right mouse and drag, to move the overhead camera.
  • With the mouse pointer over an unloaded cargo object. Hold the left button down and drag, to move the object. You can load cargo by either dragging it into the Transport Cargo list or over a vehicle in the Available Transport list.

Load To

  • You can also drag cargo over a vehicle to load. If the cargo can fit into the vehicle, you should see the hint change to load to.
  • Drag an item from the Transport Cargo list onto the island to unload cargo from the selected vehicle.
  • To rotate an unloaded cargo object. Move the mouse pointer over the object and hold down the left button to select it. Now hold down the right button to begin rotating it. Moving the mouse will change the objects orientation. Release either button to stop rotating.
  • Scroll the middle mouse button to zoom the camera view in and out.

Description.ext

 ValueDescription
 dialog

Boolean value from 0 to 1. Toggles between User Actions and Dialog interface. A value of 1 turns the dialog interface on, a value of 0 turns the user action interface on.

Defaults to 1.

 dialogorder[]

Array of type string representing the dialog resource class as defined in the config. This option dictates which of the dialog interfaces are made available and the order they are displayed. A value of {"RscRKSLOverheadCargo"} will make just the overhead dialog interface available. A value of {"RscRKSLDisplayCargo","RscRKSLOverheadCargo"} will make both the 1st person and overhead dialogs available, with the 1st person dialog taking precedant e.t.c

Defaults to {"RscRKSLOverheadCargo","RscRKSLDisplayCargo"}.

 vehicleimmobile

Number from 0 to 2. Defines how disabled vehicles are handled by the system.

Defaults to 1.

 unloaddir

Number from 0 to 3. Defines a position based on compass direction (S,W,E & N), relative to the transports orientation. Cargo unloaded using the 1st person dialog will be locate in the general area of this position.

Defaults to 0 (South, behind the vehicle).

 delay

Number. A global delay applied to all cargo loaded or unloaded.

Defaults to 0.

 dialoginitheight

Number representing meters. Defines the starting height for the camera in the overhead dialog interface.

Defaults to 30 meters.

 dialogmaxheight

Number representing meters. Defines the maximum height the camera can be raised in the overhead dialog interface.

Defaults to 50m.

 dialogminheight

Number representing meters. Defines the minimum height the camera can be lowered in the overhead dialog interface.

Defaults to 12.5m.
 dialogheightinc

Number representing meters. Defines the number of meters the camera will be raised or lowered in the overhead dialog interface.

Defaults to 5m.

 
Example:

class RKSL_CargoSys
    {
    dialog=1;
    dialogorder[]={"RscRKSLDisplayCargo","RscRKSLOverheadCargo"};
    vehicleimmobile=1;
    unloaddir=0;
    delay=0;
    dialoginitheight=30;
    dialogmaxheight=50;
    dialogminheight=12.5;
    dialogheightinc=5;
    };

Functions And Scripts

If you’re writing a mission or script to use the Cargo system, there are a couple of things you have to adhere to, when working with Cargo System addons.

There are two commands which should be used instead of the original Arma commands; DeleteVehicle and RespawnVehicle. Instead of using those two commands you should call RKSL_DeleteVehicle and RKSL_RespawnVehicle. Both the RKSL functions take the same parameters as the Arma commands they replace, and eventually do the same thing.

[Object] Call RKSL_DeleteVehicle

[Object,Delay,Count] Call RKSL_RespawnVehicle

Because visible cargo proxies occupy infantry positions in a vehicle, we have also provided an alternative for the Crew command. So if you want to know how many infantry occupy a transport vehicle that may or may not, also contain cargo proxies. You should use the following:

[Object] Call RKSL_Crew

Example Missions & AI Scripts

There are eight basic example missions included…
  1. rksl-useractioncargo.Intro: Selects the user action interface, for loading and unloading cargo. Activated by an entry in the missions stringtable.
  2. rksl-proxycargo.Intro: Another example of visible proxy cargo. This time using the default, dialog driven interface.
  3. rksl-hiddencargo.Intro: How to use hidden cargo with unsupported addons. Functions called from an objects init field, can be used to register any Arma addon with the Cargo System.
  4. rksl-mixedcargo.Intro: Combines hidden and visible cargo objects, to demonstrate how Crates and Containers can be used to store multiple objects. With just a single, visible cargo object, being loaded onto the transport.
  5. rksl-supplychain.Sara: A simplified example of how you can use scripts, to setup an automated AI supply chain. Six AI controlled vehicles ferry a continuous stream of Ammo crates, around the airport. You might want to run this mission at 4x accelerated time.
  6. rksl-cargoquickload.Intro: A simple example showing a cargo object loading from startup.
  7. rksl-arma-&-ace.Intro: A basic example mission showing how you can use rksl-arma.pbo to auto-inherit Cargo system functionality within A.C.E.
  8. rksl-description-ext.Intro: Example mission and description.ext for configuring the system settings and auto-inheritance with default Arma addons.

RKSL_AddCargo

To assign any unsupported Arma addon, as hidden cargo, use:

[Object,Size] Call RKSL_AddCargo

Optional parameter, delay in seconds when loading or unloading the cargo object:

[Object,Size,Delay] Call RKSL_AddCargo

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_AddTransport

To assign any unsupported Arma addon, as a transporter of hidden cargo, use:

[Object,Capacity] Call RKSL_AddTransport

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_ActiveObj

To check if an object is alive and exists, use:

Cargo=[Object] Call RKSL_ActiveObj


RKSL_CargoFree

To check if both the cargo and transport are available and not currently locked by another load\unload request use:

Cargo=[TransportObject,CargoObject] Call RKSL_CargoFree


RKSL_GetTransCargo

To return an array of a vehicle’s loaded cargo use:

CargoList=[TransportObject] Call RKSL_GetTransCargo


RKSL_TransCanLoad

To check if the transport has room to load a specific cargo:

CanLoad=[TransportObject,CargoObject] Call RKSL_TransCanLoad


RKSL_CargoLoad

To make a request to load a cargo object use the following:

ScriptPointer=[CargoObject,TransportObject] spawn RKSL_CargoLoad

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.

//Load the cargo

_CargoLoad=[_Cargo,_Transport] Spawn RKSL_CargoLoad;

//Wait for it to finish loading

WaitUntil {ScriptDone _CargoLoad};


RKSL_CargoLoaded

To check if a load request was successful, use:

IsLoaded=[CargoObject,TransportObject] Call RKSL_CargoLoaded


RKSL_CargoUnload

To make a request to unload a cargo object use the following:

ScriptPointer=[CargoObject,TransportObject] Spawn RKSL_CargoUnload

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.

//Unload the cargo

_CargoUnload=[_Cargo,_Transport] Spawn RKSL_CargoUnload;

//Wait for it to finish unloading

WaitUntil {ScriptDone _CargoUnload};


RKSL_CargoUnloaded

To check if an unload request was successful, use:

IsUnloaded=[CargoObject,TransportObject] Call RKSL_CargoUnloaded

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_NearestCargo

To obtain a list of all the currently unloaded cargo, within a user defined radius use:

ObjectArray=[Object or Position,Radius,CargoClass or ObjectType] Call RKSL_NearestCargo


RKSL_RemoveCargoSystem

Removes any cargo/transport properties from the specified vehicle or object.

[Object] Call RKSL_RemoveCargoSystem

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_CargoRemove

Removes any cargo properties from the specified vehicle or object.

[Object] Call RKSL_CargoRemove

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_TransRemove

Removes any transport properties from the specified vehicle or object.

[Object] Call RKSL_TransRemove

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_SystemRemove

Removes the specified object from all RKSL systems.

[Object] Call RKSL_SystemRemove

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


RKSL_TransSetCapacity

Sets the capacity of an active transport.

[Object,Capacity] Call RKSL_TransSetCapacity

* Don't call this command using SetVehicleInit, it will cause a CTD. All Cargo System functions are already MP compatible.


Event Handlers

RKSL-System has been given an improved eventhandler routines. The following events have now be added to the Cargo System:

CargoLoad

Event is called before a cargo object has loaded.

CargoLoaded

Event is called after a cargo object has loaded.

CargoUnLoad

Event is called before a cargo object is unloaded.

CargoUnLoaded

Event is called after a cargo object is unloaded.

TransportLoad

Event is called before a transport unloads a single cargo object. 

TransportLoaded

Event is called after a transport loads a single cargo object. 

TransportUnLoad

Event is called before a transport unloads a single cargo object. 

TransportUnLoaded

Event is called after a transport unloads a single cargo object.

Usage

Most of the events use a standard format and look quite similar to the BIS event handlers.

For Cargo events you would add them like this:

 

//Add an eventhandler for cargo being loaded like this
_EventID=[_MyCargo,"CargoLoad",{_This ExecVM "LoadingCargo.sqf"}];

The parameters passed to the script (in this case LoadingCargo.sqf) would look like this:

LoadingCargo.sqf

_Cargo=_This Select 0;
_Transport=_This Select 1;

Hint Format ["The Cargo Object %1 is being loaded into %2",_Cargo,_Transport];

For the Transport events you would use this:

 

 //Add an eventhandler for Transport being loaded like this
_EventID=[_MyTransport,"TransportLoad",{_This ExecVM "LoadingTransport.sqf"}];

The parameters passed to the script (in this case LoadingTransport.sqf) would look like this:

LoadingTransport.sqf

 _Transport=_This Select 0;
_Cargo=_This Select 1;

Hint Format ["The Transport %1 is being loaded with %2",_Transport,_Cargo];

To remove any of the above event handlers use the following:

 

//Remove assigned event handler
[_MyCargo,_EventID,"TransportLoad"] Call RKSL_RemoveEventHandler;

 

While most of the events follow this format, there is one exception. When unloading from the 1st Person Dialog interface you have an extra parameter available. The parameter is in the form of an array pointer, that lets you override the position of the unloaded Cargo object. In that case the called script would look like this:

//Get the parameters
_Cargo=_This Select 0;
_Transport=_This Select 1;

//See if we are passed an extra parameter
If ((Count _This)>2) Then
    {
    //Get the array pointer
    _PosPointer=_This Select 2;

    //Update the pointer
    _PosPointer Set [0,GetPos Player];
    };

Now the Cargo will be positioned where the player is standing instead of the original random position normally picked when unloading from the 1st Person Dialog.

 

 



Add this page to your favorite Social Bookmarking websites
Digg! Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! TwitThis Joomla Free PHP