8,141
edits
Paradox-01 (talk | contribs) mNo edit summary |
Paradox-01 (talk | contribs) mNo edit summary |
||
(17 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{XML_OBJC_Header | prev=CMBT| type=CONS | next=DOOR | name=Console}} | |||
{| | |||
==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. | |||
==File structure== | |||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<Oni> | <Oni> | ||
Line 23: | Line 21: | ||
</Oni> | </Oni> | ||
'''''[...]''''' | '''''[...]''''' 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 | |||
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> | |||
| 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: | |||
'''example''' | _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 | |||
| | | | ||
|} | |} | ||
==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}} | |||
edits