• Itemforge - An items system for Garry's Mod
    335 replies, posted
Itemforge Items: Could not create item, "item_dollar" is not a valid item-type. Check for item scripts not being sent! I don't think the item scripts are being sent to other people..
[QUOTE=Kill coDer;15572708]Itemforge Items: Could not create item, "item_dollar" is not a valid item-type. Check for item scripts not being sent! I don't think the item scripts are being sent to other people..[/QUOTE] Make sure that you are doing AddCSLuaFile. If your item just has a shared.lua, put this at the top of your shared.lua: [lua] if SERVER then AddCSLuaFile("shared.lua") end [/lua]
I think you should add it automatically, it should not be hard to do and it will prevent a lot of problems.
[QUOTE=kevkev;15576535]I think you should add it automatically, it should not be hard to do and it will prevent a lot of problems.[/QUOTE] I used to do that but I took it out because I figured the closer it was to Garry's Mod SENTs/SWEPs the less confusion there would be. Edit: Additionally, that would only auto-include shared and cl_init; you'd still have to AddCSLuaFile any other scripts you wanted to send to the client. Edit: [b]Status Update[/b]: The Split menu option works now. The one exception is that it's possible to select "0" items for either stack which is impossible to split. The dialog is loosely based off of the Derma_Message() windows. Specifically, getting the slider to work the way I wanted it to outside of DNumSlider was a pain in the ass, and so was positioning/sizing the elements correctly. In any case, here's some screenshots for you: Splitting a stack in two, 75/25: [img]http://img195.imageshack.us/img195/7331/split1.png[/img] Afterwords: [img]http://img196.imageshack.us/img196/7901/split2.png[/img] I have removed the PRIMARY ATTACK/SECONDARY ATTACK debug spam from the console for a little while. The base lock and password lock were making menu entries before the header. This has been fixed. I'm going to make the header a part of the initial menu generation rather than part of the "Populate Menu" event, but until then this is an adequate solution. When calling :CanPlayerInteract(pl) clientside, it will check to make sure pl is the LocalPlayer() (so for example if the Client is controlling Player 1, only Player 1 can use an item on that client). Comments on some files have been changed slightly. The Menu Header is now in it's own file rather than being created on the fly in the menu code. Beta SVN updated.
This mod is incredible. I'm no scripter but i'm interested because I was going to suggest this to a friend of mine that runs a server How do you script a pre-made custom weapon to work with item forge? Do you have to add a few lines or do you have to rescript the whole thing?
[QUOTE=Ryo Ohki;15591725]This mod is incredible. I'm no scripter but i'm interested because I was going to suggest this to a friend of mine that runs a server How do you script a pre-made custom weapon to work with item forge? Do you have to add a few lines or do you have to rescript the whole thing?[/QUOTE] You will have to remake the whole thing, however it wont be that hard since you can copy and paste a lot.
Maybe not even that; I'm thinking I could pull code from the SWEPs into the items automatically, like I did with the SWEP Turrets.
Awesome! Also what about a "personal inventory", or pocket, accessible by using a console command (or a bind)?
I'm having a lot of fun messing with this. I've been working on a gear base this afternoon, finding my way around your network functions and stuff. I gotta say, I'm really enjoying it! The default gear base is just a melon "hat" for players to wear: [img]http://i286.photobucket.com/albums/ll89/RabbitTurd/gm_construct0000.jpg[/img] As a test, I decided to try making the TF2 party hat, derived from the base: [img]http://i286.photobucket.com/albums/ll89/RabbitTurd/gm_construct0001.jpg[/img] To wear it, players simply hit use on it. Also works in inventories. I still need to add a way to take off gear though. Also I really ought to implement a system whereby you can add specific offsets for specific player models. [editline]Edited:[/editline] By the way, would it be possible for you to add an itemforge_reload command or something, to reload the items? [editline]Edited:[/editline] [img]http://i286.photobucket.com/albums/ll89/RabbitTurd/gm_construct0002.jpg[/img] The position sucks but hey :v:
Just a question, is there any easy way to drop an item you are carrying?
I have to say, this is impressive in all senses of the word. Bumped to promote awesomeness, because this mod should NEVER die, can't wait to try this out :D.
[QUOTE=Ryo Ohki;15598731]Awesome! Also what about a "personal inventory", or pocket, accessible by using a console command (or a bind)?[/QUOTE] Somebody just has to script it. As I've explained before, my system doesn't do that by default. [QUOTE=Darkling;15617706]Just a question, is there any easy way to drop an item you are carrying?[/QUOTE] Yes, look for an icon in the upper-left hand corner while you have the item out. If you don't see it you'll need to swap to a different weapon and back (bug that needs to be fixed). Hold "c" then drag the item to where you want to drop it. [b]Status Update[/b]: There is a new item, item_sawblade. Unfortunately it doesn't slice zombies in half, but on the upside it can stick into the world, props and ragdolls. It doesn't have to be thrown with the gravity gun, either. As long as the sawblades are going fast enough they will stick into whatever they hit. Sawblades can be climbed upon once they stick. If the sawblades stick into props, you can pull them loose with enough force, or you can press "E" on the sawblade to pull it out of whatever it's stuck to. Unfortunately the sawblades cannot be thrown yet; whenever I get around to making a base_thrown weapon type, the sawblade will be throwable. Unlike most items, the sawblade has a custom viewmodel that was taken from the Sawblade Thrower SWEP for Garry's Mod 9. According to the credits in the SWEP, NeoDement made the viewmodel, so props go to him for this. Now by default, props cannot leave the world while they are constrained in some way (so you can't pick up items that are welded/roped to things). Now, if an item is being held by a player, only that player can interact with it. It was possible for other players to interact with an item another player was holding before. Before, you could load ammo into the weapon you were holding by pressing [Use]ing it (or vice versa - load the ammo you were holding into the weapon by using it). Now, in addition to this, right clicking the ammo gives you the option to load it into the weapon you're holding, and vice versa. The option to load the ammo will only appear if that weapon takes that kind of ammo. When holding an item, it now appears on Slot 1 instead of Slot 6. When right clicking a stack of items, you will now see the amount in the header (ex: Shotgun Shell x 10). Inventory Merge is working again. If you're sending a stack of items to an inventory, and that inventory already has a stack of that kind of items, it will try to merge as many items as possible. Partial Inventory Split is working again. If an inventory has a weight limit, and you're moving a stack of items to it and not all of the items can fit, it will split off as many items as possible. The base item has had it's many functions split into seperate files. Each file represents a different aspect of items, such as amount, weight, health, etc. Functions to create and manage Looping Sounds on items have been created. The shotgun reload loop is working but unpolished. There may be some unresolved issues with this. I have improved but not fixed the issue with weapon cooldowns. The weapons are much more responsive now than they were before. Improving the weapon cooldowns meant adding the "Predicted" flag to Networked Vars. Predicted Network Vars will be sent whenever the server ticks, as opposed to being sent ASAP like normal network vars. I have also added another flag to Networked Vars: "HoldFromUpdate", which indicates you don't want the network var sent to a joining player. This is useful for variables that need to be networked but aren't that important for joining players to know (like "Next Primary Attack"). The weapons have been changed so that more actions are performed both serverside and clientside now. Reloads, for instance, are predicted clientside. I have updated the way the Base Ranged Weapon's FindAmmo() works. FindAmmo used to be serverside but is now shared. Instead of :FindAmmo taking a clip and returning a table of items, :FindAmmo() now takes a function. This function is run on every item found until it returns true (indicating that usable ammo has been found and we don't have to keep looking). This method is much more efficient and flexible. Whenever a weapon (a melee or ranged weapon) is cooling down, a red border will appear around the edges of the item's icon. This border will slowly fade out as the cooldown ends (like in Stranded 2). This is a little bugged for some weapons (like the shotgun). Built in support for viewkicks were added to the base melee weapon, and a view kick was added to the crowbar. This should match the HL2 crowbar's viewkick (by the way, in singleplayer HL2 the crowbar has a viewkick, but in HL2MP or Garry's Mod it doesn't). I forgot to mention this last time, I think, but the Rock-It Launcher now has an "Unload" option on it's right-click menu. This makes the rock-it launcher unload it's items one at a time (they're sent to the same place it is). While unloading, a looping sound plays and a light on the item blinks. Minor changes were made to comments in the Gear Attach module and password lock. Beta SVN updated.
How do you download this? sorry im stupid
I think I'm gonna cry, this addon is magnificent! Truly a work of genius, because I have never seen something so complex be made into an addon short of a whole freakin gamemode. Dr Pepper, go check the OP, instructions on how to download it are at the bottom of the first post.
OK thanks
[QUOTE=theJ89;15701841]Yes, look for an icon in the upper-left hand corner while you have the item out. If you don't see it you'll need to swap to a different weapon and back (bug that needs to be fixed). Hold "c" then drag the item to where you want to drop it.[/QUOTE] There never is an icon. I tried switching weapons many times, and it never shows up. Possibly a conflicting addon?
[QUOTE=Darkling;15712848]There never is an icon. I tried switching weapons many times, and it never shows up. Possibly a conflictiong addon?[/QUOTE] Hmm, you're not the first person to report this. I'm going to look into this and see if I can figure out what's going on. Edit: [b]Status Update[/b]: I haven't yet figured out what is stopping the item from appearing. Weapon Cooldown issues have been greatly improved, although not entirely fixed; Predicted Network Vars are sent on Serverside Ticks and set on Clientside Ticks. This strategy has greatly improved prediction problems with weapons although they are still present; I'm still working on this. I fixed an issue with the "Number Of Shots" counter for the HL2 Pistol (H&K USP Match) animation. It used to be possible for a player to reload a ranged weapon when that player couldn't interact with the weapon. This has been fixed. The Rock-It launcher was not dry-firing when out of ammo or playing reload sounds. This has been fixed. Well, sort of; reload sounds may play clientside even if the ammo can't be loaded. This is because at the moment, there is no way to determine if an item can be inserted into an inventory clientside, but I do my best here. An optional "No Merge" argument has been added to the ToSameLocationAs() function. You can use this if you don't want an inventory merge to happen if extItem is in an inventory. ToSameLocationAs() was generating errors if an inventory merge occured. This has been fixed. If items were split in an inventory, they would automatically re-merge with themselves. This has been fixed. Items can have their amount set to 0 clientside now (for prediction purposes). Beta SVN Updated. Edit: [b]Status Update[/b]: Fairly major update: Up to 32 items can held (as weapons in the weapon menu) at a time now. Gamemode coders can use IF.Items:SetMaxHeld(amt) to set the max number of items that can be held by players at a time (0 to disallow any items from being held, 1 to only allow one item to be held at a time like before, or at most 32). Screenshot: [img]http://img151.imageshack.us/img151/2021/manyheld.png[/img] A couple of new things with FindAmmo. If a player is holding a ranged weapon that needs to be reloaded, it will try to load the ammo the player is looking directly at first. If it can't do that, then it searches the player's weapon menu to see if the player is holding any ammo. Finally, if that doesn't work, it searches the area around the player for any usable ammo. Unloading a ranged weapon in an inventory that had the same type of ammo would cause errors if the unloaded ammo merged with the existing ammo; this has been fixed. Some obsolete code was removed from the Base Item's OnUse event. Beta SVN updated.
I absolutely [b]love[/b] the way you did the 32 weapons thing.. Genius! :P
I'm not sure if this has already been posted or not but, if you pick up ammo while a gun is reloading it (I only tried this with the shotgun wired to inputs, and picked the shells up with the physgun) it will crash the game. Also if you welded the ammo to something and you reload the gun the constraint breaks doesn't have to be just welds tried it with rope and other constraints.
[QUOTE=Kill coDer;15721237]I absolutely [b]love[/b] the way you did the 32 weapons thing.. Genius! :P[/QUOTE] Well you know the player can't have two weapons of the same class in his menu... besides, I think less than 10 lines of code in a shared file per weapon is pretty lightweight! [QUOTE=Fr0z3n F14m3;15721507]I'm not sure if this has already been posted or not but, if you pick up ammo while a gun is reloading it (I only tried this with the shotgun wired to inputs, and picked the shells up with the physgun) it will crash the game. Also if you welded the ammo to something and you reload the gun the constraint breaks doesn't have to be just welds tried it with rope and other constraints.[/QUOTE] Thank you for the bug report. The reason the game crashed when you were physgunning shotgun shells was because whenever the shells' amount changes to something beneath 20, it changes the model; apparantly Garry's Mod doesn't like it when you change the model on a physgunned ent. I should probably report this bug to Mantis sometime so garry can fix it. As for the welded ammo being loadable, I hadn't noticed this before. I've started fixing this bug now - if the whole stack of items is loaded and it can't be voided for some reason, it now stops. I'll also make it so (on default) constrained piles of items can't be split or merged. I'm working on a rewrite of how events work right now. I'll post more about these changes at a later time. Hey, speaking of bug fixes/feature requests, [url=http://bugs.garrysmod.com/search.php?project_id=4&reporter_id=134&sticky_issues=on&sortby=last_updated&dir=DESC&hide_status_id=90]could you take a look at these garry[/url]? Specifically these: [url=http://bugs.garrysmod.com/view.php?id=1922]Want ENT:GetKillName(), ENT:GetKillIcon(), SWEP:GetKillIcon() [/url] [url=http://bugs.garrysmod.com/view.php?id=1904]Labels have issues with & sign[/url] [url=http://bugs.garrysmod.com/view.php?id=1870]Noclipping + Player:Give() = failure[/url] [url=http://bugs.garrysmod.com/view.php?id=1869]Need access to Entity:SetLocalAngularVelocity[/url] [url=http://bugs.garrysmod.com/view.php?id=1873]Need access to Player:ViewPunchReset() [/url] [url=http://bugs.garrysmod.com/view.php?id=1919]Want Entity:Set/GetPhysicsAttacker support for SENTs [/url]
[url=http://www.facepunch.com/showthread.php?t=732503][B]I can help you with this[/B][/url] Just PM me or add me on steam. My steam is: bloocobalt
Wasn't there a function added at allowed for things to be drawed on the player entity after the player was drawn? You could use that with the gearattach module to draw the clothing above on the player! You probably know this already though..
There should be a concommand for dropping currently held items, IMO. I'm getting that weird bug where the icon of the item doesn't pop up when you're holding it. I'm sure others would like it to quickly drop an item without bringing up the context menu, too. Also, is there a way to connect an inventory directly to a player? as in, when they spawn in, they can use themselves as a "container", and is there a way to load items that aren't in the items directory?
Now, how am I going to be able to save inventories with this? The items obviously can't just be put in a table then put back, if two items have the same uniqueID there will be problems. I'm thinking just storing all the data in a table to 'recreate' the item. When it comes time to load, just recreate the item. Do you think that will work?
[QUOTE=Kill coDer;15762662]Wasn't there a function added at allowed for things to be drawed on the player entity after the player was drawn? You could use that with the gearattach module to draw the clothing above on the player! You probably know this already though..[/QUOTE] I looked in the wiki but I couldn't find this. I have however found a solution to drawing the gear! Now whenever gear is attached to something, it creates a temporary Scripted Effect that draws the gear. No more :Draw() stuff is necessary. There are two new functions, :Hide() and :Show() that can be used to hide/show the gear; stopping it from drawing. There's also the :Remove() function now which is called to remove the gear. [QUOTE=Ebayle;15763583]There should be a concommand for dropping currently held items, IMO. I'm getting that weird bug where the icon of the item doesn't pop up when you're holding it. I'm sure others would like it to quickly drop an item without bringing up the context menu, too. Also, is there a way to connect an inventory directly to a player? as in, when they spawn in, they can use themselves as a "container", and is there a way to load items that aren't in the items directory?[/QUOTE] This bug seems to be a rendering issue. I'm not entirely sure what is causing this, but I notice that when I swap to the Toolgun, it's HUD hint has a huge chunk missing from the upper-left corner. If I had to guess, this seems to be a depth buffer problem; perhaps temporary entities are drawing to the depth buffer on one part of the screen and drawing to the visible part in another. What I do know is that there are invisible polygons that are appearing on screen that have the effect of clipping whatever is drawn behind them. Yes, you can connect an inventory directly to a player. An inventory can be connected as many entities/items as you want but unfortunately support for connecting inventories to entities has been neglected - in fact inventories in general have been neglected and that is something I intend to fix. I can make an "itemforge_drop" concommand if I really have to, but I didn't because I figured that coders would rather make their own depending on whether or not their gamemode/whatever needs it or not. [QUOTE=Kill coDer;15873803]Now, how am I going to be able to save inventories with this? The items obviously can't just be put in a table then put back, if two items have the same uniqueID there will be problems. I'm thinking just storing all the data in a table to 'recreate' the item. When it comes time to load, just recreate the item. Do you think that will work?[/QUOTE] I am working on a save/load interface. Saving the item means copying everything in the item's table to some other format and tacking on a unique ID to it to identify it in the database. Saving inventories is basically the same process, except for the listings of items IDs would be converted to unique IDs. I have been up to a lot the past few days, the major things I've been changing are the events; there's now an :Event() function that lets me fit an event call on a single line, reports errors properly, has space for a default return, etc. All event calls dealing with items have been replaced with this function. I've also been making it so certain things are predictable: Creating items, splitting and merging stacks, sending them to the world, etc. What I mean by predictable is that you can determine whether or not something will work before you actually do it; this should help fix bugs with weapons. And of course I have been working with gear attachment. I'm in the process of redoing these so they're (hopefully) easier to work with. There have been a few other changes I can't recall at the moment. I have a lot of loose ends to wrap up before the next SVN update, so please be patient.
how do you use this cause i downloaded and there is no command like itemforge_menu or forge_inventory? [editline]04:19PM[/editline] [QUOTE=garry;13338065]This is pretty kewl dude[/QUOTE] hey garry can you plz release fretta plz plz plz
Yes, can someone show us a quick example of how to create an inventory, etc? [editline]09:04PM[/editline] Oh and TheJ89, there's a WAY more efficient way register those 32 sweps. Rather have 32 folders which we all know will increase loading times, you can register them in a for loop like so: [lua]require( "scripted_ents" ) local id, base = 0, { Base="itemforge_item_held_1" } for id=1, 32 do language.Add( "itemforge_item_held_" .. tostring( id ), "Item (held)" ) scripted_ents.Register( base, "itemforge_item_held_" .. tostring( id ), true ) end[/lua]
[QUOTE=thomasfn;15925187]Yes, can someone show us a quick example of how to create an inventory, etc? [editline]09:04PM[/editline] Oh and TheJ89, there's a WAY more efficient way register those 32 sweps. Rather have 32 folders which we all know will increase loading times, you can register them in a for loop like so: [lua]require( "scripted_ents" ) local id, base = 0, { Base="itemforge_item_held_1" } for id=1, 32 do language.Add( "itemforge_item_held_" .. tostring( id ), "Item (held)" ) scripted_ents.Register( base, "itemforge_item_held_" .. tostring( id ), true ) end[/lua][/QUOTE] Cool, thanks for the tip! Are you sure it's scripted_ents though? I'll test it to make sure. Oh, to create an inventory, this should be done serverside: [lua] --Create inventory myInv=IF.Inv:Create(); --Connect it to player 1 myInv:ConnectEntity(player.GetByID(1)); [/lua] Pretty much when anything occurs serverside it will occur clientside too. Inventory (whatever ID) will exist on both the server and client. The only thing connecting it to an entity does is that when the entity gets removed, the inventory gets removed too (this also makes a few other things possible, like when items :GetPos() inside of the inventory, it returns the inventory's connected item/entity's position). The problem is that there's no way of knowing what inventories are connected to a player, yet. I apologize for this utter laziness on my part. One thing you could do until I get this working properly is set a NWInt on the player... [lua]player:SetNWInt("InvID",myInv:GetID());[/lua] Then clientside, whenever the player wants to look at his inventory: [lua] --Check to make sure there is an inventory with this ID local myInv=IF.Inv:Get(player:GetNWInt("InvID")); if !myInv then return false end --Create an inventory panel... local InventoryPanel=vgui.Create("ItemforgeInventory"); --And then display our inventory on it InventoryPanel:SetInventory(myInv); [/lua] Hope this has been of some help to you.
[QUOTE=theJ89;15928647]Cool, thanks for the tip! Are you sure it's scripted_ents though? I'll test it to make sure.[/QUOTE] you didnt Answer my
[QUOTE=drbugbait;15930143]you didnt Answer my[/QUOTE] I posted instructions at the bottom of the first post, but here they are again: [QUOTE=theJ89] [b]You only need to download this if you host a server or if you want to experiment with it in singleplayer.[/b] Instructions: 1. Download and install TortoiseSVN if you haven't already. 2. Create a blank folder in your garrysmod/addons folder. I suggest naming it "itemforge". 3. Right click that folder and go to "SVN Checkout..." 4. Enter this for the URL of repository: [url]http://itemforge.googlecode.com/svn/trunk[/url] 5. Click OK and wait for it to download. 6. Any time the Beta SVN is updated, right click this folder and choose "SVN Update" to bring yourself up to sync. Currently the only way to spawn items without doing it directly in the server console, or by writing a serverside script that does this, is with the debug menu. [highlight]BE WARNED[/highlight]: The Debug Menu gives equal-level access to all players. All items, including items that aren't supposed to be spawned like the base_ items, can be spawned. Additionally, any user can remove any spawned items or inventories. To get the debug menu, do the following... Steps 1-3 only have to be done once: 1. Download this: [url]http://www.guilddnr.net/dunescape/itemforge_debug.zip[/url] 2. Extract the contents of this ZIP to your addons folder. 3. Go in game, open your console with ~ and type: [b]bind "k" "itemforge_debug"[/b] 4. While in-game, press [K] to show the debug menu. 5. Hold [C] to show the cursor and interact with the menu. This is on purpose because I want it this way. 6. Press the [Refresh] button on the Item-Types tab to get a list of available item-types. 7. Select an item-type you want to spawn and hit [Spawn]. This creates the item where you are looking. [/QUOTE]
Sorry, you need to Log In to post a reply to this thread.