....Mark I.
What it does:
-Warps Link to the exact Dmap screen co-ordinates on the following Dmap when conditions are met. Those conditions are currently set as an encounter rate, and when Link walks around for more than the given encounter rate time, he enters a seperate battle screen with whatever enemies you set on a screen to screen basis. Once the battle is won, he will be warped to the EXACT spot he left on the "world map" or whatever you want to call it. Can also play an intro and victory message string, and make the screen wavy as a battle intro effect. (but Screen->Wavy is still buggy I think)
Code:
//D0-random encounter rate(random) in frames
//D1-random encounter rate(fixed) in frames
//D2-message string (optional)
//
//D0 and D1 are added together to determine encounter rate.
// these values only decrease while Link is walking on screen.
//
// message(optional) will play the message before battle
// and the following message string after defeating the enemies.
//...you currently cannot run from battle!
ffc script rpg_maker{
void run(int r, int time, int m){
int random = Rand(r) + time;
int lx = 0;
int ly = 0;
float map;
float screen;
bool battle = false;
bool warped = false;
bool initialize = false;
int enemy_number;
while(true){
if(battle == false){
if(Link->InputLeft || Link->InputRight || Link->InputDown || Link->InputUp){
random--;
}
if(random == 0){
random = Rand(r) + time;
lx = Link->X;
ly = Link->Y;
map = Game->GetCurDMap();
screen = Game->GetCurDMapScreen();
battle = true;
}
}
if(battle){
if(warped == false){
if(m>0){Screen->Message(m);Waitframes(4);}
//Screen->Wavy = 10;
Link->PitWarp(map + 1,screen);
warped = true;
}
}
if(warped){
if(initialize == false){
Link->X = 120; Link->Y = 80;
Waitframes(4);
initialize = true;
}
}
if(initialize){
enemy_number = Screen->NumNPCs();
while(enemy_number > 0){
enemy_number--;
Waitframe();
}
enemy_number = Screen->NumNPCs();
if(enemy_number == 0){
Waitframes(30);
if(m>0) Screen->Message(m+1);
Waitframes(30);
//Screen->Wavy = 10;
Link->PitWarp(map, screen);
Link->X = lx;
Link->Y = ly;
battle = false;
warped = false;
initialize = false;
}
}
Waitframe();
}
}
}
Setting up battle screens:
Simple. Let's say Dmap 12 is a "world map" type map. Set the ffc for "carry over" on Dmap 12 starting screens, then all combat will occur on Dmap 13.
So if you are on Dmap 12 Screen 6,7, then you will be warped to Dmap 13 screen 6,7... Dmap offsets untested however.
Now there can be plausible FF like quests made. And this idea is easily adaptable for other stuff too, like fixed encounters, boss battles, etc.
So, who will be the first then?...