07-09-2017, 08:06 AM
Hi,
I have a problem, I'm stuck on the first mission of the second level of the game, specifically I have problems with one particular task, which is to make my winged bot to find 4 pieces of titaium ore, it only finds 1 piece of the ore and then proceeds to find the the same piece of ore instead of going for another one.
So, the question is, how to make the bot to find all 4 pieces needed to complete the task (through class system by adding to the found object a specific characteristic or something)
Here is the code I wrote.
P.S sorry for bad english.
I have a problem, I'm stuck on the first mission of the second level of the game, specifically I have problems with one particular task, which is to make my winged bot to find 4 pieces of titaium ore, it only finds 1 piece of the ore and then proceeds to find the the same piece of ore instead of going for another one.
So, the question is, how to make the bot to find all 4 pieces needed to complete the task (through class system by adding to the found object a specific characteristic or something)
Here is the code I wrote.
Code:
extern void object::New()
{
object rdr;
int counter = 0;
float range = 0;
do
{
rdr = radar(TitaniumOre, 0, 360, range);
if (rdr != null)
{
goto (rdr.position);
grab ();
object home;
home = radar(SpaceShip);
goto (space (home.position));
drop ();
counter = counter + 1;
message(counter);
}
else
{
message ("Titanium not found");
goto(rdr.position);
rdr = radar(TitaniumOre, 0, 360, range++);
}
}
while (counter < 5);
}