Ok i am stumped on this This is hard to explain so i will try my hardest
OK
first when i had my equip verb in my game i was able to equip a coppersword and say i had a club with me too i could un equip the the club(wich was never equpied in the first place)and it would register me as un equpied the copper sword but only taking the stats away from when you would un equip a club, so i could keep doing that and get strenght for ever
I tried to fixe but now i can alwasy equip a copper sword and it still says you have something equiped but i get strength for it even when it says that
I hoped i explained it good Here is my code for equiping things
obj/bamboo
icon='icons.dmi'
icon_state="bamboo"
verb/Get()
set src in oview(1)
usr.contents+=new/obj/bamboo
del(src)
verb/Drop()
set src in usr.contents
if(usr.M>=1)
usr<<"You Have Something Equiped"
else
src.Move(usr.loc)
verb/Equip()
set src in usr.contents
if(usr.M>=1)
usr<<"You already have something Equiped"
if(usr.MX>=1)
usr<<"You already have something Equiped"
if(usr.MXB>=1)
usr<<"You already have something Equiped"
else
suffix+="Equiped"
usr.M=1
usr.attack+=2
verb/Unequip()
set src in usr.contents
if(usr.M<=0)
usr<<"You have nothing Equiped"
else
suffix=null
usr.attack-=2
usr.M=0
obj/club
icon='icons.dmi'
icon_state="club"
verb/Get()
set src in oview(1)
usr.contents+=new/obj/club
del(src)
verb/Drop()
set src in usr.contents
if(usr.MX>=1)
usr<<"You have something equpied"
else
src.Move(usr.loc)
verb/Equip()
set src in usr.contents
if(usr.M>=1)
usr<<"You already have something Equiped"
if(usr.MX>=1)
usr<<"You already have something Equiped"
if(usr.MXB>=1)
usr<<"You already have something Equiped"
else
suffix+="Equiped"
usr.MX=1
usr.attack+=4
verb/Unequip()
set src in usr.contents
if(usr.MX<=0)
usr<<"You have nothing Equiped"
else
suffix=null
usr.attack-=4
usr.MX=0
obj/coppersword
icon='icons.dmi'
icon_state="coppersword"
verb/Get()
set src in oview(1)
usr.contents+=new/obj/coppersword
del(src)
verb/Drop()
set src in usr.contents
if(usr.MXB>=1)
usr<<"You already have something Equiped"
else
src.Move(usr.loc)
verb/Equip()
set src in usr.contents
if(usr.M>=1)
usr<<"You already have something Equiped"
if(usr.MX>=1)
usr<<"You already have something Equiped"
if(usr.MXB>=1)
usr<<"You already have something Equiped"
else
suffix+="Equiped"
usr.MXB=1
usr.attack+=8
verb/Unequip()
set src in usr.contents
if(usr.MXB<=0)
usr<<"You have nothing Equiped"
else
suffix=null
usr.attack-=8
usr.MXB=0
Thank you for any help
i appreciate it
ID:179470
Dec 21 2001, 9:33 am
|
|
Dec 21 2001, 9:57 am
|
|
I'm not looking at your source code (because it looks quite long and unconcise) but I will show you a simple code to equip/unequip items correctly:
|
This doesn't solve your problem directly, but I have a suggestion about the way to handle equipped items giving stat boosts.
The way I handle this in MLAAS is to have a single procedure to recalculate your current stats based on your items and buffs. I keep separate variables for base stats and current stats. When a recalculation is done, you set your stats to the base value, then iterate through all buffs and equipment to get your current stats. I call the procedure any time anyone un/equips or drops an item, applies a buff (stims in my game), dies, or levels. Here's a mini-sample of what I mean: obj/weapon I think this approach is much safer than adding and subtracting a stat when you equip or unequip an item. If there are any problems at all with your stats, they are completely fixed any time recalc_stats() is called. It also won't matter if someone uses the equip() or unequip() verbs repeatedly on the same item... it still calculates it all properly. |
In response to Skysaw
|
|
Great idea! I never thought of that... I may use that strategy some time in the future.
|
Take a look at Nadrew's weapon system, it does exacly what you want.
|