XML:Advanced tutorial: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(... this)
 
mNo edit summary
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{XML Home}}
:: '''''New resources are also recognized in BSL.'''''
:: '''''New resources are also recognized in BSL.'''''


Line 5: Line 6:
Animations, characters, flags, functions from binaries (CONS, CHAR, etc.), lasers, sounds, text pages, trigger volumes, turrets, weapons, etc., they all are recognized by their name or ID in BSL.
Animations, characters, flags, functions from binaries (CONS, CHAR, etc.), lasers, sounds, text pages, trigger volumes, turrets, weapons, etc., they all are recognized by their name or ID in BSL.


That means that you must not modify everything, you can also add new content and it will work together with the old stuff.
This means that you don't have to modify everything, you can also add new content and it will work together with the old stuff.


:: '''''Resources depend on each other.'''''
:: '''''Resources can depend on each other.'''''


For example:
For example:
Line 13: Line 14:
"ai2_movetoflag ''CharacterNameOrID FlagID''" is a BSL command, it tells a character to move to a specific flag. This command makes use of one resource.
"ai2_movetoflag ''CharacterNameOrID FlagID''" is a BSL command, it tells a character to move to a specific flag. This command makes use of one resource.


"ai2_dopath ''CharacterNameOrID PathName''" is also a BSL command, it tells a character to walk or run on a specific path formed by several flags. The path is one resource that contain actually several other resources. So it depend on them, right? A much more complex example is ONCC ...
"ai2_dopath ''CharacterNameOrID PathName''" is also a BSL command, it tells a character to walk or run on a specific path formed by several flags. The path is one resource that contains actually several other resources. So it depend on them, right? While path collections are pretty simple there are also much more complex examples like ONCC and ONLV.
 
{| class="wikitable" width="100%"
|valign="top"|<pre>
flag collection (BINACJBOFlag)</pre>
|valign="top"|<pre>
path collection (BINACJBOPatrol Path)
  |
  +-- flags</pre>
|valign="top"|<pre>
Oni Character Class (ONCC)
  |
  +-- animation collection (TRAC)
  |      |
  |      +-- animations (TRAM)
  |
  +-- texture list (TRMA)
  |      |
  |      +-- textures (TXMP)
  |
  +-- 3D model (TRBS)
  |      |
  |      +-- various 3D data types
  |
  +-- ... many more</pre>
|}


:: '''''I think we should try something together now.'''''
:: '''''I think we should try something together now.'''''
Line 19: Line 45:
* Let's play in window mode, then we can change to a notepad when we need to.
* Let's play in window mode, then we can change to a notepad when we need to.


* We need someone that act as a guinea pig. Let's load level 1, first savepoint, activate developer mode (try typing "x" or "thedayismine"). On my PC I have to press key "^" now. That opens the developer console for me. Find the key that does the same for you. Now let's type "ai2_shownames = 1". You can't see the dev console? Try a more native resolution 640x480. You know Oni is a bit buggy.
* We need someone to be our "[[wp:Guinea_pig#In_scientific_research|guinea pig]]". Let's load level 1, first savepoint, activate developer mode (try typing "x" or "thedayismine").
:: See if you have a QWERT<u>Y</u> keyboard. ~ key will open the developer mode for you. Or is it a QWERT<u>Z</u> keyboard? Then try ^ key.
:: If you cannot find the right key you can also change your key_config.txt in the folder with the game application. For example: "bind divide to console" (Devide key from numpad.) (See [[Customizing/Binding|here]] for other possible keys, fkeys might not work as console unlocker.)
:: Some resolutions hides the command line, try then playing at 800x600 or 640x480. (You can change that in Oni's option menu.)


* Aha, his name is "A_t48". Let's remember that later. Key F6 will kill him. Now we won't get interrupted by him ...
* Now let's type "ai2_shownames = 1". Aha, his name is "A_t48". Let's remember that later. Key F6 will kill him. Now we won't get interrupted by him ...


* We need new flags. "chr_debug_characters = 1" displays player character's current position. That can be used to set them up.
* We need new flags. "chr_debug_characters = 1" displays player character's current position. That can be used to set them up.
Line 27: Line 56:
* We goto three points. First, beneath the edge (-600 0 -640). Second, to the always closed door (-650 0 -750). Third, at the opposite side is a electro thingy (-650 0 -475).
* We goto three points. First, beneath the edge (-600 0 -640). Second, to the always closed door (-650 0 -750). Third, at the opposite side is a electro thingy (-650 0 -475).


* Now our XML work begins. We need to extract '''"BINACJBOFlag.oni"''' and '''"BINACJBOPatrol Path.oni"''' from '''level1_Final folder'''. Use "BINACJBOPatrol*.oni when you can't extract the Patrol Path file. (* ''replaces everything'' what comes after it.)
* Now our XML work begins. We need to extract '''"BINACJBOFlag.oni"''' and '''"BINACJBOPatrol Path.oni"''' from '''level1_Final folder'''. Use "BINACJBOPatrol*.oni" when you can't extract the Patrol Path file. (* ''replaces everything'' what comes after it.)
 
* Let's open [[OBD_talk:BINA/OBJC/FLAG|FLAG documentation]] and the corresponding XML file.


* End file's end we see. "<FlagId>7056</FlagId>" So 7056 is very probably the last flag.
* At file's end we see. "<FlagId>7056</FlagId>" So 7056 is very probably the last flag.


* Now we copy a block three times and insert our new data.
* Now we copy a block three times and insert our new data.


         <Object Id="11568" Type="FLAG">
         <FLAG Id="11568">
             <Header>
             <Header>
                 <Flags>0</Flags>
                 <Flags></Flags>
                 '''<Position>-600 0 -640</Position>'''
                 '''<Position>-600 0 -640</Position>'''
                 <Rotation>0 200.5907 0</Rotation>
                 <Rotation>0 200.5907 0</Rotation>
Line 47: Line 74:
                 <Notes>under the edge</Notes>
                 <Notes>under the edge</Notes>
             </OSD>
             </OSD>
         </Object>
         </FLAG>
         <Object Id="11568" Type="FLAG">
         <FLAG Id="11568">
             <Header>
             <Header>
                 <Flags>0</Flags>
                 <Flags></Flags>
                 '''<Position>-650 0 -750</Position>'''
                 '''<Position>-650 0 -750</Position>'''
                 <Rotation>0 200.5907 0</Rotation>
                 <Rotation>0 200.5907 0</Rotation>
Line 60: Line 87:
                 <Notes>closed door</Notes>
                 <Notes>closed door</Notes>
             </OSD>
             </OSD>
         </Object>
         </FLAG>
         <Object Id="11568" Type="FLAG">
         <FLAG Id="11568">
             <Header>
             <Header>
                 <Flags>0</Flags>
                 <Flags></Flags>
                 '''<Position>-650 0 -475</Position>'''
                 '''<Position>-650 0 -475</Position>'''
                 <Rotation>0 200.5907 0</Rotation>
                 <Rotation>0 200.5907 0</Rotation>
Line 73: Line 100:
                 <Notes>electro thingy</Notes>
                 <Notes>electro thingy</Notes>
             </OSD>
             </OSD>
         </Object>
         </FLAG>


* Let's save flag file, convert it back into .oni formate and continueing with the patrol path file. Documentation can be found [[OBD_talk:BINA/OBJC/PATR|here]]. (XML basic tutorial page has an overview whether docus are available or not.)
* Let's save flag file, convert it back into .oni formate and continueing with the patrol path file. Documentation can be found [[XML:BINA/OBJC/PATR|here]]. (XML basic tutorial page has an overview whether docus are available or not.)


         <Object Id="11569" Type="PATR">
         <PATR Id="11569">
             <Header>
             <Header>
                 <Flags>0</Flags>
                 <Flags></Flags>
                 <Position>80.96647 15.1689625 -536.0079</Position>
                 <Position>80.96647 15.1689625 -536.0079</Position>
                 <Rotation>0 0 0</Rotation>
                 <Rotation>0 0 0</Rotation>
Line 96: Line 123:
                 </Points>
                 </Points>
             </OSD>
             </OSD>
         </Object>
         </PATR>


{| border=0 cellspacing=20 cellpadding=0 align=right
| [http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/OniAE.gif http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/OniAE_TN.gif]<br>[http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/XML_advanced_tutorial.png http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XML_modding/XML_advanced_tutorial_TN.png]
|}


* Convert it back to .oni format.
* Convert it back to .oni format.


* Remember the test package from [[XML_basic_tutorial|XML basic tutorial]]? Create this directory '''"Oni\Edition\install\packages\90000Test\oni\level1_Final\level1_Final"''', put your oni files into there and reinstall the test package.  
* The modified "BINACJBOFlag.oni" and "BINACJBOPatrol Path.oni" are put into a [[XML|package]] now. Reinstall with this package.


* Are we done? Almost. Still a BSL file needs to be written. Let's backup and then kick out all BSL files from '''"GameDataFolder\IGMD\EnvWarehouse"''' and insert only this as BSL file. (It's a txt file, suffix changed to bsl.) Be sure to do that in AE's directory, not vanilla's one. Load level 1 and do a kick to start the test.


* Hohoho, we are done? Almost. Still a BSL file needs to be written. Let's kick out all BSL files from '''"Oni\Edition\GameDataFolder\IGMD\EnvWarehouse"''' and insert only this as BSL file. (It's a txt file, suffix changed to bsl.)
[[Image:XML_advanced_tutorial.png|400px|right|thumb]]
 


  func main
  func main
Line 117: Line 141:
  ai2_spawn A_t48
  ai2_spawn A_t48
  chr_changeteam A_t48 TCTF
  chr_changeteam A_t48 TCTF
  chr_wait_animtype 0 kick
  chr_wait_animtype 0 kick  
  ### Do a kick. Engine will continue with following lines.
  ### Do a kick. Engine will continue with following lines.
  dmsg "[r.Hey man, try new path now.]"
  dmsg "[r.Hey man, try new path now.]"
  '''ai2_dopath A_t48 patrol_63'''
  '''ai2_dopath A_t48 patrol_63'''
  }
  }
[[Category:Modding tutorials]]

Latest revision as of 21:07, 7 May 2022

Click to return to the main XML page.
New resources are also recognized in BSL.

XML modding can be used to extend your possibilities in BSL.

Animations, characters, flags, functions from binaries (CONS, CHAR, etc.), lasers, sounds, text pages, trigger volumes, turrets, weapons, etc., they all are recognized by their name or ID in BSL.

This means that you don't have to modify everything, you can also add new content and it will work together with the old stuff.

Resources can depend on each other.

For example:

"ai2_movetoflag CharacterNameOrID FlagID" is a BSL command, it tells a character to move to a specific flag. This command makes use of one resource.

"ai2_dopath CharacterNameOrID PathName" is also a BSL command, it tells a character to walk or run on a specific path formed by several flags. The path is one resource that contains actually several other resources. So it depend on them, right? While path collections are pretty simple there are also much more complex examples like ONCC and ONLV.

 flag collection (BINACJBOFlag)
 path collection (BINACJBOPatrol Path)
   |
   +-- flags
 Oni Character Class (ONCC)
  |
  +-- animation collection (TRAC)
  |      |
  |      +-- animations (TRAM)
  |
  +-- texture list (TRMA)
  |      |
  |      +-- textures (TXMP)
  |
  +-- 3D model (TRBS)
  |      |
  |      +-- various 3D data types
  |
  +-- ... many more
I think we should try something together now.
  • Let's play in window mode, then we can change to a notepad when we need to.
  • We need someone to be our "guinea pig". Let's load level 1, first savepoint, activate developer mode (try typing "x" or "thedayismine").
See if you have a QWERTY keyboard. ~ key will open the developer mode for you. Or is it a QWERTZ keyboard? Then try ^ key.
If you cannot find the right key you can also change your key_config.txt in the folder with the game application. For example: "bind divide to console" (Devide key from numpad.) (See here for other possible keys, fkeys might not work as console unlocker.)
Some resolutions hides the command line, try then playing at 800x600 or 640x480. (You can change that in Oni's option menu.)
  • Now let's type "ai2_shownames = 1". Aha, his name is "A_t48". Let's remember that later. Key F6 will kill him. Now we won't get interrupted by him ...
  • We need new flags. "chr_debug_characters = 1" displays player character's current position. That can be used to set them up.
  • We goto three points. First, beneath the edge (-600 0 -640). Second, to the always closed door (-650 0 -750). Third, at the opposite side is a electro thingy (-650 0 -475).
  • Now our XML work begins. We need to extract "BINACJBOFlag.oni" and "BINACJBOPatrol Path.oni" from level1_Final folder. Use "BINACJBOPatrol*.oni" when you can't extract the Patrol Path file. (* replaces everything what comes after it.)
  • At file's end we see. "<FlagId>7056</FlagId>" So 7056 is very probably the last flag.
  • Now we copy a block three times and insert our new data.
       <FLAG Id="11568">
           <Header>
               <Flags></Flags>
               <Position>-600 0 -640</Position>
               <Rotation>0 200.5907 0</Rotation>
           </Header>
           <OSD>
               <Color>255 255 0</Color>
               <Prefix>17228</Prefix>
               <FlagId>7057</FlagId>
               <Notes>under the edge</Notes>
           </OSD>
       </FLAG>
       <FLAG Id="11568">
           <Header>
               <Flags></Flags>
               <Position>-650 0 -750</Position>
               <Rotation>0 200.5907 0</Rotation>
           </Header>
           <OSD>
               <Color>255 255 0</Color>
               <Prefix>17228</Prefix>
               <FlagId>7058</FlagId>
               <Notes>closed door</Notes>
           </OSD>
       </FLAG>
       <FLAG Id="11568">
           <Header>
               <Flags></Flags>
               <Position>-650 0 -475</Position>
               <Rotation>0 200.5907 0</Rotation>
           </Header>
           <OSD>
               <Color>255 255 0</Color>
               <Prefix>17228</Prefix>
               <FlagId>7059</FlagId>
               <Notes>electro thingy</Notes>
           </OSD>
       </FLAG>
  • Let's save flag file, convert it back into .oni formate and continueing with the patrol path file. Documentation can be found here. (XML basic tutorial page has an overview whether docus are available or not.)
       <PATR Id="11569">
           <Header>
               <Flags></Flags>
               <Position>80.96647 15.1689625 -536.0079</Position>
               <Rotation>0 0 0</Rotation>
           </Header>
           <OSD>
               <Name>patrol_63</Name>
               <PatrolId>63</PatrolId>
               <ReturnToNearest>1</ReturnToNearest>
               <Points>
                   <Loop>
                       <MovementMode Mode="Run" />
                       <MoveToFlag FlagId="7057" />
                       <MoveToFlag FlagId="7058" />
                       <MoveToFlag FlagId="7059" />
                   </Loop>
               </Points>
           </OSD>
       </PATR>


  • Convert it back to .oni format.
  • The modified "BINACJBOFlag.oni" and "BINACJBOPatrol Path.oni" are put into a package now. Reinstall with this package.
  • Are we done? Almost. Still a BSL file needs to be written. Let's backup and then kick out all BSL files from "GameDataFolder\IGMD\EnvWarehouse" and insert only this as BSL file. (It's a txt file, suffix changed to bsl.) Be sure to do that in AE's directory, not vanilla's one. Load level 1 and do a kick to start the test.
XML advanced tutorial.png
func main
{
	chr_location 0 -577 0 -640
	ai2_shownames = 1
	chr_debug_characters = 1
	ai2_spawn A_t48
	chr_changeteam A_t48 TCTF

	chr_wait_animtype 0 kick 
	### Do a kick. Engine will continue with following lines.

	dmsg "[r.Hey man, try new path now.]"
	ai2_dopath A_t48 patrol_63
}