Screen shake
#1
Posted 29 December 2012 - 08:42 PM
#2
Posted 29 December 2012 - 08:49 PM
I'm probably going to get this wrong but let's see if this works.
import "std.zh"
ffc script onEntryScreenShakeThenMessage
{
void run(int m, int shake1, int shake2, int quakelength)
{
Waitframe(shake1);
Screen->Quake(quakelength);
Waitframe(shake2);
Game->Message(m);
}
}
Really hope that works. Didn't test it or anything.
Oh, uh, Import as usual, assign to FFC script slot, assign script to FFC, place FFC in room with invisible combo.
D0 = The screen message to play.
D1 = Frames to wait before the quake.
D2 = Frames to wait after the quake begins.
D3 = The length in frames that the quake will last.
The last two D#s aren't directly related. According to the Screen Shake entry on the Wiki, the quake lasts for a decreasing number of frames.
#3
Posted 29 December 2012 - 08:59 PM
EDIT: There was a compile problem.
ffc script onEntryScreenShakeThenMessage
{
void run(int m, int shake1, int shake2, int quakelength)
{
Waitframe(shake1);
Screen->Quake(quakelength);
Waitframe(shake2);
Game->Message(m);
}
}
I believe it's referring to line 5. I tried fixing it my self because it sounded simple, but I know nothing of scripts
Edited by Keiichi123, 29 December 2012 - 09:20 PM.
#4
Posted 29 December 2012 - 09:22 PM
ffc script onEntryScreenShakeThenMessage{
void run(int m, int shake1, int shake2, int quakelength){
if(Screen->D[0] != 1){
Waitframes(shake1);
Screen->Quake(quakelength);
Waitframes(shake2);
Game->Message(m);
Screen->D[0]=1;
}
}
}
And lastly, since this is really more of a script request, I'm moving it to the appropriate forum.
#5
Posted 29 December 2012 - 09:26 PM
So, just for the sake of information, "Screen->D[#]" does not relate to the items in void run(_____){ ? Because I'm sure you can see the similarity between "D0 is the string, D1 is the number of frames...." and "Screen->D[0]=1;"
#6
Posted 29 December 2012 - 09:30 PM
Again, on line 5. I really wish I knew how to script so I wouldn't have to keep asking for help
#8
Posted 29 December 2012 - 09:43 PM
Both definitely work. Waitframe() is for a single frame where Waitframes(int frames) is the number you specify in the brackets.
Fixed code, by the way -
ffc script onEntryScreenShakeThenMessage{
void run(int m, int shake1, int shake2, int quakelength){
if(Screen->D[0] != 1){
Waitframes(shake1);
Screen->Quake = quakelength;
Waitframes(shake2);
Screen->Message(m);
Screen->D[0]=1;
}
}
}
So the two problems were...
Screen->Quake is a variable, not a function. You'd set it like a variable as opposed to inputting a parameter for it. Game->Message is actually supposed to be Screen->Message.
Just for future reference.
#9
Posted 29 December 2012 - 09:43 PM
ffc script onEntryScreenShakeThenMessage{
void run(int m, int shake1, int shake2, int quakelength){
if(Screen->D[0] != 1){
Waitframes(shake1);
Screen->Quake = quakelength;
Waitframes(shake2);
Screen->Message(m);
Screen->D[0]=1;
}
}
}
The format is Screen->Quake = time, not Screen->Quake(time).
Well yeah, there are both. Waitframe(); makes the game wait exactly one frame, whereas you use Waitframes(time); if you want it to wait longer.
No, it has nothing to do with void run();. Each screen has a certain amount of built in variables (I forget how many now though). You can set them with Screen->D[#] = x; Once they're set, they're saved for that screen forever, until you set them to something else. So the if loop I have checks to see if the first variable, D[0], is 1. Because it hasn't been set yet, it won't be. The script does its thing, then sets the variable to 1. That way, the next time you walk onto the screen, the script will check, see that the variable is set to 1, and won't run the rest of the script again.
Edit: Dangit Dan, I was first. ):<
#10
Posted 29 December 2012 - 09:47 PM
/mebeingasmartass
*Runs*
#11
Posted 29 December 2012 - 09:50 PM
#12
Posted 29 December 2012 - 10:16 PM
#13
Posted 29 December 2012 - 10:42 PM
#14
Posted 29 December 2012 - 10:57 PM
Thanks a lot guys!
#15
Posted 30 December 2012 - 05:57 AM
Totally aside, but is there any way to pass something from an FFC to a Global, so an FFC's D[#] on another screen can benefit from the setting of a D[#] on the current screen? Because what if this earthquake event changes parts of the world as well?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users