Doing a bit of modding (beginner questions)

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Posts: 73
Joined: Mon, 26. Jul 04, 23:49

Doing a bit of modding (beginner questions)

Post by Hotshot22 » Thu, 19. Apr 18, 11:51

Hey guys!

I'm quite new to modding X and I've been reading about anything I could find on Rebirth modding howtos, but I still have a few question and I hope you can help me out a bit :-)
  • I've made a mod which let's the player initate the smalltalk minigame; this is done rather easily via "XML Patching". But, I cannot get rid of the following "warnings" in the debuglog, which I get for every changed .xml:
    Ignoring root node 'diff' in XML file

    Code for 'npc_itemtrader.xml':

    Code: Select all

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- MiningSupplier, JunkDealer, SpaceFarmer, ShipTechnician, EquipmentVendor, FoodMerchant, DroneTrader, ArmsDealer, RecruitingOfficer, BlackMarket, HumanResources -->
    	<replace sel="/mdscript[@name='NPC_Itemtrader']/cues/cue[@name='OnPlatformPopulation_Itemtrader']/cues/cue[@name='DefaultComm']/actions/do_else/do_if[@value='not $actor.$SmalltalkDone? and player.age lt @$actor.$TopicTimeout']">
    		<do_if value="not $actor.$SmalltalkDone? and == $">
    			<add_player_choice_sub text="{1002,900000}" section="gSmalltalk_start" position="top_right" baseparam="event.param2" />
  • What I haven't figured out is on how to do "the same" (replacing code) in LUA files... like reducing the weapon-mods install price:
    I just need to change the "sortwares" variable, but how? I don't think that patching (as in xml) is possible, so it has to be done some other way and that's what I've come up with (which doesn't work by the way^^):

    Code: Select all

    local function init()
    	-- iterate through menus
    	for _, menu in ipairs(Menus) do
    		-- select the corresponding menu
    		if == "WeaponModTransferMenu" then
    			-- change the variable
    			menu.sortwares = {
    				["inv_weaponmod_t1"] = { priority = 1, color = { r = 30, g = 255, b = 0, a = 100 }, installfee = 1000, removefee = 500 },
    				["inv_weaponmod_t2"] = { priority = 2, color = { r = 64, g = 154, b = 255, a = 100 }, installfee = 5000, removefee = 500 },
    				["inv_weaponmod_t3"] = { priority = 3, color = { r = 193, g = 83, b = 238, a = 100 }, installfee = 10000, removefee = 500 },
Thanks a lot! :-)

Posts: 19
Joined: Tue, 10. Apr 18, 17:36

Re: Doing a bit of modding (beginner questions)

Post by marceldev89 » Thu, 19. Apr 18, 14:53

Judging by how some other mods do things, try moving the comment inside the <diff> block. Note that I have 0 experience in XR modding so it might just be nonsense I'm saying. ^^

User avatar
Marvin Martian
Posts: 2686
Joined: Sun, 8. Apr 12, 09:40

Post by Marvin Martian » Thu, 19. Apr 18, 15:00

the diff stuff is because of name of the file, type all like npc_itemtrader.xml in lowered characters should solve this problem, if you use the name like extracted filenames this <diff> message appiers in debuglog

Posts: 73
Joined: Mon, 26. Jul 04, 23:49

Post by Hotshot22 » Fri, 20. Apr 18, 08:36

Thanks for the input; I will try the suggestion with the xml being the same file name :-)

Concerning the second part with the lua script I think I figured it out:

although I copied the code from the official Wiki, it seems they forgot to add "init ()" as the last command :roll:

I have to admit, seeing as the function itself is called "init", I thought that would be it, but nope :-)

So for now I got everything working as intended. Just need to get to work on some other mods^^

Post Reply

Return to “X Rebirth - Scripts and Modding”