Jump to content

Photo

A (Hopefully) Quick Request


  • Please log in to reply
9 replies to this topic

#1 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 01 October 2009 - 11:15 PM

I think this should be pretty simple. I need two scripts. One that causes a FFC to move around randomly within a certain area (to be used for a boss), and one that causes a FFC to wait a moment, then move quickly to Link's location (to be used for the boss's attack). I don't know too much about random movement scripts, but I think it should be pretty simple. If you make it, you get a spot in my quest's credits. Thanks in advance!

#2 Joe123

Joe123

    Retired

  • Members

Posted 02 October 2009 - 01:30 PM

What kind of random motion?
Warping or moving to random points?

#3 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 02 October 2009 - 02:33 PM

Just moving around. Like, well, have you ever played Wind Waker? Like Gohdan. Just randomly floating around a set area.

#4 Surreal Canine

Surreal Canine

    Master of Disaster

  • Members
  • Real Name:Brian
  • Location:Somewhere

Posted 02 October 2009 - 10:30 PM

I got you covered.

CODE

//Solidity Check, by Saffith
bool Solid(int x,int y){
if(x<0 || x>255 || y<0 || y>175) return false;
int mask = 1111b;
if(x%16<8) mask &= 0011b;
else mask &= 1100b;
if(y%16<8) mask &= 0101b;
else mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x,y)]&mask;
return ret != 0;
}


ffc script RandomMotion{
    void run(int timer){ //The number of frames to wait before setting a new trajectory. 60 frames = 1 second
        int frames = 0;
        int newX = 0;
        int newY = 0;
        while(true){
            frames++;
            if(frames==timer || Solid(this->X + (16*newX),this->Y) || Solid(this->X, this->Y + (16*newY))){
                do{ //This loop continues to set new X and Y velocities until the FFC is able to move without hitting a solid combo.
                    newX = Rand(3) - 1;
                    newY = Rand(3) - 1;
                } while(Solid(this->X + (16*newX),this->Y) || Solid(this->X, this->Y + (16*newY)))
                this->Vx = newX;
                this->Vy = newY;
                frames = 0;
            }
            Waitframe();
        }
    }    
}


D0: The number of frames to wait before setting new X and Y velocities.
This script will produce X and Y velocities of -1, 0, and 1, allowing your FFC to move randomly in 8 directions. If you want a different velocity range, let me know.

Edited by Silly Cat 2, 27 October 2009 - 09:42 PM.


#5 Joe123

Joe123

    Retired

  • Members

Posted 03 October 2009 - 02:19 AM

The script won't produce anything at the moment because 'Solid' isn't declared.
Try replacing it with Screen->isSolid, I'd assume it's meant to be pretty much the same thing.

#6 Surreal Canine

Surreal Canine

    Master of Disaster

  • Members
  • Real Name:Brian
  • Location:Somewhere

Posted 03 October 2009 - 03:05 PM

Oh yeah. I forgot my script relied on that.
Fixed.

#7 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 25 October 2009 - 05:39 PM

Okay, a little late on replying. The script doesn't seem to work. Maybe I just don't know how to use it, but I can't get it to work. When I assign it to a FFC, the FFC still doesn't do anything.

#8 Surreal Canine

Surreal Canine

    Master of Disaster

  • Members
  • Real Name:Brian
  • Location:Somewhere

Posted 27 October 2009 - 02:06 PM

Huh. I tried it just now, and it works. Did you set D0 to a reasonable number?

#9 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 27 October 2009 - 06:11 PM

Ya, I did (30). I just made a separate test quest, and it still didn't work. I'm pretty sure I'm setting something up wrong. Can you make a test quest and upload it somewhere so I can see how it's set up?

#10 Surreal Canine

Surreal Canine

    Master of Disaster

  • Members
  • Real Name:Brian
  • Location:Somewhere

Posted 27 October 2009 - 09:42 PM

I figured it out. There was a typo.
Fixed.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users