O Ilusionista
Captain 80K
Animated screens - the easy way
WARNING: This code only works from build 4344 and beyond.
Select screen version works from build 4331 and on.
Since long time ago, I wanted to use animated screens in OpenBOR, which doesn't support animated GIF for that. There was some ways to do it before (Volcanic made a code for that), but involves loading a sequence of sprites and I never found it too much user friendly.
After bothering some of the OpenBOR developers, finally its possible
With a great help from White Dragon (who patched the engine to remove this limit), here is the code (put it on your UPDATED.C under scripts folder)
Code updated - 2018-07-15
The result is this (The background is an entity)
http://www.youtube.com/watch?v=eYIqWH_Pr3A
The code also works in other screens, just need to change the "in_selectscreen" to one of the following options:
openborvariant list is outdated at the manual (I will fix it once I can), for more examples: http://www.chronocrash.com/forum/index.php?topic=1361.msg14998#msg14998
Edit: You need to set ALWAYSUPDATE 1 in scripts.txt.
fixed the typo, sorry.
WARNING: This code only works from build 4344 and beyond.
Select screen version works from build 4331 and on.
Since long time ago, I wanted to use animated screens in OpenBOR, which doesn't support animated GIF for that. There was some ways to do it before (Volcanic made a code for that), but involves loading a sequence of sprites and I never found it too much user friendly.
After bothering some of the OpenBOR developers, finally its possible
With a great help from White Dragon (who patched the engine to remove this limit), here is the code (put it on your UPDATED.C under scripts folder)
Code:
void main(){
if(openborvariant("in_titlescreen"))
{
void counter = getlocalvar("counter");
counter = setlocalvar("counter",0);
}
if(openborvariant("in_selectscreen"))
{
void counter = getlocalvar("counter");
void vSpawn;
while(counter!=1)
{
void subent;
loadmodel("bgfx"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "bgfx"); // define the entity to be spawn
setspawnentry("coords", 1,0,-1); // set the position of the entity
subent=spawn(); // spawn the entity
changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
}
}
The result is this (The background is an entity)
http://www.youtube.com/watch?v=eYIqWH_Pr3A
The code also works in other screens, just need to change the "in_selectscreen" to one of the following options:
- "in_cheat_options", - detects cheat options
- "in_control_options", - detects control options
- "in_gameoverscreen", - detects GAME OVER screen
- "in_halloffamescreen", detects HALL OF FAME screen
- "in_level", detects if you are playing a level
- "in_load_game", - detects LOAD GAME screen
- "in_menuscreen", - detects MENU screen
- "in_new_game", - detects NEW GAME screen
- "in_options", - detects OPTIONS screen
- "in_selectscreen", detects CHARACTER SELECT screen
- "in_showcomplete", detects COMPLETE SCREEN screen
- "in_sound_options", detects SOUND OPTIONS screen
- "in_start_game", detects GAME OVER screen
- "in_system_options", detects START GAME option
- "in_titlescreen", detects TITLE screen (the one with PRESS START)
- "in_enginecreditsscreen", detects if the engine's credits is displayed
- "in_video_options", detects VIDEO OPTIONS screen
openborvariant list is outdated at the manual (I will fix it once I can), for more examples: http://www.chronocrash.com/forum/index.php?topic=1361.msg14998#msg14998
Edit: You need to set ALWAYSUPDATE 1 in scripts.txt.
fixed the typo, sorry.