Jump to content

Photo

Message Script Edit


  • Please log in to reply
4 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 20 March 2018 - 05:40 PM

Right now the script below triggers a message when Link steps on the FFC's coordinates.

 

Would it be possible to modify this script so that D1, D2, and D3 would be the coordinates of additional places Link could step to trigger the message?

 

for example

D1: 62.128

means coordinates 62X, 128Y

 

EDIT: (And that 0 doesn't make 0X, 0Y a location)

// Plays string D0 once per screen when Link steps on the coordinates
ffc script StepMessage{
    void run(int m){
        while(CenterLinkX()<this->X || CenterLinkX()>this->X+this->TileWidth*16 || CenterLinkY()<this->Y || CenterLinkY()>this->Y+this->TileHeight*16) Waitframe();
        Screen->Message(m);
    }
}

Edited by Cukeman, 20 March 2018 - 05:43 PM.


#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 March 2018 - 06:03 PM

You want coordinates -/+ a distance factor.


ffc script LocMessage
{
     void run(int m, int x, int y, int dist)
     {
          bool waiting = true;
          while(waiting)
          {
               if ( WithinDistXY(x,y,dist) )
               {
                    waiting = false;
                    Screen->Message(m);
               }
               Waitframe();
          }
          this->Data = 0; Quit();
     }
     bool WithinDistXY(int x, int y, int dist)
     {
          return (Abs(Link->X-x) <= dist && Abs(Link->Y-y) <= dist);
     }
}



You can change the x and y from run() args and call:

if (WithinDistXY(this->X, this->Y, dist))
...if you wish to widen the step-effect area.
  • ShadowTiger likes this

#3 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 20 March 2018 - 10:07 PM

So, if I understand, X and Y will set the width and height of the area that triggers the message? And distance does... what exactly?


Edited by Cukeman, 21 March 2018 - 12:12 AM.


#4 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 26 March 2018 - 04:03 AM

OK, I understand what the script does now, but I need to be able to set the area to be rectangular, sometimes wider than it is tall, sometimes taller than it is wide.


Edited by Cukeman, 26 March 2018 - 04:06 AM.


#5 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 29 March 2018 - 08:23 AM

i.e. separate arguments for x distance, and y distance


Edited by Cukeman, 02 April 2018 - 12:20 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users