Colobot Forum - International Colobot Community

Full Version: help needed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi there,
could somebody help me with this game before I broke my keyboard to pieces?
how to find empty space on the SpaceShip (or on any other platform) for dropping?
do I need to create some kind of table that contains points for empty space?
my stupid WingedGrabber never find empty space for delivering the goods.
calling would be something like :
extern void object:: Test(){ for(int i=0 ;i<4;i++){RetreiveObjects(TitaniumOre,SpaceShip);} }
first loop is ok but next one....grrrrr!!!!!

Code:
public void object::RetreiveObjects(int cat,int retreiveTo){
object item=radar(cat,0,360,50,1000);

if (this.energyCell==null){message(this.category + " reports : waiting for PowerCell");}

while(this.energyCell==null)
{wait(0.2);
}

move(-3);

message(this.category +" reports: 'object found'",DisplayInfo);
errmode(0);

while(goto(item.position)!=000)
{

wait(0.2);

message(this.category +" reports: waiting for space to clear ",DisplayInfo);
}

grab();

item=radar(retreiveTo);

message(this.category +" reports: retreiving object to the ship ",DisplayInfo);

while(goto(item.position)!=000)
{

wait(0.2);

message(this.category +" reports:waiting for landing space to clear ",DisplayInfo);
item=radar(retreiveTo);
}
   
if(drop(InFront)!=000)
{

message(this.category +" reports: impossible to drop here...moving on",DisplayInfo);
wait(0.2);

item=radar(retreiveTo);

turn(90);

move(2);

drop(InFront);
};

message(this.category +" reports: object retreived  ",DisplayInfo);
}
If you want to find empty space, use space(), more info on satcom.
You can do things such as
errmode(0);
goto(space(targetPosition));
while(drop()!=0){
   goto(space(position));
}
errmode(1);
It should find empty space.


In case of platforms, such as Converters,

Quote:"do I need to create some kind of table that contains points for empty space?"


I noticed that people do the table that contains occupied points, shared between bots, and checks if point does not exist in table when needed. However, you can do the table with empty places, it just looks like not straight solution for me Tongue