Choose a random instance
i = instance_count
i_id=floor(random(instance_count+1))//make sure we don't get ourselves
if i_id>instance_count//checks we haven't 'gone over the top'
{
i_id-=1//if we have then we shall correct it
}
return instance_id[i_id];
This is useful for things like chasing random objects just do a code like (do this in step event please!)
ii = id_random // replace with script name
move_towards_point(ii.x,ii.y,2)
It could be used for more things than that. Like in a Multiplayer game. Rather than using instance_id you would just use the array that keeps your players. You could send them random admin messagese ect....
Stay cool (not)
Millzyman
Labels: Advanced
