User Tag List

Page 4 of 4 FirstFirst ... 2 3 4
Results 31 to 40 of 40

Thread: walkTo() void?

  1. #31
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,141
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.37%

    Re: walkTo() void?

    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:

    Code:
    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
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  2. #32
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,303
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.62%

    Re: walkTo() void?

    Hahaha, that comic was pretty funny =P

  3. #33
    a.k.a. Zephlon Arphanosh Mega Link's Avatar
    Join Date
    May 2006
    Age
    30
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,670
    Level
    13
    vBActivity - Bars
    Lv. Percent
    71.85%

    Re: walkTo() void?

    It's not working!
    Code:
    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.

  4. #34
    Keese
    Join Date
    Jan 2008
    Age
    28
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    745
    Level
    9
    vBActivity - Bars
    Lv. Percent
    59.65%

    Re: walkTo() void?

    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:
    Code:
    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.

  5. #35
    a.k.a. Zephlon Arphanosh Mega Link's Avatar
    Join Date
    May 2006
    Age
    30
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,670
    Level
    13
    vBActivity - Bars
    Lv. Percent
    71.85%

    Re: walkTo() void?

    Worse. ZC froze completely except for the music. I wouldn't even let me close it without using task manager.

  6. #36
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,141
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.37%

    Re: walkTo() void?

    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

    Quote Originally Posted by pkmnfrk View Post
    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:

    Code:
    if(Floor(theffc->X) == 120 && Floor(theffc->Y) == 80) //do something
    What you mean to do is something like:

    Code:
    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:

    Code:
    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;
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  7. #37
    a.k.a. Zephlon Arphanosh Mega Link's Avatar
    Join Date
    May 2006
    Age
    30
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,670
    Level
    13
    vBActivity - Bars
    Lv. Percent
    71.85%

    Re: walkTo() void?

    Link is walking too fast, and he faces down before the message is done playing.

    Btw, yes the side warp did get triggered.

  8. #38
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,141
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.37%

    Re: walkTo() void?

    Try changing the loops to look like this:

    Code:
    while(Link->Y < 168) {
      Link->Y += 1;
      Waitframes(4); //note the 's'
    }
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  9. #39
    a.k.a. Zephlon Arphanosh Mega Link's Avatar
    Join Date
    May 2006
    Age
    30
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,670
    Level
    13
    vBActivity - Bars
    Lv. Percent
    71.85%

    Re: walkTo() void?

    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);.
    Code:
    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;

  10. #40
    Keese
    Join Date
    Jan 2008
    Age
    28
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    745
    Level
    9
    vBActivity - Bars
    Lv. Percent
    59.65%

    Re: walkTo() void?

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social