XML:BINA/OBJC/CONS: Difference between revisions

From OniGalore
< XML:BINA‎ | OBJC
Jump to navigation Jump to search
(xml tags table)
mNo edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{XML_OBJC_Header | type=CONS | prev=CHAR | next=CMBT | name=Console spawn collection }}
{{XML_OBJC_Header | prev=CMBT| type=CONS | next=DOOR | name=Console}}


===general information===
==General information==
* The xml code on this page was tested with onisplit version 0.9.61.0 and 0.9.82.0
* The XML on this page was tested with OniSplit version 0.9.61.0 and 0.9.82.0.
* Y value of "chr_debug_characters = 1" doesn't need to be changed.
* This console spawning doesn't include console geometry unless it's done via [[XML:ONLV|ONLV]] level import.
* Facing (Y rotation) needs to be changed by 180 degrees.
* The BINACJBOConsole file is level-specific (level''x''_Final.dat).
* This console ''spawning'' doesn't include console geometry (see screenshot) unless it's done via [[XML:ONLV|ONLV]] level import.
* All consoles can be seen [http://ssg.oni2.net/subfold/consoles/ HERE].
* '''BINACJBOConsole.oni''' is level specific. (It can be found in edition/GameDataFolder/level''XX''_... )
* Activation tolerances: the player must fulfill the following requirements before he can use a console:
* All consoles can be seen [http://ssg.oni2.net/subfold/consoles/ HERE.]
** A distance of 10 or less world units.
* Activation tolerances - player must fullfill following requirements before he can use the console:
** A distance of -2 WU or less (e.g. you can't activate console while standing inside or behind it).
** a distance of 10 or less (world units)
** A facing of 1.22173 radians (ca. 70°) or less.
** a distance of -2 or less (e.g. you can't activate console while standing inside or behind it)
** A sideways shift of 8 WU or less.
** a facing of 1,22173 radians (ca. 70°) or less
** A difference of 8 WU or less between pelvis height and console height.
** a sideways distance of 8 or less
** a height of 8 or less (pelvis height - console height)


 
==File structure==
===file structure===
  <?xml version="1.0" encoding="utf-8"?>
  <?xml version="1.0" encoding="utf-8"?>
  <Oni>
  <Oni>
Line 24: 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'''
==Example==
{| border=0 cellspacing=20 cellpadding=0 style="float:right"
For level import via [[XML:ONLV|XML master file]], use a pre-compiled (*.oni) file as part of a relative file path, e.g. '''consoles/console0.oni'''.
|
'''<font color="#0A0"><CONS Id="8179"></font>'''
[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]
    <Header>
|}
        <Flags>Locked Gunk</Flags>
        '''<font color="#0A0"><CONS Id="8179"></font>'''
        <Position>-1354.927 45 860.053</Position>
            <Header>
        <Rotation>180.000015 0 180.000015</Rotation>
                <Flags>Locked Gunk</Flags>
    </Header>
                <Position>-1354.927 45 860.053</Position>
    <OSD>
                <Rotation>180.000015 0 180.000015</Rotation>
        '''<Class>console0</Class>'''
            </Header>
        <ConsoleId>2</ConsoleId>
            <OSD>
        <Flags>InitialActive</Flags>
                <Class>console0</Class>
        <InactiveTexture>_con_INACTIVE</InactiveTexture>
                <ConsoleId>2</ConsoleId>
        <ActiveTexture>_con_MTCOM_DISH</ActiveTexture>
                <Flags>Active</Flags>
        <TriggeredTexture>_con_MTC_DISHFLASH</TriggeredTexture>
                <InactiveTexture>_con_INACTIVE</InactiveTexture>
        <Events>
                <ActiveTexture>_con_MTCOM_DISH</ActiveTexture>
            <Script Function="fconsole_ok" />
                <TriggeredTexture>_con_MTC_DISHFLASH</TriggeredTexture>
        </Events>
                <Events>
    </OSD>
                    <Script Function="fconsole_ok" />
'''<font color="#0A0"></CONS></font>'''
                </Events>
            </OSD>
        '''<font color="#0A0"></CONS></font>'''


 
==Tags==
===tags===
{| class="wikitable" width=100%
{| class="wikitable" width=100%
!width=280px| tag
!width=280px| Tag
!width=60px| type
!width=60px| Type
! description
! Description
|-
| <?xml version="1.0" encoding="utf-8"?>
| float, flag
| Don't change this.
|-
| <Oni>
| -
|
|-
|-
| <Objects>
| <Objects>
Line 71: Line 55:
|-
|-
| <CONS Id="...">
| <CONS Id="...">
| integer
| int32
| Use any number. No need to be unique.
| Any number; no need to be unique. — For [[XML:ONLV|level importing]], use <CONS>.
|-
|-
| <Header>
| <Header>
Line 80: Line 64:
| <Flags>
| <Flags>
| flag
| flag
| Gunk flags. Appears useless.
| Object flags. Used during development, ignore them.
|-
|-
| <Position>
| <Position>
| float x3
| float x3
| X Y Z position. For original consoles use Y=0 if ground plane is 0.
| 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>
| <Rotation>
| float x3
| float x3
| X Y Z rotation. chr_debug_characters = 1 shows the player's facing which can be used for console's Y value. X and Z should be 0.
| 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>
| <OSD>
Line 102: Line 86:
: console_small_wu_roof
: console_small_wu_roof


For level import via [[XML:ONLV|xml master file]] use absolute/relative file path, e.g. ''consoles/console_data.oni''
For level import via [[XML:ONLV|XML master file]], use a pre-compiled (*.oni) file as part of a relative file path, e.g. '''consoles/console_data.oni'''.
|-
|-
| <ConsoleId>
| <ConsoleId>
| integer
| int16
| Can be used with BSL commands like "console_deactivate ''ID''".
| Can be used with BSL commands like "console_deactivate ''ID''".
|-
|-
Line 125: Line 109:


_con_ALARM_SLEEP / _con_USED / _con_used / _con_INACTIVE
_con_ALARM_SLEEP / _con_USED / _con_used / _con_INACTIVE
'''Use a capitalized file name for this TXMP.'''
|-
|-
|valign="top"| <ActiveTexture>
|valign="top"| <ActiveTexture>
|valign="top"| char[63]
|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 enabled console. Examples:
| <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
_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"| <TriggeredTexture>
|valign="top"| char[63]
|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 used console. Examples:
| <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
_con_ALARM_ON / _con_USED / _con_used / _con_MTC_DISHFLASH
'''Use a capitalized file name for this TXMP.'''
|-
|-
| <Events>
| <Events>
| -
| int16
| You can use multiple events. (int16 data field type)
| You can use multiple events.
|-
|-
|valign="top"| <Script Function="call_this_BSL_function" />
|valign="top"| <Script Function="call_this_BSL_function" />
|valign="top"| char[32]
|valign="top"| char[32]
| Name of BSL function. For example if you use "call_this_BSL_function" here then write in BSL file:
| 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
  ''func call_this_BSL_function
  {
  {
Line 151: Line 141:
|-
|-
| <ActivateTurret TargetId="''Id''" />
| <ActivateTurret TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <DeactivateTurret TargetId="''Id''" />
| <DeactivateTurret TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <ActivateConsole TargetId="''Id''" />
| <ActivateConsole TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <DeactivateConsole TargetId="''Id''" />
| <DeactivateConsole TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <ActivateAlarm TargetId="''Id''" />
| <ActivateAlarm TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <DeactivateAlaram TargetId="''Id''" />
| <DeactivateAlaram TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <ActivateTrigger TargetId="''Id''" />
| <ActivateTrigger TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <DeactivateTrigger TargetId="''Id''" />
| <DeactivateTrigger TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <LockDoor TargetId="''Id''" />
| <LockDoor TargetId="''Id''" />
| integer
| int16
|
|
|-
|-
| <UnlockDoor TargetId="''Id''" />
| <UnlockDoor TargetId="''Id''" />
| integer
| int16
|
|
|}
|}


==Mod Tool-aided import==
'''Limitation:''' This method was created for info consoles only.
VBS code:
[[Image:ModTool_layers.png|thumb|200px|right|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=""[[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"


{{XML}}
{{XML}}

Latest revision as of 15:52, 12 May 2024

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

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

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
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"