[NS2 mod hello world] Unable to load/test my mod
Katzenfleisch
Join Date: 2014-03-21 Member: 194881Members, Squad Five Blue, Squad Five Silver, NS2 Community Developer
Hi,
I have been trying to do some modding but I am stuck at the beginning: loading my mod in the game.
I am actually following this tutorial "http://forums.unknownworlds.com/discussion/128106/how-to-make-a-mod-for-natural-selection-2" but in vain. I have also checked many time the content of my lua and xml file to ensure there were no errors.
I was thinking about a wrong mod path so i have tried those:
* AppData\Roaming\Natural Selection 2\Workshop (where downloaded mod are stored)
* AppData\Roaming\Natural Selection 2\
* Desktop\
* Steam\SteamApps\common\Natural Selection 2 (as suggested by the tutorial)
Also, for some path the the Spark Engine Builder is unable to build it at all and give me this output:
"""
Rebuilding...
Build complete (0 seconds)
0 succeeded, 0 failed, 0 up-to-date, 7 skipped
"""
Each time I start the game (starting with the shortcut option "-game randomizealiens -hotload") and type 'map ns2_XXX' it look like it is loading a normal server with the name entered in "Browse Server/Create Server/Server Name". However I found one way to make it work: edit by hand one existing mod in "Roaming\Natural Selection 2\Workshop\m....", but I need to reload the game each time and the -hotload option crash the game. (which is too much painful and time consuming).
I will be thanks full if anyone has an idea on how to resolve this issue and allow me to continue this work.
Ps: I provide in attachment the files I am working on.
I have been trying to do some modding but I am stuck at the beginning: loading my mod in the game.
I am actually following this tutorial "http://forums.unknownworlds.com/discussion/128106/how-to-make-a-mod-for-natural-selection-2" but in vain. I have also checked many time the content of my lua and xml file to ensure there were no errors.
I was thinking about a wrong mod path so i have tried those:
* AppData\Roaming\Natural Selection 2\Workshop (where downloaded mod are stored)
* AppData\Roaming\Natural Selection 2\
* Desktop\
* Steam\SteamApps\common\Natural Selection 2 (as suggested by the tutorial)
Also, for some path the the Spark Engine Builder is unable to build it at all and give me this output:
"""
Rebuilding...
Build complete (0 seconds)
0 succeeded, 0 failed, 0 up-to-date, 7 skipped
"""
Each time I start the game (starting with the shortcut option "-game randomizealiens -hotload") and type 'map ns2_XXX' it look like it is loading a normal server with the name entered in "Browse Server/Create Server/Server Name". However I found one way to make it work: edit by hand one existing mod in "Roaming\Natural Selection 2\Workshop\m....", but I need to reload the game each time and the -hotload option crash the game. (which is too much painful and time consuming).
I will be thanks full if anyone has an idea on how to resolve this issue and allow me to continue this work.
Ps: I provide in attachment the files I am working on.
Comments
A personal tip: Use the builder.exe only if needed!!!
BTW: This tut by uwe is imho easier to understand and abit better: http://unknownworlds.com/ns2/time-to-make-the-mods/ ( even as this is also outdated )
And hotload is just buggy as **** so better don't use that also.
For now just copy your lua folder and game_setup.xml into the output folder and click at launch game in the launchpad to start ns2 with your mod ( the output folder ) mounted. To load changes just restart the local server ( esc -> server browser -> create server -> create )
Tip: to speed things up i really suggest to use a dev map. Those can be found in this forum or some major mods.
FYI:
The game_setup.xml should only be used if you create a new gamemode as it only can be used once.
If you want to add something to the game try to use the entry system and hooks ( via sewleks framework ).
To get how to use this read the readme in lua/entry in the ns2 folder + read some source files of mods using this system ( e.g. CHUD https://github.com/Mendasp/CustomHUD/tree/master/lua )
The easiest way to mod so far is to just overload default lua files. You do this by copying the files you want to mod into your output folder and just edit them. Warning: Your mod will conflict with any other mod using the same files.
But this is a good way to do smaller stuff and get used to ns2 modding.
If you want to do mostly server stuff. I would recommend to work with the shine lib/ framework and create a shine plugin:
You will find all info you need for that here in the shine wiki: https://github.com/Person8880/Shine/wiki#for-developers
Hope this isn't too much for now and i wish you good luck with getting into ns2 modding. If you have any questions just ask them in this forum we have alot ppl around here who are happy to help you getting things done
I am now working on find&load a small map to speed up lua development.
About the modding I am working on an upgrade of the Faded mode 0.16.
By the way, did you know where I can find usefull console command ? (like "give shotgun" or "cheats 1", this kind of cmd), to give all upgrade at once for exemple.
There is a list of useful console commands stickied somewhere, but basically:
cheats 1 - turns on cheats and starts the game
gorge/skulk/ - etc give you that lifeform as an alien
pres - gives you 100 personal res
tres - gives you 100 team res
give skulk/gorge/marine - etc will drop that item where you are standing, usually on top of your head.
alltech - unlocks all the games technology
That's all you need for basics, just play to find more, and as you are modding things, have a look at the console commands lua files to see the other juicy options available
Or just look at the wiki page: http://wiki.unknownworlds.com/ns2/Console_Commands Samusdroid keeps that pretty much up to date.
Also i forgot to mention the ns2doc is pretty helpfull if you don't want to search all lua files all the time to find the func doing xy. Just download it here https://drive.google.com/file/d/0B_AoHvDBSRoDaWlHaTNqR3pOMGs and run the ns2docs-console.exe. It will create automatically the docs in the same folder under ns2docs.
To open it best start with the index.html in globals
Strange never had a problem to run it, here is the 264 version for anyone else who is not able to run the exe themself: https://drive.google.com/file/d/0B_AoHvDBSRoDWDVmbWVVc2RiOTg/edit?usp=sharing
It's the same (not sure if up to date) hosted by someone.