Ok ive been tryin to figure out how to create a new instance of an item in a list and add it to the players contents for about 4 hours now ANY help would be great.
Heres my verb
AddSpellToPlayer(N as num)
set category = "Creator"
var/obj/S = usr.AvailableSpells[N]
var/obj/O = new S
O.Move(usr)
usr << "[O] has been added to your inventory"
and heres the error
runtime error: Cannot create objects of type /obj/Spell/TestFireSpell.
proc name: AddSpellToPlayer (/mob/GM/verb/AddSpellToPlayer)
usr: Aridale (/mob)
src: Aridale (/mob)
call stack:
Aridale (/mob): AddSpellToPlayer(1)
ID:174195
Sep 19 2003, 10:12 pm
|
|
In response to Crispy
|
|
I did try that it didnt work either and yeah the path is correct. I got it workin now. I think the problem lies somewhere in the contents of AvailableSpells see its really an objs .contents If you read my other post yesterday about getting a variable from an obj in a list youll know what Im talkin about. Basically the only way to get the vars from an obj in the list was to make the list an actual .contents of an obj that put the records into the list as actual objs not refrences to /obj/blah blah likes = typesof(/obj/blah blah) does. So basically when you login it makes an item you never see that belongs to your character and adds a copy of every spell Ive made to it.
How I finally got it to add the spells about 3 MORE hours after I posted this lastnight was to create a seperate list just using = typesof to have an identical obj ref list of my actual obj list AvailableSpells. Since the list is the same then any record index is the same in both so record 1 in AvailableSpells is Test Fire Spell and record 1 in my new list is /obj/Spell/TestFireSpell using the new list to create an obj and give it to the player worked flawless /shrugs and throws his hands up in the air. Who woulda guessed. But I do thank all you guys for your help. I try not to ask questions much cause I wanna do it mahself that way I learn alot more as I go but somethings I just cant figure out without botherin you guys with my long winded posts =) |
Also make sure that /obj/Spell/TestFireSpell is the correct type path. (Remember that uppercase/lowercase is important.)