Passively playing music on weapondrop via hook

ShnagenburgShnagenburg Join Date: 2005-07-04 Member: 55235Members
Hey guys, I'm trying to get my bearings with a simple mod: play the game music on a weapon drop. The logic in lua is simple enough, and I've read the starter tutorials but I don't really understand the process. Here's the "slew o' questions":

In the launchpad mod creation dialogue, the drop-down box offers Game and Gameplay types of mods. What exactly are the implications of these? My change is a small gameplay feature, not a new game type. Is gameplay the appropriate choice?

I see that in the tutorials, they appear to be in "Game" mode with their own game_setup.xml that overwrites the default mode... I'm pretty sure this isn't what I want, it sounds like it wouldn't be compatible with mods that have their own game_setup.xml. Is this file necessary? I need the game to load my additions somehow obviously, does the game only load one game_setup.xml? Or is it once per mod?

Speaking of not overriding things, I only need to extend functionality, not override it. The drop function is in Marine.lua (Drop()). Should I be hooking into via my own Marine.lua, or is the appropriate style to create a new file "DropMod.lua", and hook the function from there? Again, not really sure where "DropMod.lua" would be loaded from (unless it has to be game_setup.xml)

Client.playMusic(); is easy enough, but after a quick search in decoda, I don't see the function declaration, so I'm not really sure if this function can handle mp3s, or if it needs to be in fsv or whatever form. This comes later though, first I just want the music to play.

Any help is greatly appreciated, thanks.

Comments

  • McGlaspieMcGlaspie www.team156.com Join Date: 2010-07-26 Member: 73044Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester
    As far as generalized, "Where to start" type questions @Rio has written the most overall thread about it so far:
    http://forums.unknownworlds.com/discussion/128106/how-to-make-a-mod-for-natural-selection-2#latest

    As far as extending functionality goes, take a look at Sewlek's Simple Mod Framework. It will likely cover this kind of thing for you.

    Regarding the question about "Client.playMusic()" type functions, those are provided as stubs to C code (afaik) or could be considered Built-ins. There are a large number of these, such as Client.CreateRenderCamera(). Sadly, there isn't a convenient API reference for these built-in method calls. Basically, just do a search for them in the code to see how they're used.
    Tip: SHIFT+CTRL+F is your best friend!
Sign In or Register to comment.