I fulfilled part 1:
CODE
int round(float f){
if(f<0.5&&f>-0.5){
return 0;
}else{
int diff=f;
int num=0;
if(diff>0){
while(diff>1){
diff-=1;
num+=1;
}
if(diff<0.5){
return num;
}else{
return num+1;
}
}else{
while(diff<-1){
diff+=1;
num-=1;
}
if(diff>-0.5){
return num;
}else{
return num-1;
}
}
}
}
const float Lspeedpercent=150;
global script onstart {
void run() {
float Lspeed=Lspeedpercent/100;
int x=Link->X;
int y=Link->Y;
int curmap=-1;
int curscreen=-1;
bool pressdL=false;
int downtime=-1;
Game->Counter[CR_SCRIPT10]=1;
//one time things go here
while(true) {
if(Game->Counter[CR_SCRIPT10]==1){ //make input false when item wasnt lifted yet
Link->InputL=false;
}
if(curscreen!=Game->GetCurScreen()&&curmap==Game->GetCurMap()){
Waitframes(10);
curscreen=Game->GetCurScreen();
x=Link->X;
y=Link->Y;
}
if(curmap!=Game->GetCurMap()&&curscreen==Game->GetCurScreen()){
Waitframes(10);
curmap=Game->GetCurMap();
x=Link->X;
y=Link->Y;
}
if(curmap!=Game->GetCurMap()&&curscreen!=Game->GetCurScreen()){
Waitframes(10);
curscreen=Game->GetCurScreen();
curmap=Game->GetCurMap();
x=Link->X;
y=Link->Y;
}
if(Link->InputL&&downtime<0){ //checkj if L pressed if so toggle between running and not running state
pressdL=!pressdL;
downtime=10;
}
if(downtime>-1){ // the downtime makes sure there are no glitches by the toggle button like toggle between running and not running too fast
downtime-=1;
}
if(pressdL){ //Test if L was pressed
Link->X+=round((Lspeed-1)*(Link->X-x));
Link->Y+=round((Lspeed-1)*(Link->Y-y));
}
x=Link->X;
y=Link->Y;
Waitframe();
}
}
//functions go here
}
now the L button wont work unless a constant i set is changed.
To go with it here is a script that changes the constant once you pickup an item. so you can run once you pick up the item you chose for that.
CODE
item script activateL{
void run(int m){
Game->Counter[CR_SCRIPT10]=2;
}
}
Last but not least a demoquest showing that it all works out fine:
http://www.mediafire...atijperh9p55645 If you want i could fulfil part 2 by disabling A button and B button while link is in running state. But i am not sure if thats exactly what you want. would be only adding 2 lines to the script.
The script would then change to:
CODE
int round(float f){
if(f<0.5&&f>-0.5){
return 0;
}else{
int diff=f;
int num=0;
if(diff>0){
while(diff>1){
diff-=1;
num+=1;
}
if(diff<0.5){
return num;
}else{
return num+1;
}
}else{
while(diff<-1){
diff+=1;
num-=1;
}
if(diff>-0.5){
return num;
}else{
return num-1;
}
}
}
}
const float Lspeedpercent=150;
global script onstart {
void run() {
float Lspeed=Lspeedpercent/100;
int x=Link->X;
int y=Link->Y;
int curmap=-1;
int curscreen=-1;
bool pressdL=false;
int downtime=-1;
Game->Counter[CR_SCRIPT10]=1;
//one time things go here
while(true) {
if(Game->Counter[CR_SCRIPT10]==1){ //make input false when item wasnt lifted yet
Link->InputL=false;
}
if(curscreen!=Game->GetCurScreen()&&curmap==Game->GetCurMap()){
Waitframes(10);
curscreen=Game->GetCurScreen();
x=Link->X;
y=Link->Y;
}
if(curmap!=Game->GetCurMap()&&curscreen==Game->GetCurScreen()){
Waitframes(10);
curmap=Game->GetCurMap();
x=Link->X;
y=Link->Y;
}
if(curmap!=Game->GetCurMap()&&curscreen!=Game->GetCurScreen()){
Waitframes(10);
curscreen=Game->GetCurScreen();
curmap=Game->GetCurMap();
x=Link->X;
y=Link->Y;
}
if(Link->InputL&&downtime<0){ //checkj if L pressed if so toggle between running and not running state
pressdL=!pressdL;
downtime=10;
}
if(downtime>-1){ // the downtime makes sure there are no glitches by the toggle button like toggle between running and not running too fast
downtime-=1;
}
if(pressdL){ //Test if L was pressed
Link->InputA=false;
Link->InputB=false;
Link->X+=round((Lspeed-1)*(Link->X-x));
Link->Y+=round((Lspeed-1)*(Link->Y-y));
}
x=Link->X;
y=Link->Y;
Waitframe();
}
}
//functions go here
}
here a demoquest with that version:
http://www.mediafire...5nv4r7rb8kjposxFinally now a version of the script that has only B disabled when in running state:
CODE
int round(float f){
if(f<0.5&&f>-0.5){
return 0;
}else{
int diff=f;
int num=0;
if(diff>0){
while(diff>1){
diff-=1;
num+=1;
}
if(diff<0.5){
return num;
}else{
return num+1;
}
}else{
while(diff<-1){
diff+=1;
num-=1;
}
if(diff>-0.5){
return num;
}else{
return num-1;
}
}
}
}
const float Lspeedpercent=150;
global script onstart {
void run() {
float Lspeed=Lspeedpercent/100;
int x=Link->X;
int y=Link->Y;
int curmap=-1;
int curscreen=-1;
bool pressdL=false;
int downtime=-1;
Game->Counter[CR_SCRIPT10]=1;
//one time things go here
while(true) {
if(Game->Counter[CR_SCRIPT10]==1){ //make input false when item wasnt lifted yet
Link->InputL=false;
}
if(curscreen!=Game->GetCurScreen()&&curmap==Game->GetCurMap()){
Waitframes(10);
curscreen=Game->GetCurScreen();
x=Link->X;
y=Link->Y;
}
if(curmap!=Game->GetCurMap()&&curscreen==Game->GetCurScreen()){
Waitframes(10);
curmap=Game->GetCurMap();
x=Link->X;
y=Link->Y;
}
if(curmap!=Game->GetCurMap()&&curscreen!=Game->GetCurScreen()){
Waitframes(10);
curscreen=Game->GetCurScreen();
curmap=Game->GetCurMap();
x=Link->X;
y=Link->Y;
}
if(Link->InputL&&downtime<0){ //checkj if L pressed if so toggle between running and not running state
pressdL=!pressdL;
downtime=10;
}
if(downtime>-1){ // the downtime makes sure there are no glitches by the toggle button like toggle between running and not running too fast
downtime-=1;
}
if(pressdL){ //Test if L was pressed
Link->InputB=false;
Link->X+=round((Lspeed-1)*(Link->X-x));
Link->Y+=round((Lspeed-1)*(Link->Y-y));
}
x=Link->X;
y=Link->Y;
Waitframe();
}
}
//functions go here
}
I wont put a demoquest for the last one because its obvious. All of them should work as intended
Edited by aaa2, 12 September 2011 - 05:39 AM.