Valerie
Member
Hey folks!
So I'm pretty stuck on an issue. I have a game where an object known as a "civ" generates a random name. What I'm trying to do is to have an instance of that civ object to be able to recognize the id of a civ that is nearby, so they can interact. However, there is no instance_nearest function that excludes itself, meaning the civs constantly think the closest civ to them is itself.
Here is my Step Event:
and here is my Draw Event, where I want it to draw the name of the instance of civ that is nearest to itself
When I do this, the game returns "civ_seen not set before reading it."
Any help regarding this would be greatly appreciated! This whole game is based around instances of the civ object interacting with each other, so if they can't call those specific instance ids and manipulate them I'm pretty much sunk. Thank you!
So I'm pretty stuck on an issue. I have a game where an object known as a "civ" generates a random name. What I'm trying to do is to have an instance of that civ object to be able to recognize the id of a civ that is nearby, so they can interact. However, there is no instance_nearest function that excludes itself, meaning the civs constantly think the closest civ to them is itself.
Here is my Step Event:
Code:
var _x = x;
x -= 10000000;
var civ_seen = instance_nearest(_x, y, obj_civ_test);
x = _x;
if civ_seen != id && civ_seen != noone
{
// You found an instance!
return civ_seen;
}
else
return noone;
Code:
draw_text(x-20, y-50, string(civ_seen.name));
Any help regarding this would be greatly appreciated! This whole game is based around instances of the civ object interacting with each other, so if they can't call those specific instance ids and manipulate them I'm pretty much sunk. Thank you!