ID:144543
 
Code:Equip weapon
mob
var
head=""
chest=""
legs=""
gloves=""
boots=""
weapon=""
head2=0
chest2=0
legs2=0
gloves2=0
boots2=0
lweapon=0
rweapon=0
Left=0
Right=0
isweapon=0

mob
verb
Equip_weapon(mob/M in world)
if(M.isweapon==1)
weapon()
else
src<<"It has to be a weapon."

mob/weapon/short_sword
name="short sword"
isweapon=1
equipped=0
var/obj/weapon/SS
weapon()

mob/weapon/long_sword
name="long sword"
isweapon=1
equipped=0
var/obj/weapon/LS
weapon()

mob/weapon/scythe
name="scythe"
isweapon=1
equipped=0
var/obj/weapon/S
weapon()

mob/weapon/plain_mace
name="plain mace"
isweapon=1
equipped=0
var/obj/weapon/PM
weapon()

mob/weapon/spiked_mace
name="spiked mace"
isweapon=1
equipped=0
var/obj/weapon/SM
weapon()

mob/weapon/arcane_staff
name="arcane staff"
isweapon=1
equipped=0
var/obj/weapon/AS
weapon()

mob/weapon/spiked_arcane_staff
name="spiked arcane staff"
isweapon=1
equipped=0
var/obj/weapon/SAS
weapon()

mob
proc
weapon(mob/M in world)
src.weapon = input("Choose a hand for your weapon.","Which Hand?",src.weapon) in list("Left","Right")
if(src.Left==0 && equipped==0)
src<<"You equip your [M] on your left hand."
src.lweapon=1
M.equipped=1
M.suffix="Equipped"
else
src<<"You have to unequip your current weapon."
return
if(src.Right==0 && equipped==0)
src<<"You equip your [M] on your right hand."
src.rweapon=1
M.equipped=1
M.suffix="Equipped"
else
src<<"You have to unequip your current weapon."
return


Problem description:runtime error: Cannot modify null.equipped.
proc name: weapon (/mob/proc/weapon)
usr: VolksBlade (/mob)
src: VolksBlade (/mob)
call stack:
VolksBlade (/mob): weapon(null)
VolksBlade (/mob): Equip weapon(the short sword (/mob/weapon/short_sword))
You equip your on your left hand.

ok the thing is is that pops up when i try to use my coding and i would think my coding would work but i get no errors but that pops up when i try to use it and i tryed the right hand and it says left hand and plus the suffix for the weapon appears by your name not the weapon...

someone please help me


VolksBlade

Just a suggestion, I wouldnt use a MOB as a weapon...I use obj...
Your equipment system is wrong. You should make the following changes right away:

  • There should be no equipped var, since the mob itsemf needs the var to say which weapon is equipped.
  • The isweapon var should be eliminated. You don't need it for anything.
  • The Equip_weapon() verb should be eliminated, and consolidated with any others like it. You should have only two equipment verbs: Equip() and Unequip().
  • The mob vars like head, chest, weapon, etc. should not be text strings; they should be null when no equipment is in use, and otherwise should be set to the item itself.
  • Your items are defined as mobs, not objs. They need to be objs.
  • Setting src.weapon to the hand choice is not right; src.weapon should be the weapon in use. If you're treating the left and right hands as different equipment slots, then you should simply have mob/var/obj/lefthand and mob/var/obj/righthand to hold the items.

    Lummox JR