//Scripted by Joe123
import "std.zh"
const int English = 5; //The size of the gap between German and English message strings
const int Deutsch = 0; //Just for the sake of complete-ness
const int CMB_AUTOWARP = 229; //Auto-warp A type combo
int Language; //This is where we'll store the message string modifier
//Our new message function, which will decide which language to use
void Message(int m){
Screen->Message(m+Language);
}
//We have this on the title screen to set the language for the rest of the game
ffc script SetLanguage{
void run(){
Waitframes(30);
while(true){
if(Link->InputLeft){
Language = Deutsch;
this->Data = CMB_AUTOWARP;
}
if(Link->InputRight){
Language = English;
this->Data = CMB_AUTOWARP;
}
Link->InputUp = false;
Link->InputDown = false;
Waitframe();
}
}
}
//NPC Script, by Pkmnfrk
ffc script NPC{
void run(int m, int changedirection, int distance){
int dx; int dy;
int ax; int ay;
int orig = this->Data;
if(distance == 0) distance = 40;
while(true){
dx = this->X-Link->X; ax = Abs(dx);
dy = this->Y-Link->Y; ay = Abs(dy);
if(changedirection != 0){
if(ax < distance && ay < distance){
if(ax <= ay){
if(dy >= 0) this->Data = orig;
else this->Data = orig+1;
}else{
if(dx >= 0) this->Data = orig+2;
else this->Data = orig+3;
}
}else this->Data = orig+(changedirection-1);
}
if(Link->InputA && ax < 24 && ay < 24 && Link->Z == 0){
Link->InputA = false;
Message(m);
do Waitframe();
while(Link->InputA)
}
Waitframe();
}
}
}
//Signposts, by Pkmnfrk
ffc script Signpost{
void run(int m){
while(true){
while(Link->X < this->X-8 || Link->X > this->X+24 || Link->Y < this->Y || Link->Y > this->Y+24
|| Link->Dir != DIR_UP || !Link->InputA || Link->Z != 0) Waitframe();
Link->InputA = false;
Message(m);
do Waitframe();
while(Link->InputA)
}
}
}
//Play a message on a screen, and add an item if we want
ffc script Message{
void run(int m, int itm){
Waitframes(4);
Message(m);
if(itm > 0){
item i = Screen->CreateItem(itm);
i->X = Link->X;
i->Y = Link->Y;
}
}
}
//Item pickup message script
item script PickupMessage{
void run(int m){
Message(m);
}
}
|