XML:BINA/OBJC/CONS: Difference between revisions

From OniGalore
< XML:BINA‎ | OBJC
m (link fix)
mNo edit summary
 
(12 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 is based on onisplit '''v0.9.61.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.
* 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==
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>'''
    <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 [[XML:ONLV|XML master file]], use a pre-compiled (*.oni) file as part of a relative file path, e.g. '''consoles/console_data.oni'''.
{| border=0 cellspacing=20 cellpadding=0 style="float: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>'''


===tags===
==Mod Tool-aided import==
* <Flags> :
'''Limitation:''' This method was created for info consoles only.
: Locked (means what in this case?) (hex: 1)
: Gunk (means what?) (hex: 8)
* <Position> : (console is spawned at this xyz-position)
* <Rotation> : (console is spawned with this xyz-rotation (in degrees))
* <Class>: console0 / console_alarm / console_data / [[Console|?]]
* <ConsoleId> : (used by BSL commands like "console_deactivate ''ID''")
* <Flags> :
:HEX=Dec/Flag
:00 = (empty)(not active)
:01 = 1 (unknown)
:02 = 2 (unknown)
:04 = 4 (unknown)
:08 = '''InitialActive'''
:<font color="#777">09 = 9 (*)</font>
:10 = 16 (unknown)
: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?)
:28 = InitialActive Punch
:40 = '''IsAlarm'''
:80 = 128 (unknown)
:<font color="#777">C0 = 192 (*)</font>
:<font color="#777">EE = 238 (*)</font>
: * not tested, might screw everything, was only set to test the XML export
:Multiple flags:
::known flag and unknown flag are extracted as decimal number added together (see 9)
::known flags are extracted as readable flags, separated by a space sign (see 28)


* <InactiveTexture> : _con_ALARM_SLEEP / _con_USED / _con_used / _con_INACTIVE / <font color="#777">(etc.)</font>
VBS code:
* <ActiveTexture> : _con_ALARM_SLEEP / _con_INFO / _con_MTC_2 / _con_mtc_stairs / _con_MTCOM_DISH / _con_MTCOM_DISH / <font color="#777">(etc.)</font>
[[Image:ModTool_layers.png|thumb|200px|right|How to access scene layers.]]
* <TriggeredTexture> : _con_ALARM_ON / _con_USED / _con_used / _con_MTC_DISHFLASH / <font color="#777">(etc.)</font> (custom textures should be possible)
' make a new layer ("CONS_layer" or whatever)
* <Events>
' make it the current layer (by setting the >> sign)
: <Script Function="calling_this_BSL_function" />
' in shared\consoles folder
: <ActivateTurret TargetId="''Id''" />
' extract console_data.oni as dae
: <DeactivateTurret TargetId="''Id''" />
' import only console_data_11.dae
: <ActivateConsole TargetId="''Id''" />
' duplicate, translate, rotate as you need
: <DeactivateConsole TargetId="''Id''" />
' right-click your CONS_layer > "Select All Objects in Layer"
: <ActivateAlarm TargetId="''Id''" />
' run VBS code to create XML file (script editor: Alt+4, Run code: F5)
: <DeactivateAlaram TargetId="''Id''" />
' it will appear on your desktop
: <ActivateTrigger TargetId="''Id''" />
' edit ConsoleId and Script Function
: <DeactivateTrigger TargetId="''Id''" />
' import by registering consoles in your level's XML master file
: <LockDoor TargetId="''Id''" />
' (<Objects><Import>BINACJBOConsole.xml)
: <UnlockDoor TargetId="''Id''" />
: (You can use multiple events.)
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"