• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Animated screens - the easy way.

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:
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
			}

	}
}
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:

  • "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.
 
Ah so you are using entities to create animated screen. That's different from my method which uses drawsprite
Now we have two methods to animate screen :D
 
I'm having a problem with this script, it only works once. Try having something spawn on select screen, then exit to main menu and go back to the select screen again. It won't spawn again.

Also a small mistake in your script:
Code:
contadors = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
needs to be:
Code:
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made


 
Sorry for the error, contadors is the variable I use but since its Portuguese I decided to change to counter.

But the script works perfectly. I use it on my mod.
 
I downloaded your Avengers mod from gamejolt to examine but it doesn't seem to have it. What would cause it to only work the first time you view the screen?
 
Looks I forgot something: you have to set the counter variable to zero in main screen. I am on my phone right now  but here is:

if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
{ counter = setlocalvar("counter",0);
}
 
great script, but it was actually already possible, I had animated select screen for ages, all you do is spawn a panel entity from first player.

Animation2.gif
 
I love when people does this - when a question is made over and over and nobody reply it. Then, when someone make a great effort to make it, magically someone already had the answer and never told to anybody.

Knowledge was made to be shared, and its dead if you don't .

I know that was possible to use subentity or knife, but the first one got removed when you choose other character or it will be spawn over and over.

Plus, this method can make you spawn in any screen you want to.

But thanks for your cooperation.
 
Actually I have shared this before, if I'd seen this i would of answered.  You actually have access to my mod already.  I have plenty of unanswered questions here, go figure...
 
I have no intention in fighting. Neither I am claiming I (or white dragon) had reinvented the wheel.

I just want to help people.
Thanks
 
I think O 'Ilusionista is doing a good job. Above all I hope they go ahead with the update of the documentation which is essential!
 
I have been unable to make this work on my Power Rangers mod. I have tried with two differen engines (3984 and 4183). The only thing I changed from the code was "rain" with a panel entity I already had called "fadeoutwhite". Here's how mu UPDATED.C looks like:

void zoom()
{
  void vscreen = openborvariant("vscreen");
  int maxz=openborvariant("PLAYER_MAX_Z")+1000;
  int zoom_value=getglobalvar("zoomvalue");
  int zoom_x=getglobalvar("zoomx");
  int zoom_y=getglobalvar("zoomy");
  void ent=getglobalvar("zoomentity");
  int px=getentityproperty(ent,"x") +  zoom_x - openborvariant("xpos");
  int py=getentityproperty(ent,"z") + zoom_y - openborvariant("ypos") - getentityproperty(ent,"a");
  void zoom_scr = getglobalvar("zoomscreen");
  if(!zoom_scr){
      zoom_scr = allocscreen(openborvariant("hResolution"),openborvariant("vResolution"));
      setglobalvar("zoomscreen",zoom_scr);
  }
  clearscreen(zoom_scr);

  //draw what we need
  drawspriteq(zoom_scr,0,openborconstant("MIN_INT"),maxz,0,0);
  //setup drawMethod
  changedrawmethod(NULL(),"reset",1);
  changedrawmethod(NULL(),"enabled",1);
  changedrawmethod(NULL(),"scalex",zoom_value);
  changedrawmethod(NULL(),"scaley",zoom_value);
  changedrawmethod(NULL(),"centerx",px);
  changedrawmethod(NULL(),"centery",py);
  //Draw the resized customized screen to main screen.
  drawscreen(zoom_scr,px,py, maxz+1);
  changedrawmethod(NULL(),"enabled", 0);
  drawspriteq(vscreen, 0, maxz+1,maxz+1, 0, 0);
  drawspriteq(vscreen, 0, maxz+2,openborconstant("MAX_INT"), 0, 0);
  clearspriteq();
}


void main(){
  if(getglobalvar("zoomentity"))
  {
      zoom();       
  }
}





void main(){
if(openborvariant("in_menuscreen")) // Check if the game is in menu screen
  {  counter = setlocalvar("counter",0);
}

if(openborvariant("in_selectscreen")) // Check if the game is in select screen
{
 
void counter= getlocalvar("counter");  // Set a variable to trigger the spawn on and off
while(counter!=1) // Check the variable to avoid double spawn
{
void subent;
loadmodel("fadeoutwhite"); // name of the entity to be loaded
clearspawnentry(); // clean the spawn entry
setspawnentry("name", "fadeoutwhite"); // define the entity to be spawn
setspawnentry("coords", 50,50,0); // set the position of the entity
subent=spawn();  //  spawn the entity
changeentityproperty(subent, "position", 50,50,0); //for safe, set again the position
counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
}
}

}

BeasTie, I tried spawning a panel entity during player 1's "waiting" animation, but it didn't work. How did you do it? I can't find your DOTT mod.
 
O Ilusionista said:
Merso, check what I said about the OpenBor version...

My apologies - I was sure I had the most current engine. The one I got was on the top of the list in the downloads section. I'll check again. Thanks.
 
Back
Top Bottom