The LevelController command - 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: Help (https://colobot.info/forum/forumdisplay.php?fid=61) +---- Thread: The LevelController command (/showthread.php?tid=717) |
The LevelController command - melex750 - 01-29-2016 I'm working on some code battle levels with some randomized elements. I'm having a hard time with the LevelController command. Q: 1. Does it work? 2. Is it used for executing CBot code independent of any bot? 3. Is it available for custom levels/code battles? 4. Are there any restrictions as to how it is used? 5. What is the path it requires for scripts? RE: The LevelController command - krzys_h - 01-29-2016 1. Yes, but it's currently quite limited and forces you to handle EndMissionTake and AudioChange logic manually in code. Also, it has been unmaintained for a long while, so I'm actually not 100% sure it still works. Keep in mind this is heaivly work in progress and definetly will break compatibility between releases when we come back to implementing it. 2. It uses an invisible object - you can select it with "controller" cheat code if it exists in the level. After CBot refactoring it is planned to be independent of any object. 3. Yes 4. Existence of the level controller script currently disables EndMissionTake and AudioChange commands. You have to handle them manually in the code, as this script was meant to be a future replacement of these commands (but it's not going to fully replace them probably) 5. Like any other script path in CreateObject command - defaults to ai/ but can be overriden by using the %lvl%, %chap% or %cat% commands. As for writing custom implementation of the disabled commands, there is a slight problem as they do not support teams because the LevelController has not been maintained in a long time since it's so limited that nobody used it so far. The functions needed are: Code: void endmission(int result, float endDelay); // works only when LevelController exists and apparently is not highlighted in editor (like produce). result is one of: ResultNotEnded, ResultLost, ResultLostQuick, ResultWin. I'm pretty sure that if there is SpaceShip on the map it won't end immediately, but it'll unlock the takeoff button. endDelay works like EndMissionDelay in level file. You might also find those useful for LevelController (all of them operate on bitmasks): Code: int getbuild(); Code: // NOTE: The Build___ constants are for use only with getbuild() and setbuild() for MissionController, not for normal players RE: The LevelController command - melex750 - 01-29-2016 Thanks. RE: The LevelController command - melex750 - 01-30-2016 The LevelController (still called MissionController in parserparam.cpp) object is currently disabled in source. I temporarily revived it and confirmed that it works, but it is slightly broken. That thing is really crazy to drive, and parking it in shallow water results in constant splashing. RE: The LevelController command - krzys_h - 01-30-2016 I noticed that it got lost somewhere, I have actually commited a fix on the dev branch about the same time you posted this: https://github.com/colobot/colobot/commit/9749419b8715b74a11fb0646a533b680f857f080 |