ID:143900
 
Code:
Draw()
if(src.Deck.len>0)
var/obj/Card/O = src.Deck[1]; src.Hand += O; src.Deck -= O
src.Summon = 0
O.owner = src
src.Show_Cards()
src.DeckUpdate()
CardNumUpdate(src)
for(var/obj/Card/D in src.Graveyard)
D.overlays=new/list()
D.dir=NORTH
for(var/obj/Card/C in src.Discard)
C.overlays=new/list()
C.dir=NORTH
else
End(src.Opponent,src)

I get this null.type error please help it will be appreciated.
Problem description:

Draw()
if(!length(src.Deck)){End(src.Opponent,src);return}
var/obj/Card/O = src.Deck[1]
src.Hand += O
src.Deck -= O
src.Summon = 0
O.owner = src
src.Show_Cards()
src.DeckUpdate()
CardNumUpdate(src)
if(length(src.Graveyard))
for(var/obj/Card/D in src.Graveyard)
D.overlays=new/list()
D.dir=NORTH
if(length(src.Discard))
for(var/obj/Card/C in src.Discard)
C.overlays=new/list()
C.dir=NORTH


That might do you better in the long run... eh to resolve the problem please supply the rest of the error. It should tell you which Line to go to and which DM.

-Dark
In response to Dark Emrald
I had src.Hand += new O.type and thats were the error was
~Grand~
In response to KillerGrand
Well that explains why it said type hmm... Yup there was nothing in the deck for it to grab therefore making it null. either that or am crazy O.o.

- Dark
KillerGrand wrote:
> Draw()
> if(src.Deck.len>0)
> var/obj/Card/O = src.Deck[1]; src.Hand += O; src.Deck -= O


While src.Deck-=O will work, you'd be safer using Deck.Cut(1,2). That will always be right no matter what's in the deck, whether it's unique objects (like here), or type paths.

Lummox JR
In response to Lummox JR
Thanks Lummox.
In response to Dark Emrald
Draw()
if(src.Deck.len>0)
var/obj/Card/O = src.Deck[1]; src.Hand +=new O.type; src.Deck.Cut(1,2)
src.Summon = 0
O.owner = src
src.Show_Cards()
src.DeckUpdate()
CardNumUpdate(src)
for(var/obj/Card/D in src.Graveyard)
D.overlays=new/list()
D.dir=NORTH
for(var/obj/Card/C in src.Discard)
C.overlays=new/list()
C.dir=NORTH
else
End(src.Opponent,src)

null.type error with this src.Hand+= new O.type.
Help Grand...