[QUOTE=LauScript;30792071][b] Inventory system, nearly complete. [/b][/QUOTE]
Start how you mean to go on, I [i]strongly[/i] advise coding your inventory system so that each item is an "instance" of the item class, which can store its own persistant data. e.g: A 'drink' could store how much liquid is left inside it, or a weapon could store how much ammo it has in each clip. I just had to re-code the entire inventory system for CloudScript - and that's A LOT of code.
Just my two cents, otherwise it looks brill, good luck!
[editline]30th June 2011[/editline]
[lua]
local weaponItem = Clockwork.item:CreateInstance("weapon_mp5");
weaponItem:SetData("ClipOne", 30);
weaponItem:SetData("Durability", 10);
player:GiveItem(weaponItem);
[/lua]
I was actually thinking on how I would do that, how should i store at on the item itself? Because if you look how I'm storing it, it's not capable of doing that, I think. How could I be able to give each item it's own data?
tbh, that's a little over my head, I have no idea how I would do that.
[QUOTE=LauScript;30803022]I was actually thinking on how I would do that, how should i store at on the item itself? Because if you look how I'm storing it, it's not capable of doing that, I think. How could I be able to give each item it's own data?[/QUOTE]
Have a global table to store all instances that exist. Instances are a table.Copy of the item table (but make sure each item table has a .data table variable where the data is stored). Each item also has a unique ID called item ID (.itemID) which you can generate.
So something like:
mymod.Inventory.Instances[itemID] = itemInstance;
Then the player's inventory looks like:
player.Inventory[itemClass][itemID] = itemInstance (but not a copy, the same itemInstance stored in the table above).
e.g:
player.Inventory[itemClass][itemID] = mymod.Inventory.Instances[itemID];
Oh I see, that's actually not that hard to do. How are you generating the ItemID? Is it a serial number?
btw check your inbox on fp
[QUOTE=LauScript;30792071]Alright so I've got some updates to prove I'm not doing nothing, I'm just finishing up the Inventory system, and after it's done I'll make the item mixing shit with recipes and all that.
Also something you Lua scripters out there might be interested in, is the plugin system, it's very easy to add plugins for this gamemode, and you can even add hooks specifcally for the plugins, Firstly I'll post the code to the inventory system plugin, and then I will post a example plugin for those of you who want to make stuff, and I can add it.
I've also decided this will be released once completed.
[b] Inventory system, nearly complete. [/b]
[lua]
local Plugin = {}
Plugin.Name = "Inventory"
Plugin.Description = "Inventory System"
Plugin.Author = "LauScript"
Plugin.Version = "1.0"
Plugin.CustomHooks = false
require("glon")
society.Inventory = { }
society.Inventory.Objects = { }
function society.Inventory.LoadObjects()
for k, v in pairs( file.FindInLua( "Society/gamemode/systems/plugins/base/objects/*.lua" ) ) do
include( "Society/gamemode/systems/plugins/base/objects/" .. v )
end
end
function society.Inventory:Add( tbl )
if ( tbl ) then ITEM = tbl end
if ( ITEM.Display and ITEM.Cost and ITEM.Model and ITEM.Class and ITEM.Category and ITEM.OnDrop and ITEM.OnPickUp and ITEM.OnConsume) then
self.Objects[ tostring(ITEM.Class) ] = { Display = ITEM.Display, Cost = ITEM.Cost, Model = ITEM.Model, Category = ITEM.Category, Class = ITEM.Class, OnDrop = ITEM.OnDrop, OnPickUp = ITEM.OnPickUp, OnConsume = ITEM.OnConsume}
print("Added Item :: " .. ITEM.Display .. "-" .. ITEM.Class .. "-" .. ITEM.Category )
end
end
function society.Inventory:Get( item )
if ( item ) then
if ( self.Objects[ tostring(item) ] ) then
return self.Objects[ tostring(item) ]
end
end
end
function society.Inventory:Save( pl )
file.Write("Society/players/" .. pl:UniqueID() .. "/inventory.txt", TableToKeyValues( pl.Inventory ))
end
function society.Inventory:Give( pl, class, amount )
local obj = self:Get( tostring(class))
if ( !pl.Inventory ) then pl.Inventory = { } end
if ( pl.Inventory ) then
CurTempItemAmt = 0
if ( pl.Inventory[ obj["Class"] ] ) then
CurTempItemAmt = tonumber(pl.Inventory[ obj["Class"] ].Amount)
end
local amount = tonumber(amount) or 1
pl.Inventory[ tostring(obj["Class"]) ] = { Amount = CurTempItemAmt + amount}
self:Save( pl )
end
end
function society.Inventory:Take( pl, class, amount )
local obj = self:Get( tostring(class))
if ( !pl.Inventory ) then return end
if ( pl.Inventory[ obj["Class"] ].Amount >= tonumber(amount) ) then
local ItemAmt = tonumber(pl.Inventory[ obj["Class"] ].Amount)
pl.Inventory[ tostring(obj["Class"]) ] = { Amount = ItemAmt - amount}
self:Save( pl )
elseif ( tonumber(pl.Inventory[ obj["Class"] ].Amount) - tonumber(amount) <= 0 )
pl.Inventory[ tostring(obj["Class"]) ] = nil
self:Save( pl )
end
end
function society.Inventory:Load( pl )
if ( pl.Inventory == nil ) then
local self.SavedInventory = file.Read("Society/players/" .. pl:UniqueID() .. "/inventory.txt");
pl.Inventory = KeyValuesToTable( self.SavedInventory )
end
end
function Plugin.Initialise()
society.Inventory.LoadObjects()
society.Plugin:AddCustomHook( Plugin, "PlayerSpawn", OddCCCommand)
end
society.Plugin.RegisterPlugin( Plugin )
[/lua]
[/QUOTE]
Okay so I don't know if you have changed it yet, but you are requiring the glon module but not using it?
Also, why not string.gsub the player's steamid instead of using their unique id?
[QUOTE=Derek_SM;30805970][/QUOTE]
You messed up the quote. Also that code is outdated, it now goes per character, and uses the steamid to store data.
as a suggestion, I think that it would be could if there were random events that occur such as storms or bandits attacking a town, just to keep players on their feet.
Weather would be cool. Raining will help water crops, and will give a higher chance to catching a fish. But of course a heavy storm could get bad and harm structures and players.
Random weather added to make-it-happen list.
Bandits events like that will be handled outside the script, roleplayed out.
I'll make a suggestion that with food and water aspects of necessity, instead of instantly killing the player (because that happens in real life derp) you should have large side affects depending on how long you go without the item for, example of water; have not drunken for 10 mins, reduce walk and run speed by 30%, after 15 mins, remove the ability to run and slightly blurred screen, after 20 mins have a faint heartbeat in the background as a warning while once again reducing walk-speed. Finally after 25 mins have the player black out and frozen for 5 seconds at a time followed by death at 26 mins.
Keep working away at this! Garry's Mod Survival has always lacked in features and the quality was never good (very buggy etc), if you complete this I may have to quit my life and start playing Gmod 24/7 again!
[QUOTE=101kl;30821863]I'll make a suggestion that with food and water aspects of necessity, instead of instantly killing the player (because that happens in real life derp) you should have large side affects depending on how long you go without the item for, example of water; have not drunken for 10 mins, reduce walk and run speed by 30%, after 15 mins, remove the ability to run and slightly blurred screen, after 20 mins have a faint heartbeat in the background as a warning while once again reducing walk-speed. Finally after 25 mins have the player black out and frozen for 5 seconds at a time followed by death at 26 mins.
Keep working away at this! Garry's Mod Survival has always lacked in features and the quality was never good (very buggy etc), if you complete this I may have to quit my life and start playing Gmod 24/7 again![/QUOTE]
If you do this please make it over a duration of like two hours, not twenty six minutes.
Yeah I don't even know if I'll do that, I'll probably just have it have some other, not-annoying effect.
Alright, quick update
[release]
[b]Completely done[/b]
[i]Inventory
Multi-Character support
Containers
Item/Object system with OnConsume, OnPickUp, OnDrop, OnRemove, OnWear support.
[/i]
[b] Working on now [/b]
[i]Interfaces for character creation, selection. [/i]
[/release]
[QUOTE=LauScript;30837936]Alright, quick update
[release]
[b]Completely done[/b]
[i]Inventory
Multi-Character support
Containers
Item/Object system with OnConsume, OnPickUp, OnDrop, OnRemove, OnWear support.
[/i]
[b] Working on now [/b]
[i]Interfaces for character creation, selection. [/i]
[/release][/QUOTE]
I can confirm this. He added some goodies before he went to sleep.
[QUOTE=Aide;30845615]I can confirm this. He added some goodies before he went to sleep.[/QUOTE]
Oh thank God I thought he was lying :rolleyes:
[QUOTE=somescripter;30845636]Oh thank God I thought he was lying :rolleyes:[/QUOTE]
Him and I have been communicating on stuff were working on and every now and then we play a game of AA3 or GMod.
[QUOTE=Aide;30845752]Him and I have been communicating on stuff were working on and every now and then we play a game of AA3 or GMod.[/QUOTE]
Indeed.
[editline]2nd July 2011[/editline]
[QUOTE=somescripter;30845636]Oh thank God I thought he was lying :rolleyes:[/QUOTE]
Oh, you know me.. :>
I can host a server for test builds if you want, i really love the idea of this :3
no thankyou.
[url]http://img88.imageshack.us/img88/1707/bamboo.png[/url]
Got bored, read this thread again. 'Tis hollow on the top and bottom, still got stuff to do but I'm kind of tired.
Hopefully we be able to make Armor to wear, GMStranded really didn't added any type of armory stuff in the game, so I wish that we could add in armor and medieval weaponry.
I gotta a feeling the slogan should be "Do you come from a land down under ?"
[QUOTE=darkedone02;30920968]Hopefully we be able to make Armor to wear, GMStranded really didn't added any type of armory stuff in the game, so I wish that we could add in armor and medieval weaponry.[/QUOTE]
There will/is be/a clothing system.
Sounds fun.. Looking forward to playing it.
Sounds interesting. I'm wondering how you'll be able to effectively implement these features. From my experience, most ordinary RP players (and I'm talking about DarkRP and Perp, for instance) don't really enjoy working collaboratively with their fellow players. So I'm curious as to how you plan to encourage these behaviors, as, evidently, this gamemode necessitates collaboration.
Well there will be "Themes" to the gamemode, Society itself is more of a editable base/core that you can turn into various things, kind of like a framework but I don't like to call it that. Society will contain three
different themes, not including the base Survival theme.
[release]
[b] Current themes being developed. [/b]
[IMG]http://games.saix.net/images/stalker_banner.jpg[/IMG]
[IMG]http://www.mvktech.net/images/reviews/gw84gs/hl2_banner.jpg[/IMG]
[/release]
I've been wanting something like this for the longest time.
This may revive roleplay for me from the shitty abyss that is the current RP
This gamemode is driven towards character development, It is not made for people that fit the following:
[release]
[b] The will-ruin-rp attributes list. [/b]
[i]People who roleplay for items.
People who believe in RDM.
People who complain.
People who try to avoid what is physically possible to keep their character alive, so they keep items.
People who don't understand advanced roleplaying basics( full extent of the /me action, and the ability to fully describe actions in the use of the /me action. )
People who can't use proper grammar ICly because believe it or not it does a huge affect on roleplaying( It's very hard to understand people who don't use Commas, and other things. )
[/i]
[/release]
That's my while-i'm-stoned-think-of-ways-to-make-good-rp-list.
I don't honestly understand why you must overstate so much that you use pot. We get it, you like weed.
[QUOTE=Big Bang;31020033]I don't honestly understand why you must overstate so much that you use pot. We get it, you like weed.[/QUOTE]
Because it's my lifestyle. and I do what I want. While I'm [b]stoned[/b].
On a serious note, I don't know, because usually I type differently when herb is in my system and people use to think I was just like that, and then I said I was just like that, and they were like 'Oh', and then I was like, 'cause i'm stoned.' and then it fixed the problem.
On another note I didn't notice I did, I thought I only mentioned marijuana twice in this entire thread.
Sorry, you need to Log In to post a reply to this thread.