PDA

View Full Version : Sword Tech Script



bluedeath
01-11-2008, 11:54 AM
I need a Global script that makes it when Link swings his sword, the link slash tiles go randomly reverse or the other, and when you are pressing the directional buttons link slashes, when you are not pressing the directional buttons and pressing the sword botton, it makes link stab instead, please make slash tiles go reverse and back to normal like link is swinging left and right?

Russ
01-11-2008, 11:57 AM
Hm. That would be pretty complicated. As far as I know, there is no simple way to differenciate from stabbing and slashing by script. So you would have to use a freeform combo weopon to do that. It's to advanced for me to do, that's for sure.

Joe123
01-11-2008, 12:08 PM
Well, this covers quite an interesting discovery/bug that I found while I was writing my Epona script.

If you set Link's direction while he is slashing, it's quite interesting (try charging up the sword, then releasing while Link is riding).

Anyway, I haven't tested this, but you could see if it works:

bool slashing;

global script slot2{
void run(){
int i;
while(true){
if(slashing){
if(Link->Dir == 0){
for(i=0; i<3; i++){
Link->Dir = 0;
Waitframe();
}
for(i=0; i<3; i++){
Link->Dir = 3;
Waitframe();
}
slashing = false;
}
if(Link->Dir == 1){
for(i=0; i<3; i++){
Link->Dir = 1;
Waitframe();
}
for(i=0; i<3; i++){
Link->Dir = 2;
Waitframe();
}
slashing = false;
}
if(Link->Dir == 2){
for(i=0; i<3; i++){
Link->Dir = 2;
Waitframe();
}
for(i=0; i<3; i++){
Link->Dir = 0;
Waitframe();
}
slashing = false;
}
if(Link->Dir == 3){
for(i=0; i<3; i++){
Link->Dir = 3;
Waitframe();
}
for(i=0; i<3; i++){
Link->Dir = 1;
Waitframe();
}
slashing = false;
}
}
Waitframe();
}
}
}

item script sword{
void run(){
slashing = true;
}
}

What it should (might) do is make Link slash aLttP stylee, rather than Z1, that's what you're asking, yes?

Scripting can't do anything about stabbing really, sorry, unless you make it into an ffc weapon like Russ said.

Also, make sure to set the item script to each sword, and that you have the quest rule 'Flip Right Facing Slash' checked.

And, if it doesn't work, tell me what it does and I'll sort it out (hopefully)

EDIT: Oh no, it doesn't work at all, no waitframe in global scripts.
Oops.
Anyway, I'll fix it up, I think I know where it's going.

EDIT2:

bool slashing;

global script slot2{
void run(){
bool up; int up2;
bool down; int down2;
bool left; int left2;
bool right; int right2;

while(true){
if(slashing){
if(Link->Dir == 0 && !(down || left || right)) up = true;
if(up) up2++;
if(up2 == 4) Link->Dir = 2;
if(up2 == 9){Link->Dir = 0; up2 = 0; up = false; slashing = false;}

if(Link->Dir == 1 && !(up || left || right)) down = true;
if(down) down2++;
if(down2 == 4) Link->Dir = 3;
if(down2 == 9){Link->Dir = 1; down2 = 0; down = false; slashing = false;}

if(Link->Dir == 2 && !(up || down || right)) left = true;
if(left) left2++;
if(left2 == 4) Link->Dir = 1;
if(left2 == 9){Link->Dir = 2; left2 = 0; left = false; slashing = false;}

if(Link->Dir == 3 && !(up || down || left)) right = true;
if(right) right2++;
if(right2 == 4) Link->Dir = 0;
if(right2 == 9){Link->Dir = 3; right2 = 0; right = false; slashing = false;}
}
Waitframe();
}
}
}

item script sword{
void run(){
slashing = true;
}
}

There we go, now Link slashes round 180deg rather than just 90.

bluedeath
01-11-2008, 03:56 PM
Its not what I meant really, but this will do..

Gleeok
01-11-2008, 11:24 PM
I already wrote this script a while back. ;) It uses an ffc instead of sprites so you could set the animation to anything you wanted. It is already set up to change graphics for single/multiple attacks. I could add a part to initially check for dir buttons being pressed also. The bad: You have to draw your own animation though.