ID:140131
 
Code:
mob/var/EQW = 0
mob/var/EQS = 0
mob/var/EQB = 0

obj
items
verb/get()
set src in oview(1)
src.loc = usr
verb/drop()
if (usr.EQB == 1)
usr << " You must take it off before you can drop it"
src.loc = usr
return
if (usr.EQW == 1)
usr << " You must take it off before you can drop it"
src.loc = usr
if (usr.EQS == 1)
usr << " You must take it off before you can drop it"
src.loc = usr
else
src.loc = usr


obj
items
potion
potion
icon = 'items.dmi'
icon_state = "potion"



obj
items
equip
weapon
verb/equipw()
set name = "Equip"
usr.EQW = 1
src.suffix= "Equipped"
verb/unequipw()
set name = "Unequip"
usr.EQW = 0
src.suffix= ""
shield
verb/equips()
set name = "Equip"
verb/unequips()
set name = "Unequip"
body
verb/equipb()
set name = "Equip"
verb/unequipb()
set name = "Unequip"


obj
items
equip
weapon
sword
icon = 'equips.dmi'
icon_state = "sword"


Problem description:


While messing with my testworld trying to learn programming Ive recently discovered a simple way to make picking up objects for certain parents and childs

However I came to a flaw after going through this trying to organize everything Equipping and Unequipping works for Equips but I cant add any special properties to certain equips

say I wanted a sword to give the mob/var/str+ bonus or another sword to give a mob/var/HP+ bonus

I'm a bit confused on what I would do from here tried using If statements such as
if (usr.EQW == 1)

But that just made tons of errors popped up any suggestions what I would be doing to learning to assign variables to objs or is there a way I saw in the blue book you could but It didn't seem to work either because it bonuses just from being picked up if I do it that way rather Equipped
also realized I would be able to equip as many swords as I wanted lmao well damn... );
I really just started messing around with DM again, but something like this should give you an idea.

mob/player
var/list/equips

obj/equipment/weapon
verb/equip()
// ...
usr. strength += src. power

var/power
sword
power = 2

sword2
power = 4

sword3
power = 5

equip()
..()
usr.health += 10


Then this should help you with equipment slots.
http://www.byond.com/developer/forum/?id=740332&view=1
In response to Ulterior Motives
Oh wow I'm pretty confused never thought about lists though I'll try to work with it thanks ^^
In response to DeathBane
One more question Should I just dump my current script and remake it to work similar to what you posted?

having issues with
usr. Str += src. power
In response to DeathBane
well first thing you have to make it so you cant equip it more than once, this should work perfectly fine

obj/items/equip/weapon
verb/equipw()
set name = "Equip"
if(!usr.EQW)
usr.EQW = 1
src.suffix= "Equipped"
else
usr<< "You already have a weapon equipped!"
verb/unequipw()
set name = "Unequip"
if(!usr.EQW)
usr<<"This is not equipped"
else
usr.EQW = 0
src.suffix= ""


now for your next question on the stats you need to make some variables for the obj's themselves. That should go like so:

obj/items/equip/sword
icon = 'equips.dmi'
icon_state = "sword"
str=10

obj/var
str



and now to put this all together so the equip verb adds the stats:

obj/items/equip/weapon
verb/equipw()
set name = "Equip"
if(!usr.EQW)
usr.EQW = 1
usr.str += src.str
src.suffix= "Equipped"
else
usr<< "You already have a weapon equipped!"
verb/unequipw()
set name = "Unequip"
if(!usr.EQW)
usr<<"This is not equipped"
else
usr.EQW = 0
usr.str -= src.str
src.suffix= ""
obj/items/equip/sword
icon = 'equips.dmi'
icon_state = "sword"
str=10

obj/var
str

mob/var
EQW
str


that should take care of the problems(sry if i made a careless mistake if you see one i just got home from work and i'm very tired)
In response to Scarymonkeys623
It works and I went through it understanding how it works I came across a few problems

First problem was that the Str bonus is a bonus to my str it all adds up on its own variable not as a bonus adding to my players actual stat it adds up but only if I count the player as having blank str:"" with no way to giving them a normal stat without the variable being undefined.

I tried to switch it my self to where its 2 variables adding to eachother but it didnt work out No errors but also no real effect tried messing with the expressions and everything


Also the way the if() function is being used on the equip is making the sword unable to be dropped im afraid if I try to tweak it I might end up only able to drop Equips and not just any obj/items

Sorry I'm really new to this I went through the blue book and ZBT and that's it really Its really hard to pound this into my head
In response to DeathBane
DeathBane wrote:
It works and I went through it understanding how it works I came across a few problems

First problem was that the Str bonus is a bonus to my str it all adds up on its own variable not as a bonus adding to my players actual stat it adds up but only if I count the player as having blank str:"" with no way to giving them a normal stat without the variable being undefined.

I tried to switch it my self to where its 2 variables adding to eachother but it didnt work out No errors but also no real effect tried messing with the expressions and everything


Also the way the if() function is being used on the equip is making the sword unable to be dropped im afraid if I try to tweak it I might end up only able to drop Equips and not just any obj/items

Sorry I'm really new to this I went through the blue book and ZBT and that's it really Its really hard to pound this into my head



Wow I feel like a idiot ^^ never mind I didn't look at when you defined str at mob Sorry about that.

I'm still trying to figure out whats wrong with my Drop verb it seemed to stop working all together
In response to DeathBane
Woot thank you for your help everything works and i actually understand the code :)