Equip Errors

Laraqua
26 Jan 2018, 22:15

I was following the Zombie Apocalypse guide -- only bit I didn't include were the firearms sections. I created a dummy weapon to test it called "Firepower." When I type Take, I pick it up. When I type Equip, I get this:

You equip your firepower.
Error running script: Cannot modify the contents of this list as it is defined by an inherited type. Clone it before attempting to modify.

I'm pretty sure my weapon is okay:

    <object name="firepower">
      <inherit name="editor_object" />
      <feature_startscript />
      <take />
      <drop type="boolean">false</drop>
      <look>Your weapon's traits will be based off the number of guns, melee weapons and shields you have in use on your team.  Please remember to expend 1 BULLET per round per shooter in your group.</look>
      <attr name="_initialise_" type="script">
        this.damage = "1"
        this.attack = 0
        this.critdesc = "The precision of your attacks rip into the #target# (#hits# hits)."
        this.attackdesc = "You desperately attack the #target# (#hits# hits)."
        this.missdesc = "You're careless, or too anxious, none of your hits land on the #target#."
      </attr>
    </object>
  </object>

My Equip Script is this:

  msg ("That's not something you can wield.")
}
else if (not HasAttribute(object, "damage")) {
  msg ("That's not something you can wield.")
}
else if (not object.parent = player) {
  msg ("You are not carrying it.")
}
else if (object = player.equipped) {
  msg ("You already have.")
}
else {
  if (player.equipped = null) {
    msg ("You equip your " + GetDisplayAlias(object) + ".")
  }
  else {
    msg ("You put away your " + GetDisplayAlias(player.equipped) + " and equip your " + GetDisplayAlias(object) + ".")
    list add (player.equipped.inventoryverbs, "Equip")
    list remove (player.equipped.inventoryverbs, "Unequip")
    player.equipped.listalias = Replace(player.equipped.listalias, " (equipped)", "")
  }
  player.equipped = object
  list add (object.inventoryverbs, "Unequip")
  list remove (object.inventoryverbs, "Equip")
  object.listalias = object.listalias + " (equipped)"
}

K.V.
26 Jan 2018, 22:42

These are probably the two lines that are throwing errors.

list add (object.inventoryverbs, "Unequip")
list remove (object.inventoryverbs, "Equip")

Change your initialisation script to this:

iverbs = Split("Look at;Drop;Equip",";")
this.inventoryverbs = iverbs
this.damage = "1"
this.attack = 0
this.critdesc = "The precision of your attacks rip into the #target# (#hits# hits)."
this.attackdesc = "You desperately attack the #target# (#hits# hits)."
this.missdesc = "You're careless, or too anxious, none of your hits land on the #target#."

Laraqua
28 Jan 2018, 07:38

Ahh, that worked. :)


K.V.
28 Jan 2018, 07:45

Sweet!


The Pixie
28 Jan 2018, 08:53

We do now have a list of common problems, and I have added this one too it:
http://docs.textadventures.co.uk/quest/problems.html