PDA

View Full Version : Script request: NPC follows Link around



Ricky of Kokiri
03-27-2008, 09:46 PM
I'd like to have, for a short portion of my quest, someone following Link around like Zelda and Marin did in ALttP and LA. Has a script been written for this sort of thing? If not, could someone please write one?

Thanks. :)

Russ
03-27-2008, 10:11 PM
I do believe I saw one sometime, but I am not sure where it is now. Regardless, it should be fairly simple to make.

The_Amaster
03-27-2008, 10:21 PM
Yeah, I can imagine roughly how you'd do it, but the specifics are beyond me. Someone like Joe123 or Gleeok shouldn't have too much trouble with it though.

Revfan9
03-27-2008, 10:25 PM
I actually made this exact script before. I can't find any of my old ones now, so don't ask for them. Basically, it worked by keeping the FFC still, then moving it to a position behind link every 3 seconds. It made the NPC follow Link a bit lazily, but it was a nice effect.

Gleeok
03-28-2008, 06:06 AM
Funny, but I just explained to Joe123 my take on how to script this. Not sure if he has any code or not, but in any event I'm waiting for the next build to come out before I work on it. sorry. I'll post it here when I finish it.

Joe123
03-28-2008, 03:39 PM
?
No you didn't =P

What you did was read my code wrong, said it might apply to this and told me to move my Waitframe(); :laughing:

It doesn't, it's a custom Moldorm =P


Thanks anyway though, moving the Waitframe is still nice to know =P

Gleeok
03-28-2008, 05:55 PM
Yes I did. It's all the same crap; Moldorms, monkeys, the Options from Gradius.

Did you even try moving the waitframe? The way you had it set up was the enemy was always a frame behind the ffc.

Joe123
03-28-2008, 06:15 PM
yah, but did you check what my script does?
It bounces off walls...
I don't get what it has to go with monkeys and gradius...

And no, I haven't tried moving the Waitframe();, I just made the enemy invisible and the ffc have the graphic, I'll do that Waitframe(); trick next time.

Pineconn
03-28-2008, 09:29 PM
Not sure if he has any code or not, but in any event I'm waiting for the next build to come out before I work on it.

Which means in 6-12 weeks (or until Brawl becomes old news). :p

This would be a nice script to have, like to make an OoT remake so that you can have Navi follow you around. (All. Game. Long.)

Gleeok
03-28-2008, 09:52 PM
Which means in 6-12 weeks (or until Brawl becomes old news). :p

Ugh...Stupid brawl. I don't even have a wii. ...well you can't play brawl on my wii anyways. :p



This would be a nice script to have, like to make an OoT remake so that you can have Navi follow you around. (All. Game. Long.)

Well at some point I plan on scripting the options from Gradius, which could be used for all sorts of things that follow the player around. I'm just thinking arrays would make this easier to script.

Joe123
03-28-2008, 10:09 PM
Which means in 6-12 weeks (or until Brawl becomes old news). :p

This would be a nice script to have, like to make an OoT remake so that you can have Navi follow you around. (All. Game. Long.)


OHHH!

You lot just want an ffc to follow Link around?


if(Link->Item[I_LEAF]){
if(epona) xspd = 1.4;
else xspd = 1;

if(fairyinit){
leaf->Flags[0] = true;
leaf->Flags[3] = true;
leaf->Data = fairycombo+1;
leaf->CSet = 10;
fairyinit = false;
ran = Rand(28) + Link->X - 16;
leaf->X = ran;
ran = Rand(28) + Link->Y - 16;
leaf->Y = ran;
}
if(screennumber != Game->GetCurScreen()){
ran = Rand(28) + Link->X - 16;
leaf->X = ran;
ran = Rand(28) + Link->Y - 16;
leaf->Y = ran;
}
x1 = leaf->X; x2 = Link->X;
y1 = leaf->Y; y2 = Link->Y;

if(t == tcap){
ran = Rand(5)/10+0.4;
if(Rand(2) == 1) ran *= -1;
leaf->Vx = ran;
ran = Rand(5)/10+0.4;
if(Rand(2) == 1) ran *= -1;
leaf->Vy = ran;
t = 0;
dircheck = true;
}

if(Distance(x1, y1, x2, y2) > 32){
if(x1 < x2){
ran = Rand(5)/10+xspd;
leaf->Vx = ran;
}
if(y1 < y2){
ran = Rand(5)/10+xspd;
leaf->Vy = ran;
}
if(x1 > x2){
ran = Rand(5)/10+xspd;
leaf->Vx = -ran;
}
if(y1 > y2){
ran = Rand(5)/10+xspd;
leaf->Vy = -ran;
}
dircheck = true;
}
if(dircheck){
if(leaf->Vy < 0 && (Abs(leaf->Vx) < 0.6)){leaf->Data = fairycombo; dircheck = false;}
if(leaf->Vy > 0 && (Abs(leaf->Vx) < 0.6) && dircheck){leaf->Data = fairycombo + 1; dircheck = false;}
if(leaf->Vx < 0 && dircheck){leaf->Data = fairycombo + 2; dircheck = false;}
if(leaf->Vx > 0 && dircheck){leaf->Data = fairycombo + 3; dircheck = false;}
}

if(Link->InputR){
if(cantalk && !falling && Link->Action != LA_FROZEN && Link->Z == 0 && srpt == 0){
Game->PlaySound(leafsfx);
Screen->Message(leafstring);
srpt = 60;
}
}
if(srpt > 0) srpt--;
screennumber = Game->GetCurScreen();
t++;
}

I wrote that a few weeks ago, Link has a fairy friend in aKttH.

Pineconn
03-29-2008, 02:01 AM
OHHH!

You lot just want an ffc to follow Link around?

Isn't that what Ricky of Kokiri asked for? ;) Regardless, this would be fun to experiment with as some sort of curse, like the ghost from Link's Awakening.

Joe123
03-29-2008, 06:17 AM
Well, mines for a fairy, so it flies randomly around above Link's head.

Not quite so useful for Marin or Zelda.
Might work for the ghost though perhaps.

Gleeok
03-29-2008, 06:28 AM
Wait, what exactly does *= -1; do?

Joe123
03-29-2008, 12:42 PM
Multiplicative Assignment.

'*=' == 'Take the current value of the integer, and multiply it by the integer on the right'

'foo *= -1; ' == 'foo = -foo;'

Gleeok
03-29-2008, 07:43 PM
Uh-oh, you're getting crazy with this stuff now. ;p Care to explain a modulous to me also? I don't get that one. Gleeok % modulous.

Oh, and remember that do loop?

I think it's like:

do assignment; while(condition)


it's like a fancypants version of an if(condition) assign....

Joe123
03-29-2008, 08:07 PM
heh yeah :cool:

modulus:

40 % 3
will return 1.

59 % 17
will return 8.

5 % 2
will return 1.

'Take the first number, divide it by the second number and return the remainder'.

Don't do modulus with 0 ;)

I know what it does, but I'm yet to find a use for it though.


Ah yeah, I understood that do loop, but I don't really get why you can't just use a while :confused:

bob1000
06-11-2008, 10:19 PM
Here's an idea: rather than have an FFC follow Link around, have an enemy follow him (like in those RPGs where you have a pet). And no, I'm not referring to any unscripted enemy.
*The "pet" and its weapons will target and damage enemies, but not Link.
*The "pet" cannot be damaged.
*Whether the "pet" follows Link or not is determined by whether Link has a certain item.
*When Link enters a screen, the "pet" spawns on Link's coordinates. If the "pet" is a certain distance in pixels from Link, it will respawn near Link.
*Recommended "pet" weapon: fireballs.

Russ
06-11-2008, 10:57 PM
Sounds a lot like bow wow from LA to me. It could probably be done. it would be hard, but probably doable.

bob1000
06-18-2008, 11:34 AM
Actually, I suppose I could just use Joe's fairy script. Now I just need it to spawn Lweapons (that way they damage enemies, not Link).