• NutScript 1.1 - A free role-play framework
    239 replies, posted
[QUOTE=Chessnut;48020711]In your schema's items folder, go to the pacoutfit folder (if it does not exist, just make it), then make a new file like sh_medicoutfit.lua Inside you have the usual ITEM.name, ITEM.model, ITEM.desc, etc... and then you add: [lua] ITEM.replacements = {"group01", "group03"} [/lua] So it switches the group from group01 to group03 just like you wanted.[/QUOTE] Brilliant. How would I go about using it if the two different groups are in different folders? (Not in the models/humans, but two different? [B]Edit[/B] Found it, just place the pathway. [B]Edit[/B] A second thing, I have items that set the player's bodygroups, however, when unequipped, the bodygroup still remains unchanged.
Hey, I'm looking for a way to set the default health for all players, I can't seem to find it anywhere in any files; This leads me to believe its not set in Nutscript? Should I just go ahead and add it in myself or and I actually being an idiot and it is actually settable somewhere?
[QUOTE=Chessnut;48020711]In your schema's items folder, go to the pacoutfit folder (if it does not exist, just make it), then make a new file like sh_medicoutfit.lua Inside you have the usual ITEM.name, ITEM.model, ITEM.desc, etc... and then you add: [lua] ITEM.replacements = {"group01", "group03"} [/lua] So it switches the group from group01 to group03 just like you wanted.[/QUOTE] On this note, is there any way to differentiate from male and female? Example, if I have two models, one called airex_male and one airex_female, is there any way to make it so a user with male in the model name will get the male option, and vice versa?
[QUOTE=Shadico;48029363]On this note, is there any way to differentiate from male and female? Example, if I have two models, one called airex_male and one airex_female, is there any way to make it so a user with male in the model name will get the male option, and vice versa?[/QUOTE] [CODE]ITEM.replacements = { {"male", "female"}, {"models/humans/airexmale.mdl", "models/humans/airexfemale.mdl"} }[/CODE]
[QUOTE=MessiahDEG;48031922][CODE]ITEM.replacements = { {"male", "female"}, {"models/humans/airexmale.mdl", "models/humans/airexfemale.mdl"} }[/CODE][/QUOTE] This didn't actually work and just made my model the corresponding female model for me. I'm trying to get the old Notiboard plugin from NS 1.0 that Black Tea made to work with NS 1.1. A common problem I'm running into are the functions "SetNetVar" "GetNetVar" etc. Is there any corresponding function that NS 1.1 has that I could replace these functions with?
[QUOTE=Shadico;48032321]This didn't actually work and just made my model the corresponding female model for me. I'm trying to get the old Notiboard plugin from NS 1.0 that Black Tea made to work with NS 1.1. A common problem I'm running into are the functions "SetNetVar" "GetNetVar" etc. Is there any corresponding function that NS 1.1 has that I could replace these functions with?[/QUOTE] Also, is there anything similar to this in NS 1.1? -- How many attribute points a player gets when creating a character. nut.config.startingPoints = 33 I'm trying to make SPECIAL-like stats for my fallout RP. I've set the max number for each of the skills to 10, but it not only sets that as the full amount for the attribute itself, but also the amount of attribute points you can distribute.
Messiah, it should be in the configuration panel. SetNetVar and GetNetVar become setNetVar and getNetVar.
[QUOTE=Chessnut;48032617]Messiah, it should be in the configuration panel. SetNetVar and GetNetVar become setNetVar and getNetVar.[/QUOTE] Nope, only 'Max Attribs' apprear on the config, nothing which sets the default amount of points the player has to distribute. (I think that the Max Attribs set both the maximum amount of points an attribute can have, as well as how many the player has to distribute.
Max attribs only sets the amount of points available during character creation. The number of attribute points you can have is unlimited.
[QUOTE=Chessnut;48037039]Max attribs only sets the amount of points available during character creation. The number of attribute points you can have is unlimited.[/QUOTE] No, no. I meant the number of points that you have available to distribute on the character creation menu.
That's what I just said
[QUOTE=Chessnut;48037220]That's what I just said[/QUOTE] Ah, is there a way to restrict the total amount you can have? I'm trying to get a Fallout SPECIAL system working where there are 33 points available to distribute, but the maximum amount of points you can have per category are 10.
[QUOTE=Shadico;48032321]This didn't actually work and just made my model the corresponding female model for me. [/QUOTE] Any solutions to this, or am I stuck having seperate items for male and female for now?
Then don't match the portion with the gender in the model? [QUOTE=MessiahDEG;48037575]Ah, is there a way to restrict the total amount you can have? I'm trying to get a Fallout SPECIAL system working where there are 33 points available to distribute, but the maximum amount of points you can have per category are 10.[/QUOTE] Should I add a ATTRIBUTE.limit or some sort of config to limit all attributes?
the pac plugin doesn't seem to attach items anymore when a player reconnects, and it still doesn't attach to ragdolls.
Do you have pac installed?
[QUOTE=Chessnut;48037659]Then don't match the portion with the gender in the model? Should I add a ATTRIBUTE.limit or some sort of config to limit all attributes?[/QUOTE] Definitely, would help a great deal. Also, there seems to be a problem with bodygroup clothing items. It seems that when removed they maintain their bodygroup. Perhaps not resetting properly. [B]Edit[/B] Perhaps something within the creation of the attribute? Then individual attributes could have their own limits.
[QUOTE=Chessnut;48037720]Do you have pac installed?[/QUOTE] I have BlackTea's pac light installed on my serverbox, and I have just Pac3 installed in my gmod for local hosting; both don't work
Not sure then. I can't test anything and I've only been coding stuff on my phone hoping I don't make typos. Also, I didn't make the PAC code so I'm not sure how it all works.
Another stupid question that should hopefully be more straightforward. I've been trying to make a plugin that only opens Combine doors if the player has a certain item. I scrapped this together. No errors are printing in console, but the doors don't open when I have the item in my inventory, either. Any pointers as to what I'm doing wrong with my code? [code]PLUGIN.name = "Nexus ID Cards" PLUGIN.author = "Tazmily" PLUGIN.desc = "ID Cards that allow you to open Nexus doors." function SCHEMA:PlayerUseNexusDoor(client, entity) if (character and character:getInv() and !character:getInv():hasItem("nexuskey")) and (!entity:HasSpawnFlags(256) and !entity:HasSpawnFlags(1024)) then entity:Fire("open", "", 0) end end [/code]
PlayerUseNexusDoor isn't a valid hook? It's just PlayerUseDoor [editline]24th June 2015[/editline] Also you need to add local character = client:getChar() [editline]24th June 2015[/editline] Also [B][U]![/U][/B]character:getInv():hasItem("nexuskey") means the door opens when they do not have the key.
Oh shit I thought it was just as easy as adding hooks. I'm dumb. Couple more questions while I check that out: Is there a particular file I can use to add c_models for player models? For example, if I wanted a certain model to use the black citizen hands and not the white ones, where would I go to do that? Secondly, is there a way to make an item that when used just makes the effects of an entity apply instantly? eg. If I wanted to add a Durgzmod entity, for example, and I wanted to make the drug be taken instantly upon the item being used. I'm sorry about all the questions - this is my first large-scale project with NS and I don't really know what I'm doing.
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/modules/player_manager.lua#L115[/url] As for the durgzmod you can probably do something like: [lua] ITEM.functions.Use = { onRun = function(item) local drug = ents.Create("durgz_blah") drug:SetPos(item.player:GetPos()) drug:Spawn() drug:Use(item.player, item.player) end } [/lua]
Regarding the hands, do I just edit that file in my Gmod lua folder? Would I paste the entire filename, eg. models/humans/group01/male_20.mdl?
Add the two lines to sh_schema or something. And just follow how Garry did it. All you need to do is match the model strings correctly.
[QUOTE=Chessnut;48039991]Add the two lines to sh_schema or something. And just follow how Garry did it. All you need to do is match the model strings correctly.[/QUOTE] I've added the two lines to the sh_schema but it just returned a lua error. I tried copying the entire file (except the list) into sh_schema and was faced with no errors, but the hands on the model I added are still the default citizen ones. I'm probably doing something very wrong here and I'm just too tired to miss it - any suggestions besides modifying the lua file itself? (Which doesn't seem like too great an idea.)
[lua] player_manager.AddValidModel("badico", "models/badico/male01.mdl") player_manager.AddValidHands("badico", "models/weapons/c_arms_citizen.mdl", 1, "0000000") [/lua] Add to sh_schema at the bottom or somewhere. Replace the model what your model of course.
Okay, the hands models work now, thank you. Now time to assign a c_hand to every single playermodel. Also, while the durgz spawned the entity, it didn't quite use it - just spawned it atop my head. It also didn't take the item from my inventory. This error was printed in console: [code][ERROR] gamemodes/hl2rp/schema/items/drug/sh_weed.lua:20: bad argument #4 to 'Use' (number expected, got no value) 1. Use - [C]:-1 2. onRun - gamemodes/hl2rp/schema/items/drug/sh_weed.lua:20 3. unknown - gamemodes/nutscript/gamemode/core/libs/sh_item.lua:652 4. func - gamemodes/nutscript/gamemode/core/libs/external/sh_netstream2.lua:117 5. unknown - lua/includes/extensions/net.lua:32 [/code] The code seems pretty okay from what I understand - I copied pretty much exactly what you said, minus the entity name.
Is there a Lua error in the server console?
Added it in an edit.
Sorry, you need to Log In to post a reply to this thread.