Jump to content

Photo

link on auto pilot


  • Please log in to reply
9 replies to this topic

#1 linkluster

linkluster

    Initiate

  • Members

Posted 24 February 2009 - 06:03 PM

is there a way to put link on auto pilot. i want him to be able to move toward what ever enemy (boss) is on screen and one hit them and kill them for cutscene purposes. so the boss would only need one hitpoint and no matter where they are on screen link would automatically go towards them and hit them with his sword killing them instantly. and preferably they wouldnt try to attack or put up any fight what so ever. i dont know how hard this would be to do b/c i know nothing about scripting.

#2 lucas92

lucas92

    Defender

  • Members

Posted 24 February 2009 - 10:05 PM

Meh, I dunno if it's really useful at all to make Link move... You could just make an ffc with a Link walking combo, etc. You see what I mean?

But yes, I think it's possible to make Link on auto pilot... But I see no use for this.

#3 linkluster

linkluster

    Initiate

  • Members

Posted 24 February 2009 - 11:35 PM

what about to make him auto attack to kill the boss? and i dont really know what you mean about the ffc. sorry i just started playing with ZC a little over a week ago. i dont know much about anything.

#4 Zephlon

Zephlon

    Experienced Forumer

  • Members

Posted 25 February 2009 - 08:50 PM

Well the walking part depends upon where Link is and where the boss is. To make him attack, you need a script that will "press" the A button. (I'm assuming you have the "Can Select A Button Weapon on Subscreen" off. If you don't know what I'm talking about, you probably do.) If you give me a screenshot (by pressing [Z] in the editor), I will write a script for you. It will move Link, not an FFC.

#5 linkluster

linkluster

    Initiate

  • Members

Posted 25 February 2009 - 10:05 PM

awesome man thanks for offering to script for me but i just decided to go a different way with the cutscene since i couldnt figure out how to make link move and things. once again though thanks for the offer.

#6 linkluster

linkluster

    Initiate

  • Members

Posted 25 February 2009 - 11:20 PM

although i do still need something to tell link to move to a certain spot on the screen i tried this

ffc script PutLinkHere
{
void run()
{
Link->X = this->X;
Link->Y = this->Y;
}
}

which puts him where i want him to be but you cant actually see him walking there he just sort of appears there and also for some reason my cset changes. since i have to select a tile for the ffc how would i make him actually walk to it when he warps onto the screen? and also when he get there make a message start? maybe two different scripts in them selves. man i hate not knowing how to do stuff icon_smile.gif

#7 Zephlon

Zephlon

    Experienced Forumer

  • Members

Posted 26 February 2009 - 05:40 PM

First, you'll need advmath.zh. You can get that here. Second, put import "advmath.zh" just below import "std.zh".
Edit: Oh, you also need diagonal movement enabled.

Try this script:

CODE
void moveTowards(ffc this, int x, int y, int speed) { //Made by pkmnfrk
    int angle = findAngle(this->X, this->Y, x, y);
    float dx = RadianSin(angle) * speed;
    float dy = RadianCos(angle) * speed;
    
    this->X += dx;
    this->Y += dy;
}

void moveLinkTowards(int x, int y, int speed) { //Made by pkmnfrk
    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;
}

ffc script MoveLinkHere
{
    void run(int speed)
    {
        moveLinkTowards(this->X,this->Y,speed);
        Waitframe();
    }
}


I'm not sure if that will work. If you want him to go straight up, down, left, or right; then use:

Up
CODE
while(Link->Y > this->Y) {
    Link->Y -= 2;
    Waitframes(4);
}


Down
CODE
while(Link->Y < this->Y) {
    Link->Y += 2;
    Waitframes(4);
}


Left
CODE
while(Link->X > this->X) {
    Link->X -= 2;
    Waitframes(4);
}


Right
CODE
while(Link->X < this->X) {
    Link->X += 2;
    Waitframes(4);
}

Edited by Mega Link, 26 February 2009 - 05:42 PM.


#8 linkluster

linkluster

    Initiate

  • Members

Posted 26 February 2009 - 11:58 PM

thanks for the script but i dont think it works or maybe it does but im not far along enough to figure it out.

http://img135.images...ge=zelda003.png

im gonna have link warp to the bottom of the bridge and i just want him to walk up to the guards and when he gets there have the guards tell him to stop. its prolly not hard at all to do but im lost. if only there was a script to move like to a certain X,Y position by plugging in your X cords. to say D0 and Y cords to D1. i dont even know if thats possible. thanks for all the help. and id aprreciate anymore you all could give me or point me in the right direction to read something that might help me out.


#9 Zephlon

Zephlon

    Experienced Forumer

  • Members

Posted 28 February 2009 - 01:42 PM

So you want him to go straight up?


CODE
ffc script LinkGuards
{
    int start_y;
    void run(int y, int msg, int down)
    {
        start_y = Link->Y;    
        Link->Dir = DIR_UP;
        Link->Action = LA_WALKING;    
        while(Link->Y > y) {
            Link->Y -= 2;
            Waitframes(4);
        }
        Link->Action = LA_FROZEN;
        Screen->Message(msg);
        Waitframe();
        
        if(down > 0) {
            Link->Dir = DIR_DOWN;
            Link->Action = LA_WALKING;
            while(Link->Y < start_y) {
                Link->Y += 2;
                Waitframes(4);
            }
        }
    }
}


D0 = the y coordinate of how far up you want Link to go.
D1 = the ID of the message string you want to play.
D2 = set to 1 if you want Link to go back down.

If you have problems, tell me what happened.

#10 linkluster

linkluster

    Initiate

  • Members

Posted 01 March 2009 - 04:10 AM

man i cant thank you enough that did exactly what i wanted it to do. although link didnt really walk with animation he kind of glided to the spot but it still worked and it was awesome.. thank you very much.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users