ID:142439
 
well, some people were bothering my arse about adding guild item making to the game, so i made one. Im releasing it here, feel free to use it and comment on it ;). i know its nothing fancy because i made it lol.

first basic item:
obj/Equipment/Guild

Guild_Item
name = "Guild Item"
density = 0

equiped = 0
value = 250000

var
gitem

Click()
if(src in usr:contents)
if(!src.equiped && src.guildowner == usr.guild_name)
usr.overlays += gitem
usr << "You have equiped the: <u>[src]</u>."
suffix = "(Worn)"
src.equiped = 1
else
if(src.equiped)
usr.overlays -= gitem
usr << "You have unequiped the: <u>[src]</u>."
suffix = null
src.equiped = 0


verb

Pick_Up()
set src in oview(0)
set category = null
if(Move(usr))
usr << "You have picked up the: <u>[src]</u>."
usr.inven_min += 1
else
usr << "You are unable to pick up the: <u>[src]</u>."

Drop()
set category = null
if(!src.equiped)
src.loc = usr.loc
usr << "You have dropped the: <u>[src]</u>."
usr.inven_min -= 1
else
usr << "You are unable to drop: <u>[src.name]</u>, it's already equipped."



Now guild item making :)
mob
Guild_Basic_Member
verb
Make_a_guild_item()
set category = "Guild"
if(usr.in_guild == 1)
if(usr.zenni>= 500000)
alert("This cost 500000 zenni!","Ok")
alert("Are you sure you want to do this, money is NOT refundable!","Ok")
switch(input("Are you sure you want to make a Guild?","Create Guild",text) in list ("Yes","No"))
if("Yes")
usr<<"Ok!"
usr.zenni -= 500000
var/guilditemicon = input("Choose an icon","Icon") as icon
var/guilditemname = input("Choose a name","Guild item name") as text
var/obj/Equipment/Guild/Guild_Item/G = new/obj/Equipment/Guild/Guild_Item
G.name = guilditemname
G.icon = guilditemicon
G.loc = usr
G.guildowner = usr.guild_name // whatever u use in your game
G.gitem = guilditemicon
if("No")
usr.zenni -= 0
usr<<"that is fine"
else
usr<<"Sorry you do not have enough zenni! You need 500000!"
else
usr<< "You are not in a guild...."


obj
var
guildowner = "none"


zenni - game currency. change it to your needs.
Snippets are kinda borderline useful at best in Creations, but not at all when they contain poor code, and when the purpose of the code is not clear. In particular, there's no explanation as to why it's important to make an item in order to make a guild.

Problems present in the code: There is abuse of the : operator, and the equipment system has a fairly serious design flaw. A properly made equipment system should always have a reference, belonging to the mob, that points to the item that is equipped. That reference can be in the form of a var or a list, like so:

mob
// predefined slots
var/obj/item/weapon/weapon
var/obj/item/armor/armor

// no predefined slots, just a list of equipped items
// usually this list is associative by slot, e.g. equipment["weapon"]=sword
var/list/equipment


Equipment demos already exist which demonstrate this concept effectively.

Lummox JR
In response to Lummox JR
yes.. i see :