• Making a loadout?
    22 replies, posted
I'm making a simple gamemode but i was wondering how i would do a loadout. My idea was: Have 3 variables; pgun sgun special For the gui, clicking the button would set each variable to the gun e.g If i click the AK47 Button then pgun = "ak47" when they choose both guns and their special it would run a function that would execute Give(wepname) I would have an if statement for the guns. if pgun == "ak47" then gun1 = "fas2_ak47" I don't know if this even makes sense to you, and im sure there is a more efficient way to do this. Any suggestions?
hook.Add into PlayerLoadout Player is the first argument, check :Team( ), or whatever; then :Give( "fas2_ak47" ) or whatever for each loadout. I'd recommend doing a direct access sort of thing. Here's some code I wrote for a gun-game / gun-race style game-mode as a tutorial: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_gamemode_logic/gun_race/upgrade_weapons_for_kills.lua.html[/url] And a TTT style of system for giving out weapons based on groups and other info - two examples done on the begin-round segment, it'd go into PlayerLoadout for yours unless it is TTT: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_gamemode_logic/give_weapons_based_on_group.lua.html[/url] Now, for VGUI where you have a menu open and you select a load-out, it is simply a DButton or DImageButton where you override the .DoClick function, and send a net-message to the server telling the server which loadout you want. The server in a net.Receive would then dispense the same way the other scripts are used. Here's an MOTD to show how the DoClick stuff is done: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/motd.lua.html[/url] And a networking tutorial: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/networking/networking_booleans.lua.html[/url] For yours you may want to set up ENUMERATIONS, basically SHARED CONSTant values like LOADOUT_1 = 1, LOADOUT_2 = 2, LOADOUT_3 = 99, etc... and just WriteInt or to make it easier without counting bytes, WriteLong or Float or Double - forget which ones exist... On the other end, local _value = net.ReadXXX() and if _value == LOADOUT_1 then... elseif == LOADOUT_2 then .... elseif == _3 then .... else end....
Everytime you comment on my posts i just feel dumber and dumber ;) I will try and get something working over the next day or two. In the mean time i guess im learning the net library xD Thanks for the help.
[QUOTE=AIX-Who;44758119]Everytime you comment on my posts i just feel dumber and dumber ;) I will try and get something working over the next day or two. In the mean time i guess im learning the net library xD Thanks for the help.[/QUOTE] [url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url] This is a good tutorial
[QUOTE=AnonTakesOver;44758130][url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url] This is a good tutorial[/QUOTE] +1 I'm going to start referencing wiki entries in all of the files I put out; any available tutorials on the subjects covered, in addition to links to all of the functions used.
What server are you making this for? [editline]9th May 2014[/editline] Because my server has the exact same kind of variables and concept of a loadout with a dmodel menu.
[QUOTE=Pie's;44765197]What server are you making this for? [editline]9th May 2014[/editline] Because my server has the exact same kind of variables and concept of a loadout with a dmodel menu.[/QUOTE] Can you please stop mentioning your server on everything your post. Its worse than Acecool. We don't give a shit if you own a server with a Battlefield gamemode which is just guns + models with a little HUD and stuff. PS if you make a gamemode (which you didn't a friend made it for you) you should call it Call of Duty as the gamemode you're running is a run and gun not teamwork based like Battlefield.
Im not going to release some half assed shit BF4 TDM. I will have a fully functional game type system etc in place for when it is done. Most of the other servers are using darkrp. Also Pie: Im sure everyone has a similar concept. [T]http://images.eurogamer.net/2013/usgamer/Field-Upgrades-Screen.JPG[/T] Going for a menu style life this.
Pie has a server with a half assed BF4 TDM. If you make a ingame BF4 menu it would be awesome. A little unorginial but awesome
Im not replicating, but i am taking a large amount of gameplay mechanics from it ;P
[QUOTE=SarahKerrigan;44767390]Pie has a server with a half assed BF4 TDM. If you make a ingame BF4 menu it would be awesome. A little unorginial but awesome[/QUOTE] Considering my mode is in Early stages, have fun making your loadout look like that!
Also the gamemode which pie has is in ealry alpha. So its not released. And if you ask how making a loadout, i dont think that you are able to do that.
There server is not using DarkRP either. I assume since you are asking for help, you cannot code the load-out you showed. You should try and create your own ideas, not just try and make a new version of an existing gamemode.
What are youse on about? He could code that menu if he wanted, if he knows how to code and is a good designer, he could create something very identical to that, GMod is amazing in the way that you can code pretty much anything (if you don't run into one of the Source Engines' "features"). Don't want to be mean to the OP, but I don't think [U]he[/U] could do it, does not mean it isn't possible. Garry's Mod does not use the term Sandbox lightly
[IMG]http://puu.sh/8GXya2.jpg[/IMG] Just the aesthetics so far. Got the net messaging working and all that, will just need to do tables and what not.
[QUOTE=AIX-Who;44773943][IMG]http://puu.sh/8GXya2.jpg[/IMG] Just the aesthetics so far. Got the net messaging working and all that, will just need to do tables and what not.[/QUOTE] Image not working?
Sorry, here it is [IMG]http://puu.sh/8H9er.jpg[/IMG] Any improvements?
Does it work?
[QUOTE=AIX-Who;44775278]Sorry, here it is [IMG]http://puu.sh/8H9er.jpg[/IMG] Any improvements?[/QUOTE] Change background and fix that save button, it looks out of place.
[QUOTE=Pie's;44770582]Considering my mode is in Early stages, have fun making your loadout look like that![/QUOTE] oh yours is based off DarkRP soo. Anyway I was talking to AIX about the menu not you. Also really sad you called your friends to rate me dumb and post things about your DarkRP edit
Mine is not based off darkrp? It hasent been for a long time.... Also i didn't call anyone??
SarahKerrigan, please dont talk about things you dont know, ok? I made the gamemode for Pie. And its not a DarkRP edit. It was before i was doing that for him, so... Thanks! #Rated as Dump!
You're clearly calling people to rate me as everybody that have rated me dumb if people that posts about "your" mod. You earlier said it was based off DarkRP and therefore I can only think that its still. Anyway back to the topic. I would say the menu needs to be full screen if a picture like that should fit in.
Sorry, you need to Log In to post a reply to this thread.