When the child is born I get its id like so:
child = instance_create(x,y,object_index)
Afterwards it adds it to the mother's memory which is held in a string:
if species = maternal and child != noone
{
maternalstring = string_insert(string(child.id),maternalstring,0)
}
Why is it throwing an unknown variable id, when I just made the child and got its id, and checked again just to make sure that child != noone?
Just in case it was being destroyed in the same instant I put it above the child bearing code and told it not to add the id unless told to by the child bearing code, so that it would run next step.
like so:
if species = maternal and child != noone and childcheck = true
{
maternalstring = string_insert(string(child.id),maternalstring,0)
childcheck = false
}
//checking if it should make a child and stuff here.
{
child = instance_create(x,y,object_index)
childcheck = true
}
Then I decided to do something odd just in case and came up with this:
if childcheck = true
{
with (child)
{
if variable_local_exists("id")
{
other.childcheck = true
}
else
{
other.childcheck = false
}
}
}
if species = maternal and child != noone and childcheck = true
{
maternalstring = string_insert(string(child.id),maternalstring,0)
childcheck = false
}
//checking if it should make a child and stuff here.
{
child = instance_create(x,y,object_index)
childcheck = true
}
It still randomly throws the unknown variable id error though, how do I get it to only try to add its id to the string if it actually has an id?There seems to be no rhyme nor reason to when it appears and when it does not.
Situations in which it will both appear, or not appear according to chance:
First contact
First contact after children have been born
A random contact when no children have been born
A random contact after children have been born.
A random contact after children have been born and contacts had already happened previously where they had not been born.
A random contact after children had been born with contacts between when children were not born.
I have no idea why it is appearing, and why it is appearing when it is.
Edited by Elouj, 04 April 2012 - 05:09 PM.











