What to do first before changing any code?

wulf 21wulf 21 Join Date: 2011-05-03 Member: 96875Members
<div class="IPBDescription">looking for a way to get started in NS2-scripting</div>Some days ago I disovered a bug (<a href="http://getsatisfaction.com/unknownworlds/topics/_176_wont_pick_up_grenade_launcher_ammo" target="_blank">this one</a>), took a look at the code and suggested a solution. However I didn't try it out because backing up the script-file and the overwriting it with my edited file seems somewhat impractical. I would have to replace my file with the backup everytime I want to play the game online. (does the game think you are cheating if you play with modified scripts?)

Maybe Builder could help me out here. (somebody please explain what it does)

But the best solution I could imagine is writing own functions that override the original functions if I'm loading my "costum game" and use all the other original functions otherwise, the same thing thing the overmind mod is doing. (It leaves all the original files untouched)

So basically what I'm looking for is a step-by-step guide on what to do before messing around with the code.

Comments

  • MotigMotig Join Date: 2008-10-23 Member: 65281Members
    Create a folder in your Steam\steamapps\common\natural selection 2 folder and name it "mymod" for example.

    In that folder make a folder named "lua".

    Now if you modifiy Player.lua for example you can save the edited version in mymod/lua.

    To load the game with your modified Player.lua make a shortcut to NS2.exe and add -game "mymod" to the end of the target of the shortcut. The game should now launch like normal but it'll load the files you've put in your mymod directory if they exist.

    (If you want the game to load a new lua file take a look at Shared.lua)

    Hope this helps!
  • wulf 21wulf 21 Join Date: 2011-05-03 Member: 96875Members
    thank you very much, it works! :-)
  • wulf 21wulf 21 Join Date: 2011-05-03 Member: 96875Members
    edited May 2011
    Just found out another thing: If I only want to change some functions rather than having to copy the whole file I can just put a Script.Load("../ns2/lua/<original filename>") at the beginning of my file.
    And I saw the video in which the devs were experimenting with the alien-vision, changing code while the game was running in a window. I tried it and it works, too! Changing the code and seeing the effect immediately is so cool.
Sign In or Register to comment.