Anyone able to get a mod working? If so, how?

TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
I've been following Rio's tutorial on creating lua mods. Its not working for me though.

This is what my NS2/lua mod folder looks like:

mcmu1928xr2h.png

The message in the "SchizoModShared.lua" file featured there just isn't appearing in game. I've checked for spelling errors too, it all checks out.

Any help?

Comments

  • KatzenfleischKatzenfleisch Join Date: 2014-03-21 Member: 194881Members, Squad Five Blue, Squad Five Silver, NS2 Community Developer
    Hi,

    I do not know what LoadModFIles.lua is about for now but I may ask how you load those since everything seams correct from my point of view:
    • Did you use a windows shortcut ? (something similar to this: "C:\Program Files (x86)\SteamDir\steamapps\common\Natural Selection 2\NS2.exe" -game C:\Users\root\Desktop\tmp\NS2\faded")
    • Did you simply start the regular ns2 ?
    • Did you upload on the workshop and then create a local server ?

    Ideally detailling how you test your mod in order to tell if it's working or not.
  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited June 2015
    Hi,

    I do not know what LoadModFIles.lua is about for now but I may ask how you load those since everything seams correct from my point of view:
    • Did you use a windows shortcut ? (something similar to this: "C:\Program Files (x86)\SteamDir\steamapps\common\Natural Selection 2\NS2.exe" -game C:\Users\root\Desktop\tmp\NS2\faded")
    • Did you simply start the regular ns2 ?
    • Did you upload on the workshop and then create a local server ?

    Ideally detailling how you test your mod in order to tell if it's working or not.

    Why use a shortcut if you can simply click "launch game" in the launchpad ;) ?

    @TooMuchFun

    Rio is using the game_setup.xml in his/her tut but I'm not seeing it in your mods folder.

    Maybe have a look at this tut which is a bit more up to date than Rio's one: http://unknownworlds.com/ns2/time-to-make-the-mods/

    Also i recommend to investigate a bit into the entry system to avoid having to use the game_setup.xml. Because each file can be only "over-mounted" by one mod.
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    @Katzen:

    1. Tried that. Didn't work.
    2. Nope. I'm smarter than that ;)
    3. Never heard of that. Must I?

    The mod is just a basic "Hello world" which prints to the console.

    For the record thats my lua scripts folder I took a screenshot of. Above that is the mod directory, which does contain the game_setup.xml file I modified to load the SchizoMod files.
  • KatzenfleischKatzenfleisch Join Date: 2014-03-21 Member: 194881Members, Squad Five Blue, Squad Five Silver, NS2 Community Developer
    edited June 2015
    Must be correctly loaded then. Can you try to load the mod in attachment ? it's a simple mod (not a full game mod) using the entry system instead of the game_setup.xml.

    This mod can't be more simple, it has a single "usefull" file name "ping_file.lua" which write the current date and time to a log file in "%appdata%/Natural Selection 2/server_modding_ping.txt" each second, it's server VM side code. You can just add a 'Print("Hello word")" on the lua to test more. Tell me if it works correctly, if not you must have an issue on how you load the mod and we can debug you further.

    @GhoulofGSG9: good to know
    @TooMuchFun: Uploading to the workshop and creating a server (first go to "mods", activate your mod on the list, then "server browser" -> start server).

    While it's an "overkill" way to be totally sure your mod is correctly loaded, it would take too much time if you need to edit/test your code frequently so better fix this.

    Edit: a reupload the mod with the "publish_id" line of the mods.settings removed, so it will create a new mod instead of giving you an error for not having access to it.
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    I am really not comfortable downloading that. Is there another way?
  • KatzenfleischKatzenfleisch Join Date: 2014-03-21 Member: 194881Members, Squad Five Blue, Squad Five Silver, NS2 Community Developer
    If you do not trust this simply look at the code. There are here less than 15 lines of code that you can check by your self, and if you do not trust this code anyway feel free to comment and replace all of that with a Print("Hello world") :)

    Otherwise you can try to use the launchpad and upload it on steam workshop. You will know if it's an issue on the code or on how you load it.
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    edited June 2015
    That last suggestion, adding it to the steam workshop was brilliant. I got it actually loading the mod now. The only problem is that its not finding my lua files. Why is that? I saw something else on these boards about that same problem. The lua files are in both my source and output folders and I did use Builder to place them there.

    Edit:

    These are my errors:

    u5pfrnx5mze2.png



    This is SchizoModShared.lua's contents:
    Print('HELLO UNKNOWN WORLD!!!');
    

    SchizoModServer.lua:
    Script.Load("lua/LoadModFiles.lua");
    

    SchizoModClient.lua:
    Script.Load("lua/LoadModFiles.lua");
    
    SchizoModPredict.lua:
    Script.Load("lua/LoadModFiles.lua");
    
  • KatzenfleischKatzenfleisch Join Date: 2014-03-21 Member: 194881Members, Squad Five Blue, Squad Five Silver, NS2 Community Developer
    edited June 2015
    Good point if it works. Do not bother using the builder or the source directory, work in the output directly. I also got issues with this (builder wont copy some files for some reasons). This might solve your problem with the missing file.

    Edit: if you have published your mod, can you give us the id (so we can check on the workshop and test it ?). Nevermind it's on the log: m1b78b0c9
    Edit2: The error is here
    k5pxotsbb5a3.png
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    My username on Steam is TheSchizoGamer (go figure), and the mod is called "Mod1". I've got to jet off to work, I'll get back to you; until then I hope that's enough info.
  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited June 2015
    Good point if it works. Do not bother using the builder or the source directory, work in the output directly. I also got issues with this (builder wont copy some files for some reasons). This might solve your problem with the missing file.

    Edit: if you have published your mod, can you give us the id (so we can check on the workshop and test it ?). Nevermind it's on the log: m1b78b0c9
    Edit2: The error is here
    k5pxotsbb5a3.png

    Those issues with builder might be caused by your IDE locking access to the source files.
    TooMuchFun wrote: »
    My username on Steam is TheSchizoGamer (go figure), and the mod is called "Mod1". I've got to jet off to work, I'll get back to you; until then I hope that's enough info.

    You should notice that your mod won't really run the game as you don't link back to the original files in any way.

    @Katzenfleisch

    Have a look at the entry folder readme file! Your example mod does some "weird things":
    Like linking back to the vm entry files or not just using the Shared entry point. The entry system is post-loaded by those vm entry files ;)
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    I'm confused. What do you mean by shared entry n' stuff?
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    Could this all be because I have the entire mod in My Documents? I had some simple debugging print mod working last year but I haven't done anything with it since. In fact those files got lost on my last reformat. I do believe some guide said once to place the mod in to the NS2 directory...
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    edited June 2015
    as a note, its the first error thats most important. It says invalid escape sequence, which is causing it to error out during the loading of the file, which is why its throwing the file not found.

    I would use quotes in your Print statement instead of apostrophes. You also don't need the semi's in lua.

    Using the game_setup.xml as your loading point isnt the best path if you are making a simple mod, but thats not a huge deal in the beginning. If you want an example of a simple mod using the entry system, you can look at this small mod I made to tweak ragdolls - https://github.com/xToken/Ragdoll
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    I know what the first error means though. I changed the semi-quotes to full quotes, in fact that is what they were in the first place. Whats odd is without regards to what I do it to fix it the same errors appear. I thought maybe the file not found errors were because the LoadModFiles.lua file wasn't referring to the folder it was within. I removed the "lua/" in the path and the same errors appeared when I ran the game, as if nothing had changed.

    Its like the publish feature isn't doing anything...
  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited June 2015
    TooMuchFun wrote: »
    I know what the first error means though. I changed the semi-quotes to full quotes, in fact that is what they were in the first place. Whats odd is without regards to what I do it to fix it the same errors appear. I thought maybe the file not found errors were because the LoadModFiles.lua file wasn't referring to the folder it was within. I removed the "lua/" in the path and the same errors appeared when I ran the game, as if nothing had changed.

    Its like the publish feature isn't doing anything...

    Hmn, i guess posting the fixed version of your mod here might help you most.

    Just create a new mod with the Launchpad and extract the attached zip into the output folder. Then start the game via the "Launch game" shortcut of Launchpad.
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    edited June 2015
    This is the current iteration of my mod. I guess I'll try out what you've posted.

    [edit] I did what you said except I published it before starting the game. The results are almost exactly identical though:

    5t4bfh8b4d35.png
  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited June 2015
    TooMuchFun wrote: »
    This is the current iteration of my mod. I guess I'll try out what you've posted.

    [edit] I did what you said except I published it before starting the game. The results are almost exactly identical though:

    5t4bfh8b4d35.png

    I have to ask you what kind of Editor or IDE you use, because your files cause errors for me too unless i re-save them once with something like notepad++.

    Also change
    Script.Load("LoadModFiles.lua")
    
    to
    Script.Load("lua/LoadModFiles.lua")
    
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    edited June 2015
    Its gotta be the IDE. I began using SCITE but switched to decoda.

    [EDIT/UPDATE] This is just so stupid. Why shouldn't DECODA work with the game for gods sake? I just DLed Java and Eclipse for Lua. Still not working. I disabled my AV for ten minutes too, and it still isn't working.

    I also noticed when I start the game the console complains about my mod not having a valid description. This happens even after I give it one on the steam workshop and in the launchpad.

    [EDIT] So I changed the description to some BS and gave it a name in both LaunchPad and on the steam workshop. It seems it isn't complaining about missing files and invalid character escapes anymore. The only problem? Its not printing the text "HELLO UNKNOWN WORLDS!!!". I'm gonna try what the tutorials say: "Shared.Message("Text message to display")
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    Still nothing. No errors though, so I guess that's good??? The map load screen shows my mod being loaded too. How would you guys print something to the console, or better yet print it to the game chat or an in-game display?
  • GhoulofGSG9GhoulofGSG9 Join Date: 2013-03-31 Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
    edited June 2015
    TooMuchFun wrote: »
    Still nothing. No errors though, so I guess that's good??? The map load screen shows my mod being loaded too. How would you guys print something to the console, or better yet print it to the game chat or an in-game display?

    I really have no clue what you are doing wrong, this is the output i get when i launch the game with the test mod i posted before as attached file:
    [ 0.031] Unbound/Unknown : Filesystem initialized, cache enabled
    Build 274
    Windows 8 64-bit (build 9200)
    Game path set to '--snip--/NS2Mods/TEST/output'
    [ 0.241] Unbound/Unknown : Error: PhysX: Invalid Cuda context!
    Steam initialized
    Num displays: 2
    Direct3D 9 initialized: AMD Radeon HD 5800 Series (8.17.10.1333)
    Sound Device: Lautsprecher (Realtek High Definition Audio) 7.1
    Record Device: Mikrofon (HD Webcam C310)
    Loading config://ConsoleBindings.json
    Loading config://FavoriteServers.json
    Loading config://HistoryServers.json
    Main Menu Initialized at Version: 275
    Steam Id: 49071975
    Server tickrate 30, client sendrate 20, bandwidth limit per player 25600
    Connected to Steam servers
    Connecting to server 127.0.0.1:27015
    Client connecting (127.0.0.1)
    VAC Enabled
    Loading config://ServerConfig.json
    Loading config://ReservedSlotsConfig.json
    Loading config://ServerAdmin.json
    Loading config://BannedPlayers.json
    Loading config://MapCycle.json
    Loading config://ConsistencyConfig.json
    Consistency checking took 0 seconds
    Server : 0.000000 : INFO: LuaJIT setup: maxtrace=20,000, maxmcode=35,000
    HELLO UNKNOWN WORLD!!!
    [ 57.579] Worker 02 : Loading 'maps/ns2_summit.level'
    Building pathing mesh for level maps/ns2_summit.level
    Finished loading 'maps/ns2_summit.level'
    Loading config://ConsoleBindings.json
    Loading config://FavoriteServers.json
    Loading config://HistoryServers.json
    HELLO UNKNOWN WORLD!!!
    HELLO UNKNOWN WORLD!!!
    [ 88.457] Worker 14 : Loading 'maps/ns2_summit.level'
    Building pathing mesh for level maps/ns2_summit.level
    Finished loading 'maps/ns2_summit.level'
    Client : 0.000000 : INFO: LuaJIT setup: maxtrace=17,000, maxmcode=32,000
    Loading took 40.983810679597 seconds
    Client connected (127.0.0.1)
    Client Authed. Steam ID: 49071975
    Ghoul connected.
  • TooMuchFunTooMuchFun NunyaBiznizz Join Date: 2014-04-28 Member: 195653Members
    Oh my garsh I just got it working. I added the game_setup.xml file and it worked! Perhaps I should have been more careful, I tend to get excited and rush through things :P.

    xuy89d10sw8v.png
Sign In or Register to comment.