ID:175903
 
Heres my Equip coding think someone can combine it and make it so there is always a equip and unequip verb when you log in so both verbs are in your Commands, try to do that and combine these together I need both verbs on start up because, I can't unequip when I reloged in and I left with them equiped.


obj
Weapons

verb/Equip()
set src in usr
if(!usr.equiped)
usr.attack+=src.attackadd
src.verbs+=/obj/Weapons/proc/Unequip
src.verbs-=/obj/Weapons/verb/Equip
src.suffix+="Equiped"
usr.equiped = 1
else
usr << "You already have something equiped!"
proc/Unequip()
set src in usr
if(!usr.equiped)
usr << "You don't have anything equiped!"
else
usr.attack-=src.attackadd
src.verbs-=/obj/Weapons/proc/Unequip
src.verbs+=/obj/Weapons/verb/Equip
src.suffix = ""
usr.equiped = 0
verb
Drop()
set src in usr
if(src.suffix == "Equiped")
usr << "Un-equip [src] first!"
else
src.Move(usr.loc)
FireSword
icon = 'weapons.dmi'
icon_state = "f"
attackadd= 150
Dagger
icon = 'weapons.dmi'
icon_state = "i"
attackadd= 6








obj
ring

verb/Equip()
set src in usr
if(src.suffix=="Equiped"){usr<<"You can't equip something thats already equiped!";return}
if(usr.equiped3 <= 2)
usr.defense+=src.defadd
usr.attack+=src.attackadd
usr.magic+=src.magicadd
usr.maxmagic+=src.maxmagicadd
usr.maxhealth+=src.hpadd
src.verbs+=/obj/ring/proc/Unequip
src.verbs-=/obj/ring/verb/Equip
src.suffix+="Equiped"
usr.equiped3 += 1
else
usr << "You already have something equiped!"
proc/Unequip()
set src in usr
if(usr.equiped3 <= 0)
usr << "You don't have anything equiped!"
else
usr.defense-=src.defadd
usr.attack-=src.attackadd
usr.magic-=src.magicadd
usr.maxmagic-=src.maxmagicadd
usr.maxhealth-=src.hpadd
src.verbs-=/obj/ring/proc/Unequip
src.verbs+=/obj/ring/verb/Equip
src.suffix = ""
usr.equiped3 -= 1
verb
Drop()
set src in usr
if(src.suffix == "Equiped")
usr << "Un-equip [src] first!"
else
src.Move(usr.loc)

Defence_Ring
icon = 'armor.dmi'
icon_state= "g"
defadd= 15
Life_Ring
icon = 'armor.dmi'
icon_state= "d"
hpadd= 50
Strenght_Ring
icon = 'armor.dmi'
icon_state= "h"
attackadd= 15
Ring_of_Power
icon = 'armor.dmi'
icon_state= "p"
maxmagicadd= 15









obj
armour

verb/Equip()
set src in usr
if(!usr.equiped2)
usr.defense+=src.defadd
src.verbs+=/obj/armour/proc/Unequip
src.verbs-=/obj/armour/verb/Equip
src.suffix+="Equiped"
usr.equiped2 = 1
else
usr << "You already have something equiped!"
proc/Unequip()
set src in usr
if(!usr.equiped2)
usr << "You don't have anything equiped!"
else
usr.defense-=src.defadd
src.verbs-=/obj/armour/proc/Unequip
src.verbs+=/obj/armour/verb/Equip
src.suffix = ""
usr.equiped2 = 0
verb
Drop()
set src in usr
if(src.suffix == "Equiped")
usr << "Un-equip [src] first!"
else
src.Move(usr.loc)
Metal_Armor
icon = 'armor.dmi'
icon_state= "i"
defadd= 6
Dark_Armor
icon = 'armor.dmi'
icon_state= "b"
hpadd= 50



Plz combine those together so its shorter and easier to use and can you plaz make it so the unequip and equip verbs are always in commands and never disapear.


You've handled equipment in a bad way here; it's a common way, and I've seen a lot of people do it, so one of thse days I'm gonna have to go through the available demos and tutorials and figure out who to slap for putting out such shoddy code.

The problem is, it's a bad idea to make a var just 1 if something is equipped and 0 if it's not. It's a much better idea to make a var saying what the equipment actually is, or null if nothing is equipped:
mob
var/obj/item/weapon/weapon // src.weapon is my weapon
var/obj/item/armor/armor // src.armor is my armor
Then an equip verb can set the appropriate var.

This is a much much better way because it allows easy access to the current weapon, armor, etc. That's very good for calculating battle damage and other necessities.

Lummox JR
In response to Lummox JR
I dont get how, I would put the coding together tho, you said something I kind of got .Im still learning how to code I can't understand all.




X.x Does anyone out there have a demo for Equip and Unequip that Work With a SAVE CODE!!!!!!!!