I want to make it so certain items go into a different slot, like weapons in a weapon inventory, armor in an armor inventory. I made a Pouch for weapons, Here's the runtime error I get,
runtime error: type mismatch
proc name: Get (/obj/Knife/verb/Get)
usr: (/mob/Guy)
src: Knife (/obj/Knife)
call stack:
Knife (/obj/Knife): Get()
Here's the coding.
obj/Knife
verb
Get()
set src in oview(1)
usr.Pouch += new/obj/Knife
del(src)
I can get one knife just fine, but when I try to get another one, that runtime error will pop up. If I change Pouch to contents, that error will not pop up. Why is this happening?
ID:261264
Nov 19 2001, 6:44 pm
|
|
Nov 19 2001, 6:48 pm
|
|
Because you can only add new objs into lists mainly contents.
|
try this:
mob/var weapons armor mob Stat() statpanel("Weapons") stat(weapons) statpanel("Armor") stat(armor) obj knife verb Get() set src in view(1) usr.weapons += /obj/knife obj armor verb Get() set src in view(1) usr.armor += /obj/armor Try something like that... -Rcet |
In response to Rcet
|
|
Thank you, but the same error pops up.
|
In response to The Wizard of How
|
|
you must make sure to declare the Pouch as a list. There are several ways to do it, but I prefer this one:
var/list/Pouch = list() // create an empty list called Pouch |