* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2017, 11:48:04 AM

Login with username, password and session length

[SCRIPT] Animated screens - the easy way.

  • 29 Replies
  • 1606 Views
*

Offline BeasTie

  • Hero Member
  • *****
  • 2424
Re: [SCRIPT] Animated screens - the easy way.
« Reply #15 on: November 24, 2016, 12:55:33 PM »
I was just showing an easy way even if it's not the best, not everyone is comfortable with script.

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #16 on: February 10, 2017, 10:22:38 AM »
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:

Quote



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.
Completed:

Support:     

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4612
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: [SCRIPT] Animated screens - the easy way.
« Reply #17 on: February 10, 2017, 10:26:48 AM »
Merso, check what I said about the OpenBor version...

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #18 on: February 10, 2017, 10:32:45 AM »
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.
Completed:

Support:     

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #19 on: February 10, 2017, 11:42:54 AM »
Using Build 4344:

Quote
**************** Done *****************

Can't compile script 'updated'

-____________-

hhhhmmmmmphhh
Completed:

Support:     

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4612
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: [SCRIPT] Animated screens - the easy way.
« Reply #20 on: February 10, 2017, 11:46:10 AM »
Merso, in my case, rain animation is very tall so I had to move the axis. Have you tried with any other entity?
By thw way, you need to KNOW the entity in models.txt first.

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #21 on: February 10, 2017, 11:53:54 AM »
Merso, in my case, rain animation is very tall so I had to move the axis. Have you tried with any other entity?
By thw way, you need to KNOW the entity in models.txt first.

Thank you for replying so quick. I have tried with two different entities, that work fine somewhere else in the game (so they're properly listed in models.txt, as "know"). I have also twaked the spawn coords to 0,0,0, and then back to how they're posted on this thread.
Right now the game doesn't even load. The program closes right after the OpenBor screen.
Completed:

Support:     

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4612
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: [SCRIPT] Animated screens - the easy way.
« Reply #22 on: February 10, 2017, 11:56:44 AM »
Do you have ALWAYSUPDATE 1 in scriots.txt?

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #23 on: February 10, 2017, 12:07:38 PM »
Do you have ALWAYSUPDATE 1 in scriots.txt?

Yes. Well, the file is called "script.txt" in singular. Just in case, I went ahead and created a duplicate of the file, and named it "scripts.txt", in plural. Still crashes.
Completed:

Support:     

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3010
  • Dark Dragon
Re: [SCRIPT] Animated screens - the easy way.
« Reply #24 on: February 10, 2017, 11:02:57 PM »
 Merso, look at this:
Quote
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
         }
   }

}

 You have two mains in this script. You need to use just one main and merge them into this:
Code: [Select]
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
         }
   }

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

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #25 on: February 15, 2017, 04:57:26 AM »
Thank you Bloodbane for cleaning up my script. It's still not working for me but I very much appreciate the effort.
Completed:

Support:     

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3010
  • Dark Dragon
Re: [SCRIPT] Animated screens - the easy way.
« Reply #26 on: February 16, 2017, 11:01:41 PM »
 Hmmm... what did the log say?

*

Offline Merso

  • Jr. Member
  • **
  • 23
Re: [SCRIPT] Animated screens - the easy way.
« Reply #27 on: February 17, 2017, 12:29:35 PM »
Hmmm... what did the log say?

It says...

Quote
Can't compile script 'updated'
Completed:

Support:     

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3010
  • Dark Dragon
Re: [SCRIPT] Animated screens - the easy way.
« Reply #28 on: February 19, 2017, 06:08:44 AM »
 Ummm... there's another error message somewhere above that line, try finding it and post it here

 OTOH I've tried replicating this bug but there's no crash and at same time, nothing is spawned in select screen either  ???

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 4612
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: [SCRIPT] Animated screens - the easy way.
« Reply #29 on: February 19, 2017, 07:02:39 AM »
That is strange. The code works here.

 

Recent

Members
Stats
  • Total Posts: 44536
  • Total Topics: 3039
  • Online Today: 38
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 2
Guests: 23
Total: 25