ID:272726
 
(O.o.O. - Order of Operations)

Okay here's my little dilemma. In the Create_Clone verb, I have it calling new(), then right after it's setting the new mob's "owner" >_>. Now, in the mob/Clones/Clone, I have the New() function. Is there a way set the new mob's owner BEFORE the New() function is triggered? Because I'm getting the runtime error saying it can't read null.icon. Obviously it's because of order of operation issue. How would I fix that problem?

mob/proc
Create_Clone(path,n)
while(n>0)
--n
var/mob/Clones/Clone = new path(loc)
Clone.Owner = src
sleep(10)

mob/Player/verb
Sand_Clone()
if(!failCheck()) return
Create_Clone(/mob/Clones/Clone,CloneSkill)

mob/Clones/Clone
density = 1
New()
..()
var/mob/O = Owner
icon = O.icon
flick("Sand Clone",src)


runtime error: Cannot read null.icon
proc name: New (/mob/Clones/Clone/New)
usr: Clone (/mob/Clones/Clone)
src: Clone (/mob/Clones/Clone)
call stack:
Clone (/mob/Clones/Clone): New(Grass1 (1,1,1) (/turf/Terrains/Grass1))
Mizukouken Ketsu (/mob/Player): Create Clone(/mob/Clones/Clone (/mob/Clones/Clone), 1)
Mizukouken Ketsu (/mob/Player): Clone()
You could pass src as an argument when creating the clone.
<dm>
var/mob/Clones/Clone = new path(loc,src)
//...
mob/Clones/Clone
New(loc,owner)
..()
Owner=owner
//...
In response to Kaiochao (#1)
I hate it when I know what's wrong with my coding, but I don't know how to fix it :)

Thanks Kaiochao ^-^