XML:BINA/OBJC/CONS

From OniGalore
< XML:BINA‎ | OBJC
Revision as of 09:35, 28 December 2017 by Paradox-01 (talk | contribs) (ignore this)
Jump to navigation Jump to search
CONS : Console spawn list
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

CHAR << Other OBJC >> CMBT

switch to OBD page

general information

  • The xml code 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.
  • Facing (Y rotation) needs to be changed by 180 degrees.
  • This console spawning doesn't include console geometry (see screenshot) unless it's done via ONLV level import.
  • BINACJBOConsole.oni is level specific. (It can be found in AE/AEInstaller/vanilla/levelX_Final.dat)
  • All consoles can be seen HERE.
  • Activation tolerances - player must fullfill following requirements before he can use the console:
    • a distance of 10 or less (world units)
    • a distance of -2 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 distance of 8 or less
    • a height of 8 or less (pelvis height - console height)


file structure

<?xml version="1.0" encoding="utf-8"?>
<Oni>
   <Objects>
       [...]
   </Objects>
</Oni>

[...] means at least one console. Paste all 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
<?xml version="1.0" encoding="utf-8"?> float, flag Don't change this.
<Oni> -
<Objects> -
<CONS Id="..."> int32 Use any number. No need to be unique. -- For level import use <CONS>.
<Header> -
<Flags> flag Object flags. Used in the past, ignore them.
<Position> float x3 X Y Z position. For original consoles use Y=0 if ground plane is 0.
<Rotation> 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.
<OSD> -
<Class> link Original consoles:
console_alarm
console_data
console0
console_small_wu_roof

For level import via 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 capitalized file name for this TXMP.

<ActiveTexture> char[63] TXMPfile.oni (don't use file prefix/suffix) Image for enabled console. Examples:

_con_ALARM_SLEEP / _con_INFO / _con_MTC_2 / _con_mtc_stairs / _con_MTCOM_DISH / _con_MTCOM_DISH

Use capitalized file name for this TXMP.

<TriggeredTexture> char[63] TXMPfile.oni (don't use file prefix/suffix) Image for used console. Examples:

_con_ALARM_ON / _con_USED / _con_used / _con_MTC_DISHFLASH

Use 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 BSL file:
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 information 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"