PDA

View Full Version : Seeking help to finish an incomplete script.



Majora
03-04-2009, 08:15 PM
SO, I have with me an 'incomplete' script. My scripter person who wrote it originally got called away by real life (that skank (referring to RL if it were a person)) stuff. So, I was wondering if anyone would be kind enough to finish it? If so, we can do a thing with some kind of IM program or IRC, since PM'ing and/or e-mailing back and forth is inefficient. If interested (ironically ->) PM me. Oh, this is the Master Hand script (http://www.youtube.com/watch?v=q9rYDcEQ4L0). And from the looks of it, it's not too complicated or long (compared to some OTHER scripts I've seen that aren't as 'interactive/animated'.)

Sooooo... any takers? D:

Joe123
03-05-2009, 12:32 PM
If you were to post the script for people to look at I think they'd be more likely to want to work with it.

Majora
03-05-2009, 04:56 PM
http://www.fileden.com/files/2007/5/19/1093759/masterhand.z

Gleeok
03-06-2009, 02:03 AM
<lazy> Why not just use [/code] tags? </too lazy to download>

CaRmAgE
03-06-2009, 10:01 AM
Here you go.


import "std.zh"

const int mh_none = 0;
const int mh_grab = 1; //50 frames
const int mh_punchdown = 2;
const int mh_push = 3;
const int mh_fist = 4;
const int mh_makefist = 5;
const int mh_preparepush = 6;
const int mh_slap = 7;

const int mh_data = 1424;

ffc script MasterHand {
void run(int HP, bool crazyhand) {

intro(this);

Screen->D[0] = HP;

while(Screen->D[0] > 0) {
int sleep = Rand(50) + 40;
if(Waitdamage(this, sleep)) {
//Trace(1.6);
break;
}

//now, choose an attack.
int attack = Rand(3);
if(attack == 0) {
if(punch(this)) {
//Trace(1.5);
break;
}
} else if(attack == 1 || attack == 2) {
if(slap(this)) {
break;
}
}


}
}

void intro(ffc this) {
//Link->Action = LA_FROZEN;
//Link->Dir = DIR_RIGHT;
Game->PlaySound(61);
Waitframes(100);
Game->PlaySound(60);
this->Vx = -.5;
this->Vy = .2;
Waitframes(160);

this->Vx = 0;
this->Vy = 0;
Game->PlayMIDI(1);
//Link->Action = LA_NONE;
}

bool punch(ffc this) {
setframe(this, mh_makefist);
if(Waitdamage(this, 20)) {
//Trace(1.3);
return true;
}
setframe(this, mh_fist);
int cnt = 60 + Rand(150);
while(cnt >= 0) {
cnt -= floatTo(this, 1, 224, Link->Y - 16);
if(Waitdamage(this, 1)) {
//Trace(1.4);
return true;
}
cnt -= 1;
}

floatTo(this, 4, 0, this->Y);

if(Waitdamage(this, 50)) {
//Trace(1.2);
return true;
}
setframe(this, mh_none);

//return home;
floatTo(this, 2, 176, 56);
return false;
}

bool slap(ffc this) {
if(floatTo(this, 1, Link->X - 24, 0) == -1) return true;
setframe(this, mh_slap);
if(Waitdamage(this, 40)) return true;
if(moveTo(this, 6, this->X, 112) == -1) return true;
//if(moveTo(this, 6, this->X, 80) == -1) return true;
if(Waitdamage(this, 30)) return true;
setframe(this, mh_none);
if(floatTo(this, 2, 176, 56) == -1) return true;
return false;
}



void setframe(ffc this, int i) {
this->Data = mh_data + i;
this->EffectWidth = 64;
this->EffectHeight = 50;
if(i == mh_push) {
this->EffectWidth = 32;
this->EffectHeight = 64;
} else if(i == mh_fist) {
this->EffectHeight = 48;
} else if(i == mh_slap) {
this->EffectHeight = 32;
}
}

bool Waitdamage(ffc this, int i) {
if(Screen->D[0] <= 0) {
//Trace(0.2);
return true;
}
for(int j = 0; j < i; j++) {
if(Screen->D[1] > 0) {
Screen->D[1]--;
} else {
for(int q = 1; q <= Screen->NumLWeapons(); q++) {
lweapon s = Screen->LoadLWeapon(q);
if(s->ID == LW_SWORD) {
if(s->X + 8 > this->X && s->X < this->X + 56 && s->Y + 8 > this->Y && s->Y < this->Y + 56) {
//Screen->D[0] -= s->Damage;
Screen->D[0] -= 4;
//Trace(Screen->D[0]);
//Trace(s->Damage);
Screen->D[1] = 20;
Game->PlaySound(SFX_GASP);
if(Screen->D[0] <= 0) {
//Trace(1.1);
return true;
}
break;
}
}
}
}
//Screen->Rectangle(3, this->X, this->Y, this->X + this->EffectWidth - 1 , this->Y + this->EffectHeight - 1, 129, 1, 0, 0, 0, true, 64);
Waitframe();
}
//Trace(0.3);
return false;
}

int floatTo(ffc this, int sp, int x, int y) {
//for each of the X and Y, we need to travel at full speed for 80% of the way,
//and then at increasingly lower speeds until the end.
int dx; int dy; int qx; int qy;
int count = 0;


while(true) {
dx = x - this->X;
dy = y - this->Y;
if(this->X != x) {
if(dx < 0) {
if(dx < -15) {
this->X -= sp;
} else if(dx < -4) {
this->X -= sp / 2;
} else if(dx < -1) {
this->X -= Min(1, sp / 4);
}
} else {
if(dx > 15) {
this->X += sp;
} else if(dx > 4) {
this->X += sp / 2;
} else if(dx > 1) {
this->X += Min(1, sp / 4);
}
}
}

if(this->Y != y) {
if(dy < 0) {
if(dy < -15) {
this->Y -= sp;
} else if(dy < -4) {
this->Y -= sp / 2;
} else if(dy < -1) {
this->Y -= Min(1, sp / 4);
}
} else {
if(dy > 15) {
this->Y += sp;
} else if(dy > 4) {
this->Y += sp / 2;
} else if(dy > 1) {
this->Y += Min(1, sp / 4);
}
}
}

if(Abs(dx) <= 1 && Abs(dy) <= 1) return count;
count += 1;
if(Waitdamage(this, 1)) {
//Trace(0.1);
return -1;
}

}
return count;
}

int moveTo(ffc this, int sp, int x, int y) {
int count = 0;
while(true) {

if(this->X < x) {
this->X += Min(sp, x - this->X);
} else if(this->X > x) {
this->X -= Min(sp, this->X - x);
}
if(this->Y < y) {
this->Y += Min(sp, y - this->Y);
} else if(this->Y > y) {
this->Y -= Min(sp, this->Y - y);
}

if(Abs(x - this->X) <= 1 && Abs(y - this->Y) <= 1) return count;
count += 1;
if(Waitdamage(this, 1)) return -1;
}
return count;
}
}

ffc script CrazyHand {
void run() {
//TODO
}
}

int Sgn(int i) {
if(i < 0) return -1;
if(i >= 0) return 1;
}

ffc script DamageMeter {
void run(int d) {
while(Screen->D[d] <= 0) {
Waitframe();
}
int max = Screen->D[d];
int cval = 0;
int lastHP = max;
int dtim = 0;
while(Screen->D[d] > 0) {
if(lastHP != Screen->D[d]) {
dtim = 30;
}
if(dtim > 0) dtim -= 1;
if(dtim == 0) {
if(cval > Screen->D[d]) cval = Max(cval - 1, 0);
}
if(cval < Screen->D[d]) cval = Min(cval + 4, Screen->D[d]);
lastHP = Screen->D[d];
float perc = cval / max;
float perc2 = Screen->D[d] / max;
//Trace(perc);

Screen->DrawTile(3, 48, 144, 65480, 2, 1, 8, 1, 0, 0, 0, 0, true, 128);
Screen->Rectangle(3, 80, 149, 207, 155, 130, 1, 0, 0, 0, false, 128);
Screen->Rectangle(3, 81, 150, 81 + (125 * perc) , 154, 130, 1, 0, 0, 0, true, 128);
Screen->Rectangle(3, 81, 150, 81 + (125 * perc2) , 154, 129, 1, 0, 0, 0, true, 128);
Waitframe();
}
}
}

ffc script NumericDamageMeter {
void run(int d, int bgtile) {

while(getHP(d) <= 0) {
Waitframe();
}

while(getHP(d) > 0) {
//draw bg
if(bgtile > 0) Screen->DrawTile(3, this->X - 8, this->Y - 8, bgtile, 2, 2, 8, 1, 0, 0, 0, 0, true, 64);
drawNumber(65482, getHP(d), this->X, this->Y + 3, 8);
Waitframe();
}
}

int getHP(int d) {
if(d == -1) return Link->HP;
return Screen->D[d];
}

void drawNumber(int firstTile, int num, int x, int y, int cset) {
int pos;
int a; int b; int c; int d; int e;
num = Pow(num, 1); //truncate to integer
e = num % 10;
num /= 10;
d = num % 10;
num /= 10;
c = num % 10;
num /= 10;
b = num % 10;
num /= 10;
a = num % 10;

if(a != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + a, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(b != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + b, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(c != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + c, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(d != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + d, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(e != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + e, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
}
}

import "sound.z"

Majora
03-06-2009, 05:05 PM
Yep. It's the script for an entirely FFC Master Hand, and the damage counters in SSB format.

pkmnfrk
03-07-2009, 02:22 PM
Slightly more commented version


import "std.zh"

const int mh_none = 0;
const int mh_grab = 1; //50 frames
const int mh_punchdown = 2;
const int mh_push = 3;
const int mh_fist = 4;
const int mh_makefist = 5;
const int mh_preparepush = 6;
const int mh_slap = 7;

const int mh_data = 1424; //First frame of boss

ffc script MasterHand {
//the main procedure
void run(int HP, bool crazyhand) {

//this deals with making the master hand come in
//from the top-right
intro(this);

//HP is stored in a screen variable, so the damage
//counter will work
Screen->D[0] = HP;

//This is the main loop, which runs while the boss
//has HP
while(Screen->D[0] > 0) {
//first, it starts off by doing nothing for
//[40..90] ticks
int sleep = Rand(50) + 40;

//Waitdamage handles animation and damage while
//MH is doing nothing
if(Waitdamage(this, sleep)) {
break;
}

//now, choose an attack.
int attack = Rand(3);
if(attack == 0) {
//fun fact: these attack functions return true
//if the boss dies in the middle of the attack
if(punch(this)) {
break;
}
} else if(attack == 1 || attack == 2) {
if(slap(this)) {
break;
}
}


}
}

//big intro
void intro(ffc this) {
//Link->Action = LA_FROZEN;
//Link->Dir = DIR_RIGHT;
Game->PlaySound(61); //intro music
Waitframes(100);
Game->PlaySound(60); //evil laugh
this->Vx = -.5; //also, the MH should start at about
this->Vy = .2; // (256, -32)
Waitframes(160);

this->Vx = 0;
this->Vy = 0;
Game->PlayMIDI(1); //MH battle music
//Link->Action = LA_NONE;
}

//Make a fist, and hover on the right side, aligning
//up with Link, then shoot straight across to the other
//side
bool punch(ffc this) {
setframe(this, mh_makefist);
if(Waitdamage(this, 20)) {
return true;
}
setframe(this, mh_fist);
int cnt = 60 + Rand(150);
while(cnt >= 0) {
cnt -= floatTo(this, 1, 224, Link->Y - 16);
//if the boss dies, quit
if(Waitdamage(this, 1)) {
return true;
}
cnt -= 1;
}

floatTo(this, 4, 0, this->Y);

//if the boss dies, quit
if(Waitdamage(this, 50)) {
return true;
}
setframe(this, mh_none);

//return home;
floatTo(this, 2, 176, 56);
return false;
}

bool slap(ffc this) {
if(floatTo(this, 1, Link->X - 24, 0) == -1) return true;
setframe(this, mh_slap);
if(Waitdamage(this, 40)) return true;
if(moveTo(this, 6, this->X, 112) == -1) return true;
if(Waitdamage(this, 30)) return true;
setframe(this, mh_none);
if(floatTo(this, 2, 176, 56) == -1) return true;
return false;
}


//this modifies the boss's bounding box for different
//frames of animation.
//it's not perfect, though, since you can't control the
//top-left corner...
void setframe(ffc this, int i) {
this->Data = mh_data + i;
this->EffectWidth = 64;
this->EffectHeight = 50;
if(i == mh_push) {
this->EffectWidth = 32;
this->EffectHeight = 64;
} else if(i == mh_fist) {
this->EffectHeight = 48;
} else if(i == mh_slap) {
this->EffectHeight = 32;
}
}

bool Waitdamage(ffc this, int i) {
//if the boss's hp is already 0, quit now.
if(Screen->D[0] <= 0) {
return true;
}
//for(each frame we need to wait) {
for(int j = 0; j < i; j++) {
//this is the "temporary invincibility" counter
if(Screen->D[1] > 0) {
Screen->D[1]--;
} else {
//if we're vulnerable, check all the weapons on the screen
for(int q = 1; q <= Screen->NumLWeapons(); q++) {
lweapon s = Screen->LoadLWeapon(q);
//we are interested in the sword (but, we could add others as well)
if(s->ID == LW_SWORD) {
//if(Link's sword is inside the bounding box) {
if(s->X + 8 > this->X && s->X < this->X + 56 && s->Y + 8 > this->Y && s->Y < this->Y + 56) {
//Screen->D[0] -= s->Damage; //pick one of these options
Screen->D[0] -= 4;
Screen->D[1] = 20; //20 invincible ticks
Game->PlaySound(SFX_GASP);
//if the boss is now dead, abort
if(Screen->D[0] <= 0) {
return true;
}
//we found the weapon, so we don't need
//to check any others.
break;
}
}
}
}

//this shows the boss's bounding box
//Screen->Rectangle(3, this->X, this->Y, this->X + this->EffectWidth - 1 , this->Y + this->EffectHeight - 1, 129, 1, 0, 0, 0, true, 64);
Waitframe();
}
return false;
}

int floatTo(ffc this, int sp, int x, int y) {
//for each of the X and Y, we need to travel at full speed for 80% of the way,
//and then at increasingly lower speeds until the end.
int dx; int dy; int qx; int qy;
int count = 0;

//this is complicated movement stuff. don't modify
//it unless you want to tweak the movement
while(true) {
dx = x - this->X;
dy = y - this->Y;
if(this->X != x) {
if(dx < 0) {
if(dx < -15) {
this->X -= sp;
} else if(dx < -4) {
this->X -= sp / 2;
} else if(dx < -1) {
this->X -= Min(1, sp / 4);
}
} else {
if(dx > 15) {
this->X += sp;
} else if(dx > 4) {
this->X += sp / 2;
} else if(dx > 1) {
this->X += Min(1, sp / 4);
}
}
}

if(this->Y != y) {
if(dy < 0) {
if(dy < -15) {
this->Y -= sp;
} else if(dy < -4) {
this->Y -= sp / 2;
} else if(dy < -1) {
this->Y -= Min(1, sp / 4);
}
} else {
if(dy > 15) {
this->Y += sp;
} else if(dy > 4) {
this->Y += sp / 2;
} else if(dy > 1) {
this->Y += Min(1, sp / 4);
}
}
}

//if the boss is "close enough" to the target, quit
if(Abs(dx) <= 1 && Abs(dy) <= 1) return count;
//otherwise, count the frames it takes
count += 1;
//and, take damage in the meantime
if(Waitdamage(this, 1)) {
//since this function returns an int, not a bool,
//we have to return something special to indicate
// "boss death"
return -1;
}

}
//on further reflection, this return will never be hit
return count;
}

//this is a linear move, rather than the "acceleraty" move
//in floatTo(). However, the principles are the same
int moveTo(ffc this, int sp, int x, int y) {
int count = 0;
while(true) {

if(this->X < x) {
this->X += Min(sp, x - this->X);
} else if(this->X > x) {
this->X -= Min(sp, this->X - x);
}
if(this->Y < y) {
this->Y += Min(sp, y - this->Y);
} else if(this->Y > y) {
this->Y -= Min(sp, this->Y - y);
}

if(Abs(x - this->X) <= 1 && Abs(y - this->Y) <= 1) return count;
count += 1;
if(Waitdamage(this, 1)) return -1;
}
return count;
}
}

ffc script CrazyHand {
void run() {
//TODO
}
}

int Sgn(int i) {
if(i < 0) return -1;
if(i >= 0) return 1;
}

//Cave Story style damage meter
//[==========------ ]
ffc script DamageMeter {
void run(int d) {
while(Screen->D[d] <= 0) {
Waitframe();
}
int max = Screen->D[d];
int cval = 0;
int lastHP = max;
int dtim = 0;
while(Screen->D[d] > 0) {
if(lastHP != Screen->D[d]) {
dtim = 30;
}
if(dtim > 0) dtim -= 1;
if(dtim == 0) {
if(cval > Screen->D[d]) cval = Max(cval - 1, 0);
}
if(cval < Screen->D[d]) cval = Min(cval + 4, Screen->D[d]);
lastHP = Screen->D[d];
float perc = cval / max;
float perc2 = Screen->D[d] / max;

Screen->DrawTile(3, 48, 144, 65480, 2, 1, 8, 1, 0, 0, 0, 0, true, 128);
Screen->Rectangle(3, 80, 149, 207, 155, 130, 1, 0, 0, 0, false, 128);
Screen->Rectangle(3, 81, 150, 81 + (125 * perc) , 154, 130, 1, 0, 0, 0, true, 128);
Screen->Rectangle(3, 81, 150, 81 + (125 * perc2) , 154, 129, 1, 0, 0, 0, true, 128);
Waitframe();
}
}
}

//SSB style damage meter
// /\
// /__\
// /26 /\
///__\/__\
ffc script NumericDamageMeter {
void run(int d, int bgtile) {

//getHP returns either the boss's health, or Link's,
//depending on what the scripter wants
while(getHP(d) <= 0) {
Waitframe();
}

while(getHP(d) > 0) {
//draw the icon
if(bgtile > 0) Screen->DrawTile(3, this->X - 8, this->Y - 8, bgtile, 2, 2, 8, 1, 0, 0, 0, 0, true, 64);

// remember: the number is drawn offset a bit
drawNumber(65482, getHP(d), this->X, this->Y + 3, 8);
Waitframe();
}
}

int getHP(int d) {
if(d == -1) return Link->HP;
return Screen->D[d];
}

void drawNumber(int firstTile, int num, int x, int y, int cset) {
int pos;
int a; int b; int c; int d; int e;
num = Pow(num, 1); //truncate to integer

//isolate each digit
e = num % 10;
num /= 10;
d = num % 10;
num /= 10;
c = num % 10;
num /= 10;
b = num % 10;
num /= 10;
a = num % 10;

//draw the number, left to right
if(a != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + a, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(b != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + b, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(c != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + c, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(d != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + d, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
if(e != 0) {
Screen->DrawTile(3, x + pos * 7, y, firstTile + e, 1, 1, cset, 1, 0, 0, 0, 0, true, 128);
pos += 1;
}
}
}

import "sound.z"