ID:146898
 
this is an example of my code for swords.
obj
Rusty_Sword//this is for when some one buys it the icon will be in the inventory slot
icon = 'weapons.dmi'
icon_state = "rusty sword"
verb
Get()
set src in oview(1)
usr.contents+=new/obj/Rusty_Sword
del src
//i put this in just in case some one drops it and some one else wants to get it
Drop()
set src in usr.contents
if(usr.equip>=1)
alert("You cant drop what you have Equiped")//This makes it do you cant drop something you are equiping
else
src.Move(usr.loc)//This sets the obj you drop under you
Equip()
set src in usr.contents
if(usr.equip>=1)//You have to make another var called Equiped
usr<<"You already have something Equiped"
else
suffix+="Equiped"//This makes it to when you equip it it says next to the obj in your inventory slot that it is equiped
usr.equip=1//This makes it so you cant equip any thing else
usr.Str+=10
usr.overlays += 'sword overlay.dmi'
layer = 4
usr<<"You have equiped the [src]"
Unequip()
set src in usr.contents
if(usr.equip<=0)
usr<<"You have nothing Equiped"
else
suffix=null
usr.Str-=10//what ever you have for how much it gives you when you equiped it
usr.equip=0//This maes it so you can equip things
usr.overlays -= 'sword overlay.dmi'
usr<<"You have unequiped the [src]"


and this is an example of my sheilds code...
obj
Old_Sheild//this is for when some one buys it the icon will be in the inventory slot
icon = 'sheilds.dmi'
icon_state = "old sheild"
verb
Get()
set src in oview(1)
usr.contents+=new/obj/Old_Sheild
del src
//i put this in just in case some one drops it and some one else wants to get it
Drop()
set src in usr.contents
if(usr.equip>=2)
alert("You cant drop what you have Equiped")//This makes it do you cant drop something you are equiping
else
src.Move(usr.loc)//This sets the obj you drop under you
Equip()
set src in usr.contents
if(usr.equip>=2)//You have to make another var called Equiped
usr<<"You already have something Equiped"
else
suffix+="Equiped"//This makes it to when you equip it it says next to the obj in your inventory slot that it is equiped
usr.equip=2//This makes it so you cant equip any thing else
usr.Def+=8
usr.overlays += 'sheild overlay.dmi'
layer = 5
usr<<"You have equiped the [src]"
Unequip()
set src in usr.contents
if(usr.equip<=0)
usr<<"You have nothing Equiped"
else
suffix=null
usr.Def-=8//what ever you have for how much it gives you when you equiped it
usr.equip=0//This maes it so you can equip things
usr.overlays -= 'sheild overlay.dmi'
usr<<"You have unequiped the [src]"


to make everything clear on what i have done...what i did was i took the sword code and wdited the if(usr.equip>=*number*), as you can see.

im not sure if i did it right or if i had the right idea, but it seems to work slightly.

i can equip both a sword and sheild, but when i un-equip 1 of them, it un-equips both, but the status effects stay on the character.

i know it may have something to do with the if(usr.equip<=0) in the un-equip verb part, but im not sure what i should change it to IF that is what im supposed to edit.

lil help here? thanks in advanced for those who can help me.
prob 1, the equiped var is linked to the player and not the obj its self the obj needs that var so it can check its self

prob 2, layer = 4 is set to the player and not the obj in effect (i think)
In response to Zmadpeter
no no. layer = 4 and layer = 5 is set to the weapon's overlays...or at least that is what i am trying to do.

prob 1, the equiped var is linked to the player and not the obj its self the obj needs that var so it can check its self<

ok what about this? im taking that as, "you did it wrong." how should i have it so it lets me set and equip the 2 pieces of equipment and un-equip them seprately, without unequiping both pieces?
In response to Psychotic
obj
var
equiped = 0 // 0 = no 1 = yes
fan
verb
Equip()
if(src.equiped == 0)
// equip
src.equiped = 1
else
// error all ready equiped
Unequip()
if(src.equiped == 1)
// unequip
src.equiped = 0
else
// error not equiped
In response to Zmadpeter
thank you verry much.

i will edit my codes and tell you what happens.
In response to Psychotic
the thing about that is if you have lets say

44 swords then you can equip them all :)

you also need a way of checking if the place its being equiped to is free
Your equipment system is wrong. You should not have a yes/no var saying whether an item is equipped. What you should have is a mob var saying which item is equipped (or null if none).
mob
var/obj/item/weapon/weapon

Then weapon can be set to the weapon itself when a weapon is equipped, and set to null when the weapon is unequipped or dropped.

You can always find out if a particular weapon is equipped by checking this way:
var/mob/M = loc
if(ismob(M) && M.weapon == src)
...


Lummox JR
In response to Zmadpeter
hmm....i see that. :-\

the equipable items i am wanting are:
swords
sheilds
body armor
and accessories(ring, necklancees, ECT.)

yes, i am wanting multiple weapons in the game.
no, i do not want multiple weapons being equiped.
same with sheilds and body armor and accessories.

wanting 1 sword equipable, 1 sheild equipable, 1 armor equipable and 1 accessory equippable.(im sure that was already known.)

it seems that the code i have doesnt allow that.(or at least not the way i have it, IF it does.)

what would be the better way the code should be if these are my vars?

mob
var
Level = 1//player lvl
Hp = 22//player current HP
MaxHp = 22//player MaxHp
Mp = 10//current Mp
MaxMp = 10//MaxMp
equip = 0//equiping items
Gold = 0//gold
Str = 9//player Strength
Def = 5//player Defence
Spd = 6//speed of the player
Exp = 0//Exp of the player
MaxExp = 15//Max Exp of the player
In response to Psychotic
thank you InuTracy!