Menu
 

[XML2] Adding your own Xtraction Point

Started by Jayjay, August 31, 2020, 10:53AM

Previous topic - Next topic
August 31, 2020, 10:53AM Last Edit: January 04, 2021, 11:39PM by JasonNumberXIII
Welcome, this tutorial will show you how to add your own Xtraction Point in "X-Men Legends II"!

TUTORIAL TOPICS



  • - how to add a new blue Xtraction Point
  • - how to add a new location to your blue Xtraction Point to the list in the "Xtract" menu!
  • - how to add a new purple Xtraction Point
  • - what you need to know while doing these modifications
REQUIRED TOOLS



  • - "XMLBCUI" compiler
  • - any text editor
IMPORTANT NOTES


Forgive me if I make mistake in the extensions of mentioned files. I have a Polish release of the game and in my case I had to recompile "*.polb" files. If you have an English release, then propably you must seek files ended with the "*.engb" extension.

In this tutorial, I'm editing the first level of this game, the prison. Placing here an Xtraction Point causes some issues like replaying constantly the same cutscene with Cyclops and Nightcrawler everytime when you teleport to this location or change a team from this place. Moreover, it respawns all enemies everytime when you teleport to this location. Finally, opening or breaking the door which is opened by the guards after closing another door near Mystique and Sabretooth "breaks" the door opening event and the camera stays frozen for a while. Some if-conditionals might be able to fix all these issues, but I ignored them to not complicate entire procedure.

Another thing, this tutorial doesn't cover any details about visual customisation of the Xtraction Point! Here you'll only find details about same placement of the Xtraction Point as an interactable game object.

Furthermore, due to non-English language from my side, I can't release files presenting a final effect in case you would like to quickly download files and see this in action. This could bring many incompatibilities.

Lastly, I wasn't able to add the images directly to this post, so I added links to my Google Drive instead. I tried to insert those links between "img" tags, but it's not working.
LET US BEGIN!


In this tutorial, we will focus on editing the first map of the game, the prison. First of all, open "XMLBCUI" compiler and decompile the "tutorial1.***b" file (extensions are dependent on the language used in the game) existing in "Maps\act0\tutorial" directory. Open it as a decompiled version.
ADDING BLUE XTRACTION POINT


To add a blue Xtraction Point, insert the following code to this file (it doesn't matter where you'll insert this fragment, you can even add this after the last entry):


   entity {
      actleader = true ;
      actmatchteam = true ;
      actonuse = true ;
      actscript = common/extraction/exp_activate ;
      actsound = common/game/xtraction ;
      acttogglesanim = true ;
      acttogglesloopfx = true ;
      animstarton = false ;
      classname = gameent ;
      description = Xtraction Point ;
      fxlevel = 1 ;
      ignoretelekinesis = true ;
      loopfx = base/misc/extraction_loop ;
      loopfxstarton = false ;
      model = puzzles/beacon_xtraction ;
      name = xtraction_point ;
      nogravity = true ;
      nopickup = true ;
      nopush = true ;
      quickuse = true ;
      resetstate = true ;
      spawnscript = common/extraction/exp_spawn ;
      team = hero ;
   }
   
   entinst
   {
      type = xtraction_point ;
      inst {
         name = xtraction_point ;
         pos = 1530 4260.00 0 ;
      }
   }
   
   entity {
      actcountremove = 1 ;
      acteffect = base/misc/extraction_burst ;
      actleader = true ;
      actmatchteam = true ;
      actontouch = true ;
      actscript = common/extraction/exp_trig ;
      actsound = common/game/extraction ;
      actteamplayer = true ;
      boxcollision = true ;
      classname = gameent ;
      extent = -120 -120 0 120 120 72 ;
      fxlevel = 1 ;
      name = expt_trig ;
      nocollide = true ;
      nogravity = true ;
      nopickup = true ;
      nopush = true ;
      persistent = false ;
      resetstate = true ;
      team = hero ;
   }


You need these all three "segments" in order to get the new point working correctly. Don't worry, they're like a template for another instance of the Xtraction point and until you don't take care of customisation, you can leave all settings alone. However, you may want to change some values like text or the position in the world. A couple of explanations:

The first fragment called "entity" is a template for an instance of the Xtraction point. From here you can change the text displayed when you're close enough to use this point ("description" field), for example. The rest of values controls physics behavior and particles emitting (it's only my assumption).

The second fragment having "entinst" name (propably "entity instance") is the real instance of this point placed on the world as a fully interactive game object (glowing blue-ish circle with flowing particles). As you can see, one of the fields of the "inst" property has position values. You can edit them to manipulate the position in the game. The values written above will be used in this tutorial, but you can edit them as you like.

Lastly, we have another "entity" fragment, but this time it controls the "trigger effect" when you're unlocking another Xtraction Point. You can skip this piece and the point will work, but you won't be able to see the activation effect with the sound and most importantly, the point won't be triggered as "discovered"! It'll be triggered only after you'll go to the world map from this point (this actually has been checked by me). I assume that "actscript" serves as a "callback" to call specific method when the player sends a signal to the game while approaching to the point.

See yourself how it's look like when you ignore the "trigger" effect: https://drive.google.com/file/d/1kfydmQwaqZYISo-9HzPkAHvSch611ixU/view?usp=sharing

After inserting the given code, save all changes. Now all you have to do is use the "XMLBCUI" software again, compile it and run the game to see the effect.

This is the end of work if you only want to add your own point in order to save the game and don't care about the world map.

ADDING LOCATION TO THE WORLD MAP


If you want to add your newly created point to the world map to back to this location at any time, you need to repeat the decompiling process. Head to the "Data" folder and decompile the "zone_info.***b" file. This is the file that keeps information about locations and which of them contain an Xtraction Point.

Because we're editing the prison map, we're going to locate the correct "zone" block which has a string "act0/tutorial/tutorial1" in the "name" property. In my case, it begins from line #240. If you cannot find it, paste the given string into your search engine.

In order to add an Xtraction Point to the location which hasn't it right now, you have to add some values inside the "zone" block:

  • "description" which will show any given sentence about location
  • "extraction" as a boolean set to "true"
  • "mapx" as an X coordinate of these "flowing markers" on the map image on the left side of the "Xtract" menu
  • "mapy" as a Y coordinate of the same markers explained above
In my case, it looks like this:

zone {
   act = 1 ;
   build = normal ;
   
   description = My first custom Xtraction Point! ;
   extraction = true ;
   mapx = 0.4 ;
   mapy = 0.1 ;
   
   loading = textures/loading/tutorial ;
   name = act0/tutorial/tutorial1 ;
   savename = Prison ;
   state = 2 ;
   }


WARNING!
The "description" MUST BE placed before the "extraction" property! Otherwise, you will see the empty space in the description panel being in the game!

"savename" property allows you to set a name to the location which will be displayed not only in the "Xtract" menu to the right, but also in the save game menu. After that, just save all changes, compile it and launch the game.

If you didn't make any mistake, you'll see your first Xtraction Point when you go to the corridor after fighting with the first four guards.

See the screenshots linked below:
https://drive.google.com/file/d/1CiatFIGSu5pvP06GFqd18UHQWKXLkHAL/view?usp=sharing
https://drive.google.com/file/d/1-erW6wXis79dEQ3k5EsghxYrr9w1yJ0_/view?usp=sharing
https://drive.google.com/file/d/1F1PwMcbTZ3iEdoUELU0dTZsqAbFuzXrv/view?usp=sharing

ADDING PURPLE XTRACTION POINT


Purple Xtraction Point is easier to add, because requires only the modification inside of the file existing in "Maps" catalog. His "skeleton" is similar to the blue point, but it's simpler. It doesn't require this "trigger" effect explained above. Insert the following code to the "tutorial1.***b" file after you decompile the content:


entity {
   actleader = true ;
   actmatchteam = true ;
   actonuse = true ;
   actscript = extractionPointLite('_OWNER_','true','false','false') ;
   actsound = common/game/xtraction ;
   acttogglesanim = false ;
   animstarton = true ;
   classname = gameent ;
   description = Xtraction Point ;
   fxlevel = 2 ;
   ignoretelekinesis = true ;
   loopfx = base/misc/extraction_loop ;
   loopfxstarton = true ;
   model = puzzles/beacon_xtraction_saveonly ;
   name = xtraction_point_sidemission ;
   nogravity = true ;
   nopickup = true ;
   nopush = true ;
   quickuse = true ;
   team = hero ;
   toggleonact = false ;
   }
   
   entinst {
   type = xtraction_point_sidemission ;
      inst {
      name = xtraction_point_sidemission ;
      pos = 513 5413 0 ;
      }
   }


When you save these changes, compile the code and launch the game, you'll be able to see the purple point after making a few steps towards the first door.

Screenshot:
https://drive.google.com/file/d/104IfvrSMfbEpAS-DDhGQTwGKDlE69KQx/view?usp=sharing

WHAT ELSE YOU NEED TO KNOW?


There is still one important thing about location addition to the world map. In this example I added the prison map to the Act 1 which has already all slots taken (there are seven of them). Did you notice on screenshot what happened after exceeding this limit? It "shifted" the list one slot forward, so "Sanctuary" takes the 2nd place, "Dead Zone" the 3rd place and so on. In this connection, the "Grand Hall" hasn't been added! This is confirmed, I made additional tests and the last point doesn't exist (it may serve only as a "save point" going to this point manually)! Propably this limit is hardcoded and there's no any comfortable method to bypass this limit and add ability to "scroll down" the list. Insertion might have a sense only in two last acts where there you have some free slots to use.

About the setting order...I suspect that this must be adjustable automatically by "pushing" arguments into the list, one by one going from top to botttom. The program must check if the current location contains the "extraction" flag and if it's true, then takes the description, current act number which this belongs to, map X and Y coordinates and it adds to the list. It must stop this procedure when the limit has been reached (7). All of these explanations mentioned in this paragraph haven't been confirmed by any tests!

Last thing you must know is that you can have your point automatically unlocked from the beginning without activating it. Calling this method inside the correct Python script ("tutorial1.py" in our example):


extractionUnlock("")


you'll have your Xtraction Point triggered immediately! This explains why in any "hub" level you don't have to trigger those points manually. Empty quotation marks means that you want to unlock "this" location (looking at directory where this script actually is). You can also unlock any other point giving location to the corresponding script. For example this:


extractionUnlock("act1/deadzone/deadzone1")


will give you access to the "Dead Zone" area, even before unlocking your point!


Thanks for reading and I hope this will come in handy for any modding user who wanted to manipulate with those points! Feel free to post any comment about this.