XML:BINA/OBJC/CONS: Difference between revisions

From OniGalore
< XML:BINA‎ | OBJC
Jump to navigation Jump to search
mNo edit summary
m (copy-edit)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=[[OBD:BINA/OBJC/CONS|BINA/OBCJ/CONS]]: consols=
{{XML_OBJC_Header | prev=CMBT| type=CONS | next=DOOR | name=Console}}


{{Template:XMLModdingHints}}
==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 [[XML:ONLV|ONLV]] level import.
* The BINACJBOConsole file is level-specific (level''x''_Final.dat).
* All consoles can be seen [http://ssg.oni2.net/subfold/consoles/ 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.


'''general information'''
==File structure==
* Y value of "chr_debug_characters = 1" doesn't need to be changed.
* Facing (Y rotation) needs to be changed by 180 degrees.
* This console spawning doesn't include console geometry, see screenshot.
* '''BINACJBOConsole.oni''' is level specific. (It can be found in edition/GameDataFolder/level''XX''_... )
* All consoles can be seen [http://ssg.oni2.net/subfold/consoles/ HERE.]
 
 
'''XML structure'''<br>for onisplit 0.9.59.0
  <?xml version="1.0" encoding="utf-8"?>
  <?xml version="1.0" encoding="utf-8"?>
  <Oni>
  <Oni>
Line 19: Line 21:
  </Oni>
  </Oni>


'''''[...]''''' means at least one console. Paste all console data into there (this includes '''<font color="#0A0"><CONS Id="..."></font>''' and '''<font color="#0A0"></CONS></font>''' tag).
'''''[...]''''' is where at least one console is defined. Paste all your console data into there (this includes '''<font color="#0A0"><CONS Id="..."></font>''' and '''<font color="#0A0"></CONS></font>''' tag).
 
==Example==
'''<font color="#0A0"><CONS Id="8179"></font>'''
    <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>
'''<font color="#0A0"></CONS></font>'''


==Tags==
{| class="wikitable" width=100%
!width=280px| Tag
!width=60px| Type
! Description
|-
| <Objects>
| -
|
|-
| <CONS Id="...">
| int32
| Any number; no need to be unique. — For [[XML:ONLV|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>
| -
|
|-
|valign="top"| <Class>
|valign="top"| link
| Original consoles:
: console_alarm
: console_data
: console0
: console_small_wu_roof


'''example'''
For level import via the [[XML:ONLV|XML master file]], use absolute/relative file path, e.g. ''consoles/console_data.oni''.
{| border=0 cellspacing=20 cellpadding=0 align=right
|-
| <ConsoleId>
| int16
| Can be used with BSL commands like "console_deactivate ''ID''".
|-
|valign="top"| <Flags>
|valign="top"| flag
|
: None
:: <Flags></Flags> also works; console will appear disabled.
: InitialActive
:: Console will appear enabled.
: Punch
:: Was used for TRAMKONOKOconsole_punch.
: IsAlarm
:: Alarm console. Used with alarm groups in CHAR.
|-
|valign="top"| <InactiveTexture>
|valign="top"| char[63]
| <font color="#777777">TXMP</font>file<font color="#777777">.oni</font> <font color="#777777">(don't use file prefix/suffix)</font> Image for disabled console. Examples:
 
_con_ALARM_SLEEP / _con_USED / _con_used / _con_INACTIVE
 
'''Use a capitalized file name for this TXMP.'''
|-
|valign="top"| <ActiveTexture>
|valign="top"| char[63]
| <font color="#777777">TXMP</font>file<font color="#777777">.oni</font> <font color="#777777">(don't use file prefix/suffix)</font> 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.'''
|-
|valign="top"| <TriggeredTexture>
|valign="top"| char[63]
| <font color="#777777">TXMP</font>file<font color="#777777">.oni</font> <font color="#777777">(don't use file prefix/suffix)</font> 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.
|-
|valign="top"| <Script Function="call_this_BSL_function" />
|valign="top"| 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
|
|
[http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/console.png http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/console_preview.png]
|}
|}
        '''<font color="#0A0"><CONS Id="8179"></font>'''
            <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>Active</Flags>
                <InactiveTexture>_con_INACTIVE</InactiveTexture>
                <ActiveTexture>_con_MTCOM_DISH</ActiveTexture>
                <TriggeredTexture>_con_MTC_DISHFLASH</TriggeredTexture>
                <Events>
                    <Script Function="fconsole_ok" />
                </Events>
            </OSD>
        '''<font color="#0A0"></CONS></font>'''


==Mod Tool-aided import==
'''Limitation:''' This method was created for info consoles only.


'''tags'''
VBS code:
* <Flags> :
[[Image:ModTool_layers.png|thumb|200px|right|How to access scene layers.]]
: Locked (means what in this case?) (hex: 1)
' make a new layer ("CONS_layer" or whatever)
: Gunk (means what?) (hex: 8)
' make it the current layer (by setting the >> sign)
* <Position> : (console is spawned at this xyz-position)
' in shared\consoles folder
* <Rotation> : (console is spawned with this xyz-rotation (in degrees))
' extract console_data.oni as dae
* <Class>: console0 / console_alarm / console_data / [[Consoles|?]]
' import only console_data_11.dae
* <ConsoleId> : (used by BSL commands like "console_deactivate ''ID''")
' duplicate, translate, rotate as you need
* <Flags> :
' right-click your CONS_layer > "Select All Objects in Layer"
:HEX=Dec/Flag
' run VBS code to create XML file (script editor: Alt+4, Run code: F5)
:00 = (empty)(not active)
' it will appear on your desktop
:01 = 1 (unknown)
' edit ConsoleId and Script Function
:02 = 2 (unknown)
' import by registering consoles in your level's XML master file
:04 = 4 (unknown)
' (<Objects><Import>BINACJBOConsole.xml)
:08 = InitialActive
:<font color="#777">09 = 9 (*)</font>
:10 = 16 (unknown)
FolderName = CreateObject("WScript.Shell").SpecialFolders("Desktop")
:20 = Punch (KONOKOconsole_punch.TRAM .. WTF O_o Seems to be a KONCOMcomb_p copy but slightly slower; I think it was used in a beta to crash the console via character-environment collision, shall we try to get it back?)
FileName = "BINACJBOConsole"
:28 = InitialActive Punch
FilePath = FolderName & "\" & FileName & ".xml"
:40 = IsAlarm
:80 = 128 (unknown)
:<font color="#777">C0 = 192 (*)</font>
Set oFS = CreateObject("Scripting.FileSystemObject")
:<font color="#777">EE = 238 (*)</font>
Set objXMLFile = oFS.OpenTextFile(FilePath, 2, True, 0)
: * not tested, might screw everything, was only set to test the XML export
' quote sign in a string needs two quote signs
:Multiple flags:
objXMLFile.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
::known flag and unknown flag are extracted as decimal number added together (see 9)
objXMLFile.WriteLine "<Oni>"
::known flags are extracted as readable flags, separated by a space sign (see 28)
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=""[[XML:TxtC|show_console_text]]"" />"
objXMLFile.WriteLine "              </Events>"
objXMLFile.WriteLine "          </OSD>"
objXMLFile.WriteLine "       </CONS>"
next
objXMLFile.WriteLine "  </Objects>"
objXMLFile.WriteLine "</Oni>"
objXMLFile.Close
logmessage "done"


* <InactiveTexture> : _con_ALARM_SLEEP / _con_USED / _con_used / _con_INACTIVE / <font color="#777">(etc.)</font>
{{XML}}
* <ActiveTexture> : _con_ALARM_SLEEP / _con_INFO / _con_MTC_2 / _con_mtc_stairs / _con_MTCOM_DISH / _con_MTCOM_DISH / <font color="#777">(etc.)</font>
* <TriggeredTexture> : _con_ALARM_ON / _con_USED / _con_used / _con_MTC_DISHFLASH / <font color="#777">(etc.)</font> (custom textures should be possible)
* <Events> (from v52, not checked for higher onisplit versions)
: <Script Function="calling_this_BSL_function" />
: <ActivateTurret TargetId="''Id''" />
: <DeactivateTurret TargetId="''Id''" />
: <ActivateConsole TargetId="''Id''" />
: <DeactivateConsole TargetId="''Id''" />
: <ActivateAlarm TargetId="''Id''" />
: <DeactivateAlaram TargetId="''Id''" />
: <ActivateTrigger TargetId="''Id''" />
: <DeactivateTrigger TargetId="''Id''" />
: <LockDoor TargetId="''Id''" />
: <UnlockDoor TargetId="''Id''" />
: (multible events are possible)

Latest revision as of 01:11, 1 April 2021

CONS : Console
XML modding tips
  • See HERE to start learning about XML modding.
  • See HERE if you are searching for information on how to handle object coordinates.
  • See HERE for some typical modding errors and their causes.
XML.png
XML

AKEV << Other file types >> CONS

TMBD << Other BINA >> ONIE

CMBT << Other OBJC >> DOOR

switch to OBD page

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

<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:
console_alarm
console_data
console0
console_small_wu_roof

For level import via the XML master file, use absolute/relative file path, e.g. consoles/console_data.oni.

<ConsoleId> int16 Can be used with BSL commands like "console_deactivate ID".
<Flags> flag
None
<Flags></Flags> also works; console will appear disabled.
InitialActive
Console will appear enabled.
Punch
Was used for TRAMKONOKOconsole_punch.
IsAlarm
Alarm console. Used with alarm groups in CHAR.
<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:

How to access scene layers.
' 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"