XML:BINA/OBJC/CONS
| CONS : Console |
| |
|---|---|---|
| XML
AKEV << Other file types >> CONS TMBD << Other BINA >> ONIE CMBT << Other OBJC >> DOOR |
General information
- The XML on this page was tested with OniSplit version 0.9.61.0 and 0.9.82.0.
- This console spawning doesn't include console geometry unless it's done via ONLV level import.
- The BINACJBOConsole file is level-specific (levelx_Final.dat).
- All consoles can be seen HERE.
- Activation tolerances: the player must fulfill the following requirements before he can use a console:
- A distance of 10 or less world units.
- A distance of -2 WU or less (e.g. you can't activate console while standing inside or behind it).
- A facing of 1.22173 radians (ca. 70°) or less.
- A sideways shift of 8 WU or less.
- A difference of 8 WU or less between pelvis height and console height.
File structure
<?xml version="1.0" encoding="utf-8"?>
<Oni>
<Objects>
[...]
</Objects>
</Oni>
[...] is where at least one console is defined. Paste all your console data into there (this includes <CONS Id="..."> and </CONS> tag).
Example
For level import via XML master file, use a pre-compiled (*.oni) file as part of a relative file path, e.g. consoles/console0.oni.
<CONS Id="8179">
<Header>
<Flags>Locked Gunk</Flags>
<Position>-1354.927 45 860.053</Position>
<Rotation>180.000015 0 180.000015</Rotation>
</Header>
<OSD>
<Class>console0</Class>
<ConsoleId>2</ConsoleId>
<Flags>InitialActive</Flags>
<InactiveTexture>_con_INACTIVE</InactiveTexture>
<ActiveTexture>_con_MTCOM_DISH</ActiveTexture>
<TriggeredTexture>_con_MTC_DISHFLASH</TriggeredTexture>
<Events>
<Script Function="fconsole_ok" />
</Events>
</OSD>
</CONS>
Tags
| Tag | Type | Description |
|---|---|---|
| <Objects> | - | |
| <CONS Id="..."> | int32 | Any number; no need to be unique. — For level importing, use <CONS>. |
| <Header> | - | |
| <Flags> | flag | Object flags. Used during development, ignore them. |
| <Position> | float x3 | XYZ position. When creating a new console, use a Y of 0 if the ground plane is 0. The height of the console and the character are both stemming from the ground plane. |
| <Rotation> | float x3 | XYZ rotation. "chr_debug_characters = 1" shows the player's position, so you could face your (imaginary) console and then use a 180-degree flip of your facing for the console's Y rotation. X and Z should be 0. |
| <OSD> | - | |
| <Class> | link | Original consoles:
For level import via XML master file, use a pre-compiled (*.oni) file as part of a relative file path, e.g. consoles/console_data.oni. |
| <ConsoleId> | int16 | Can be used with BSL commands like "console_deactivate ID". |
| <Flags> | flag |
|
| <InactiveTexture> | char[63] | TXMPfile.oni (don't use file prefix/suffix) Image for disabled console. Examples:
_con_ALARM_SLEEP / _con_USED / _con_used / _con_INACTIVE Use a capitalized file name for this TXMP. |
| <ActiveTexture> | char[63] | TXMPfile.oni (don't use file prefix/suffix) Image for an enabled console. Examples:
_con_ALARM_SLEEP / _con_INFO / _con_MTC_2 / _con_mtc_stairs / _con_MTCOM_DISH / _con_MTCOM_DISH Use a capitalized file name for this TXMP. |
| <TriggeredTexture> | char[63] | TXMPfile.oni (don't use file prefix/suffix) Image for a used console. Examples:
_con_ALARM_ON / _con_USED / _con_used / _con_MTC_DISHFLASH Use a capitalized file name for this TXMP. |
| <Events> | int16 | You can use multiple events. |
| <Script Function="call_this_BSL_function" /> | char[32] | Name of BSL function. For example if you use "call_this_BSL_function" here, then write in your BSL script:
func call_this_BSL_function
{
dmsg "hi"
}
|
| <ActivateTurret TargetId="Id" /> | int16 | |
| <DeactivateTurret TargetId="Id" /> | int16 | |
| <ActivateConsole TargetId="Id" /> | int16 | |
| <DeactivateConsole TargetId="Id" /> | int16 | |
| <ActivateAlarm TargetId="Id" /> | int16 | |
| <DeactivateAlaram TargetId="Id" /> | int16 | |
| <ActivateTrigger TargetId="Id" /> | int16 | |
| <DeactivateTrigger TargetId="Id" /> | int16 | |
| <LockDoor TargetId="Id" /> | int16 | |
| <UnlockDoor TargetId="Id" /> | int16 |
Mod Tool-aided import
Limitation: This method was created for info consoles only.
VBS code:
' make a new layer ("CONS_layer" or whatever)
' make it the current layer (by setting the >> sign)
' in shared\consoles folder
' extract console_data.oni as dae
' import only console_data_11.dae
' duplicate, translate, rotate as you need
' right-click your CONS_layer > "Select All Objects in Layer"
' run VBS code to create XML file (script editor: Alt+4, Run code: F5)
' it will appear on your desktop
' edit ConsoleId and Script Function
' import by registering consoles in your level's XML master file
' (<Objects><Import>BINACJBOConsole.xml)
FolderName = CreateObject("WScript.Shell").SpecialFolders("Desktop")
FileName = "BINACJBOConsole"
FilePath = FolderName & "\" & FileName & ".xml"
Set oFS = CreateObject("Scripting.FileSystemObject")
Set objXMLFile = oFS.OpenTextFile(FilePath, 2, True, 0)
' quote sign in a string needs two quote signs
objXMLFile.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
objXMLFile.WriteLine "<Oni>"
objXMLFile.WriteLine " <Objects>"
for each obj in selection
px = obj.posx.value
py = obj.posy.value
pz = obj.posz.value
rx = obj.rotx.value
ry = obj.roty.value
rz = obj.rotz.value
position = replace(px & " " & py & " " & pz, ",", ".")
rotation = replace(rx & " " & ry & " " & rz, ",", ".")
logmessage position
logmessage rotation
console = "consoles/console_data.oni"
objXMLFile.WriteLine " <CONS>"
objXMLFile.WriteLine " <Header>"
objXMLFile.WriteLine " <Flags></Flags>"
objXMLFile.WriteLine " <Position>" & position & "</Position>"
objXMLFile.WriteLine " <Rotation>" & rotation & "</Rotation>"
objXMLFile.WriteLine " </Header>"
objXMLFile.WriteLine " <OSD>"
objXMLFile.WriteLine " <Class>" & console & "</Class>"
objXMLFile.WriteLine " <ConsoleId>1</ConsoleId>"
objXMLFile.WriteLine " <Flags>InitialActive</Flags>"
objXMLFile.WriteLine " <InactiveTexture>_CON_INFO</InactiveTexture>"
objXMLFile.WriteLine " <ActiveTexture>_CON_INFO</ActiveTexture>"
objXMLFile.WriteLine " <TriggeredTexture>_CON_INFO</TriggeredTexture>"
objXMLFile.WriteLine " <Events>"
objXMLFile.WriteLine " <Script Function=""show_console_text"" />"
objXMLFile.WriteLine " </Events>"
objXMLFile.WriteLine " </OSD>"
objXMLFile.WriteLine " </CONS>"
next
objXMLFile.WriteLine " </Objects>"
objXMLFile.WriteLine "</Oni>"
objXMLFile.Close
logmessage "done"
