That's a good question. I don't know. Probably, but I can't say for sure.
Either way, for completeness, here's the moveLinkTowards function:
void moveLinkTowards(int x, int y, int speed) {
int angle = findAngle(Link->X, Link->Y, x, y);
float dx = RadianSin(angle) * speed;
float dy = RadianCos(angle) * speed;
Link->X += dx;
Link->Y += dy;
}
Note that the first parameter is missing; there's only one Link (currently).
EDIT: For other variations on this script, ask this guy
Hahaha, that comic was pretty funny =P
It's not working! 😞
Link->Dir = DIR_UP;
Link->Action = LA_WALKING;
moveLinkTowards(168,120,5);
Link->Action = LA_FROZEN;
Screen->Message(25);
Link->Dir = DIR_DOWN;
Link->Action = LA_WALKING;
moveLinkTowards(168,168,5);
Link->Action = LA_NONE;
It plays the message but doesn't make Link walk.
It's in a while loop right? I don't know much about scripting but i believe this just changes link position once then plays the message the changes links position one again. I think the code need to be:
bool a;
while(true) {
if(a == false) {
Link->Dir = DIR_UP;
Link->Action = LA_WALKING;
moveLinkTowards(168,120,5);
}
if(Link->X == 168 && Link->Y == 120) {
Link->Action = LA_FROZEN;
Screen->Message(25);
Link->Dir = DIR_DOWN;
a = true;
}
if(a) {
Link->Action = LA_WALKING;
moveLinkTowards(168,168,5);
Link->Action = LA_NONE;
}
}
There's probably a better way to do this(if this even works; I haven't tested it) Also, I think you need the quest rule "Messages freeze all action" for this to work.
Worse. ZC froze completely except for the music. I wouldn't even let me close it without using task manager.
Mega Link: /slap
First thing: This moves Link one step toward the intended target. You have to call it more than once, until Link gets there.
Pielord: /slap
pkmnfrk wrote:Just be careful about checking absolute position if you use my script, since FFCs won't necessarily be pixel-aligned any more.So, if you need to check an exact position, do something like:
if(Floor(theffc->X) == 120 && Floor(theffc->Y) == 80) //do something
What you mean to do is something like:
Link->Dir = DIR_UP;
Link->Action = LA_WALKING; //I don't think this does what you think it does...//I also made Link move at 4 pixels/tick, since that will actually get him where he's going
while(Abs(Link->X - 168) > 4 || Abs(Link->Y - 120) > 4) {
moveLinkTowards(168,120,4);
Waitframe();
}
Link->Action = LA_FROZEN;
Screen->Message(25);
Link->Dir = DIR_DOWN;
Link->Action = LA_WALKING;
while(Abs(Link->X - 168) > 4 || Abs(Link->Y - 168) > 4) {
moveLinkTowards(168,168,4);
Waitframe();
}
Link->Action = LA_NONE;
To both of you: /slap
To make Link move up and down along the Y axis, you don't need advanced trigonometry! This will suffice:
Link->Dir = DIR_UP;
Link->Action = LA_WALKING;if(Link->Y > 120) {
while(Link->Y > 120) {
Link->Y -= 4; //in reality, you probably want him to walk slower.
Waitframe();
}
} else {
while(Link->Y < 120) {
Link->Y += 4; //in reality, you probably want him to walk slower.
Waitframe();
}
}
Link->Action = LA_FROZEN;
Screen->Message(25);
Link->Dir = DIR_DOWN;
Link->Action = LA_WALKING;
while(Link->Y < 168) {
Link->Y += 4; //in reality, you probably want him to walk slower.
Waitframe();
}
Link->Action = LA_NONE;
Link is walking too fast, and he faces down before the message is done playing.
Btw, yes the side warp did get triggered. 😉
Try changing the loops to look like this:
while(Link->Y < 168) {
Link->Y += 1;
Waitframes(4); //note the 's'
}
I tried that but Link walked too slow, so I changed the 1 to a 2, and it works. To fix the problem where he faces down before the message is done, I added a Waitframe(); after Screen->Message(25);.
Link->Dir = DIR_UP;
Link->Action = LA_WALKING;if(Link->Y > 120) {
while(Link->Y > 120) {
Link->Y -= 2; //in reality, you probably want him to walk slower.
Waitframes(4);
}
} else {
while(Link->Y < 120) {
Link->Y += 2; //in reality, you probably want him to walk slower.
Waitframes(4);
}
}
Link->Action = LA_FROZEN;
Screen->Message(25);
Waitframe();
Link->Dir = DIR_DOWN;
Link->Action = LA_WALKING;
while(Link->Y < 168) {
Link->Y += 2; //in reality, you probably want him to walk slower.
Waitframes(4);
}
Link->Action = LA_NONE;
Ya like I said, I don't know to much about ZScript. I should probably learn more before I try to help people. Anyways, glad to hear you got it working Mega Link.