Falling on land when over trees - how to prevent? - Printable Version +- Colobot Forum - International Colobot Community (https://colobot.info/forum) +-- Forum: [Archive] New forum (2015-2019) (https://colobot.info/forum/forumdisplay.php?fid=76) +--- Forum: Colobot: Gold Edition Basics (https://colobot.info/forum/forumdisplay.php?fid=58) +---- Forum: General (https://colobot.info/forum/forumdisplay.php?fid=59) +---- Thread: Falling on land when over trees - how to prevent? (/showthread.php?tid=742) Falling on land when over trees - how to prevent? - Rinoldo - 03-17-2016 In the 3-d mission "Tropica" in the 3-d part where we need to destory AlienAnts my flying shooter falls on the land when it flies over the trees. It's seems to be a bag because when I fly over those trees manually (with buttons w,a,s,d) the flying shooter doesn't fall and everything is ok. I tried to programm bot to fly higher - 20 meters - but nothing changes. Please advice how to solve this problem! RE: Falling on land when over trees - how to prevent? - Rinoldo - 03-17-2016 Here is my full code for flying Shooter: Code:```extern void object::HuntAnt() { object ant, power; power = radar(PowerStation); point pos, pos2; jet(0.2); aim(-40); while(true) { while(true) { while(radar(AlienAnt, 0, 360, 0, 20) == null) { ant=radar(AlienAnt); turn(direction(ant.position)); motor(1,1); /*errmode(0); int err; err = motor(1,1); if ( err != 0 ) { motor(-1, -1); jet(1); wait(0.5); }*/ jet(0); if (position.z - topo(position) < 8)    jet(1); if(position.z - topo(position) > 9)    jet(-0.1); wait(0.1); pos = position; wait(0.1); pos2 = position; if (pos == pos2) { move(-3); turn(90); move(3); } } fire(1); if (energyCell.energyLevel < 0.3) break; } errmode(0); int err; err = goto(power.position); if ( err != 0 ) { motor(-1, -1); jet(1); wait(0.5); } while (energyCell.energyLevel < 1)    wait(1); } }``` RE: Falling on land when over trees - how to prevent? - tomaszkax86 - 03-17-2016 Do you mean those trees? Those are graviplants. They make you unable to fly inside green spherical gas cloud they create. From what I know, you can't fly above them. RE: Falling on land when over trees - how to prevent? - RaptorParkowsky - 03-17-2016 Oh, you mean the bot just falling because of gravi-plant? Well, it's not a bug, it's a naturally growing on Tropica planet feature . Every flying bot or astronaut will fall or fly very low to the ground while's under gravi-plant's dome. EDIT: Shoot! @tomaszkax86 was faster than me! Until next time... RE: Falling on land when over trees - how to prevent? - Simbax - 03-17-2016 Yeah, I was thinking it would be graviplants, but the description of the "bug" is too odd and ambigous to be sure. I can't believe a person could not know about graviplants, especially that this is the third mission on Tropica and there is no posssibility someone would not notice graviplants in the first missions. EDIT: you got to be kidding me... RE: Falling on land when over trees - how to prevent? - krzys_h - 03-17-2016 (03-17-2016, 09:32 AM)Rinoldo Wrote: It's seems to be a bag because when I fly over those trees manually (with buttons w,a,s,d) the flying shooter doesn't fall and everything is ok.If this is true, then it is indeed a bug. You are not supposed to be able to fly at all inside graviplants. RE: Falling on land when over trees - how to prevent? - Rinoldo - 03-17-2016 (03-17-2016, 04:23 PM)krzys_h Wrote: If this is true, then it is indeed a bug. You are not supposed to be able to fly at all inside graviplants. After reading all posts above I tried once more to fly manually over those trees, more thoroughly. And yes you'r right I fell just like flying shooter did!   So it's not bug but damned graviplants. This makes the whole mission more complicated so my next question is, how to stay away from them? How I can tell by bot, that it's too dangerous to come near to graviplant less then n metres? Or may be it is not effective way to kill the ants? How did you people make this mission? RE: Falling on land when over trees - how to prevent? - tomangelo - 03-17-2016 Probably it will require some more complex algorithm instead of simple goto() method, with detecting where these plants are located and avoiding these places. To be honest, I've always do this mission manually, I weren't so good then in all these programming things. RE: Falling on land when over trees - how to prevent? - krzys_h - 03-17-2016 The original missions weren't really well designed for doing them with programming only. This is one of the things we are aiming to fix with Gold Edition, although mission refactoring is delayed until a later stage of development. RE: Falling on land when over trees - how to prevent? - Rinoldo - 03-18-2016 (03-17-2016, 04:08 PM)Simbax Wrote: Yeah, I was thinking it would be graviplants, but the description of the "bug" is too odd and ambigous to be sure. I can't believe a person could not know about graviplants, especially that this is the third mission on Tropica and there is no posssibility someone would not notice graviplants in the first missions. EDIT: you got to be kidding me... I didn't mentioned that I played the first missions of Tropica about half of year ago. If i wrote code in that moment may be I wouldn't be suprised by this feature of graviplants. Some details fades away from memory as times goes by. The first thing I remember about those green bubbles is that they may kill you if you step into them. (03-17-2016, 08:11 PM)krzys_h Wrote: The original missions weren't really well designed for doing them with programming only. This is one of the things we are aiming to fix with Gold Edition, although mission refactoring is delayed until a later stage of development. I see. I tried to use WheeledShooter but there are some other inconveniences, such as attemts of Wheeled shooter to fire through the graviplants, or the too big difference in vertical axis of the gun and ant because of hilly land, or sometimes the bot hits a graviplant, tries to drive round it meanwhile AlienAnt destroys the shooter. May be these problems are solvable, in this case I'll be grateful if someone point out ways to settle them. Of course I always can pass this mission manually, but I'd like to do the last attempt to pass it by programming. RE: Falling on land when over trees - how to prevent? - melex750 - 03-18-2016 Code:```int Graviplant = 715;      object obj = radar(Graviplant);      if (distance2d(this.position, obj.position) <= 32) {     message("very close to graviplant"); }``` RE: Falling on land when over trees - how to prevent? - krzys_h - 03-18-2016 @melex750 This is a pretty nice workaround right there I completly forgot you can use radar() with objects that normally don't have a category defined. RE: Falling on land when over trees - how to prevent? - Rinoldo - 03-18-2016 (03-18-2016, 07:38 AM)melex750 Wrote: Code:```int Graviplant = 715;      object obj = radar(Graviplant);      if (distance2d(this.position, obj.position) <= 32) {     message("very close to graviplant"); }``` I'm not sure that I uderstand this code quite clear. I tried to change meaning of int Graviplant. It works only within 710-715. Why is that? RE: Falling on land when over trees - how to prevent? - Simbax - 03-18-2016 Because https://github.com/colobot/colobot/blob/master/src/object/object_type.h#L172-L177 RE: Falling on land when over trees - how to prevent? - krzys_h - 03-18-2016 Keep in mind these numbers are not officialy part of CBot interface, and thus they may change in the future. We tend to avoid changing them though. PS. 715 is Graviplant, 710-714 is other plants with no graviplant effect RE: Falling on land when over trees - how to prevent? - Rinoldo - 03-18-2016 Thank you everybody for help!