Is there a method to edit in real time, either a scenario or a character's abilities, without having to restart OpenBOR?
@Lantern Hi friend. Like @DCurrent said, levels are the best way to edit things without restarting the engine.Levels are different. Levels are reloaded every time they start, so if you make changes to stage layouts, you can leave the stage, come back, and those changes will reflect without needing to shut the engine down.
That all said, you can set up models to unload with a level, but this has its own side effects, and I'm having a brain freeze on remembering the switch. Tagging @Kratus, he could explain it better than I at the moment.
know model_name_A
know model_name_B
know model_name_C
load model_name_A 3
load model_name_B 3
load model_name_C 3
Wow, thank you so much for your help and advice @Kratus @DCurrent. No matter how inexperienced I am at programming, I'm glad to know that, in some ways, everything is easy to set up. There's something I forgot to ask. Is there a way to restart the level instantly, without having to press “ESC” and “End Level”?@Lantern Hi friend. Like @DCurrent said, levels are the best way to edit things without restarting the engine.
To make it, follow these steps:
1) In your models.txt, declare the desired models using "know", not "load"
2) In your level file, load the desired models using the "load" command followed by the flag 3. This way, as soon as you quit this level, these models are unloaded.
So, make the desired changes and then enter this same level again. Now these models will be reloaded with all the new changes.
For scripts, it will reload all the "inline" ones declared in the level file, but for other script events you will also need to restart the engine again (including the animation scripts, the "@cmd" ones).
As a suggestion, you can test the scripts with the inline method and then copy/paste the final version inside each event.
I recommend using this feature only during the development, or only if you really need to save a lot of memory. This is because it can have some side effects when used constantly in big/complex models, causing some random crashes.
load data/bgs/slums/p01.gif 3
load data/bgs/slums/p02.gif 3
load data/bgs/slums/p03.gif 3
@Lantern Yes, you can restart the same level by adding a keyscript.There's something I forgot to ask. Is there a way to restart the level instantly, without having to press “ESC” and “End Level”?
branch desired_name
z 248 303
file data/levels/level1.txt
branch desired_name
z 248 303
file data/levels/level2.txt
keyscript data/scripts/restart.c
void main()
{
if(playerkeys(0, 1, "attack4"))
{
jumptobranch("desired_name", 1);
}
}
No, you must use the model name, not the path. This is the same name you defined in the character file and declared in the models.txt.About “model_name_a 3”
where it says “model_name_a 3” or “model_name_b 3”, should I enter the URL where the sprite is located?
For example, if we're referring to the stage sprites:
load data/bgs/slums/p01.gif 3 load data/bgs/slums/p02.gif 3 load data/bgs/slums/p03.gif 3
load Axel 3
load Blaze 3
load Max 3
load Sammy 3
It worked. I've been editing characters smoothly, and I really find this method very convenient@Lantern Yes, you can restart the same level by adding a keyscript.
1) In your levels.txt file, add a branch name to the desired level. Do not put the "next" command after this level, otherwise the engine will show the "complete screen" instead.
And this level can't be the last one, you will need to have at least one more level after this one, otherwise the current set will end completely. You can even declare the same level twice, just change the branch name for both.
Code:branch desired_name z 248 303 file data/levels/level1.txt branch desired_name z 248 303 file data/levels/level2.txt
2) Inside your level file, put this code at the beginning.
Code:keyscript data/scripts/restart.c
3) Create a file named restart.c (you can change it later) and put the code below inside it. You can change the key name from "attack4" to any other if you want.
Code:void main() { if(playerkeys(0, 1, "attack4")) { jumptobranch("desired_name", 1); } }
4) Now as soon as you press this key, the current level will be restarted.
No, you must use the model name, not the path. This is the same name you defined in the character file and declared in the models.txt.
No problem, friend. Glad that the code worked fineIt worked. I've been editing characters smoothly, and I really find this method very convenient
Thank you so much for explaining the process in such detail. Sorry for not replying sooner, I've been really busy![]()