PDA

View Full Version : Link->HoldUpItem()?



Mega Link
12-24-2007, 03:56 PM
How do you make Link hold up an Item?

Joe123
12-24-2007, 05:12 PM
How are you giving him the item?

Mega Link
12-24-2007, 05:14 PM
Link->Item[26] = true

Joe123
12-24-2007, 05:16 PM
Oh dear.

Make him invisible, then put an ffc where he is that has the graphic of him holding up the item, and another ffc where the item should be.

Mega Link
12-24-2007, 05:25 PM
How do I do that?
I don't see an "LA_INVISIBLE" in std.zh.

Edit: I just found "LA_HOLD2LAND", but how do I use it?

Joe123
12-24-2007, 05:44 PM
Well.
That's a Link Action constant.

So you could try 'Link->Action = LA_HOLD2LAND;'
I've never tried setting Link's action though, only reading it.

Check ZScript.txt for things like that.

To make him invisible though, you have to make a dummy item with a link tile modifier that moves Link's tiles down to completely blank ones.
Quite a lot of hassle, but I find myself using it rather often.

Mega Link
12-24-2007, 05:51 PM
Well.
That's a Link Action constant.

So you could try 'Link->Action = LA_HOLD2LAND;'
I've never tried setting Link's action though, only reading it.

Check ZScript.txt for things like that.
I know that. I'm asking, how do I specify which item for Link to hold up?

Joe123
12-24-2007, 05:57 PM
You don't, you put an ffc with a it's combo set to the tile for the item you want it to look like at (Link->X, Link->Y-16).

So something like:

int timer; // just a utility integer
ffc hold = Screen->LoadFFC(32); // load the ffc you're going to set to be the item
for(timer = 0; timer < 60; timer++){ // for loop, loops until the conditions are met. Timer is set to 0, timer goes up one every frame, loops ends when timer reaches 60 (so 1 second)
Link->Action = LA_HOLD2LAND; // set Link to hold up the item
hold->Data =; // combo ID for the combo you make with the item's tile set here
hold->X = Link->X; // set the ffc to Link's X coordinate
hold->Y = Link->Y-16; // set it to one combo above Link's head
Waitframe(); // wait a frame. as you do.
}
Link->Action = 0; // just making sure he's not holding it up anymore here
hold->Data = 0; // make the item go away

Might work. Not too sure.
Obviously it's just a snippet, you'll have to glue it in where you need it.

EDIT: Explained the script.
Sorry for posting without explaining, I forget that you said you wanted to learn, throwing scripts at you won't help you learn unless they're explained, surely.

DarkDragon
12-24-2007, 06:40 PM
What about the obvious solution, spawning the item right on top of Link, with the "hold up item" screen flag checked? For items with side-effects (ammo, heart containers, etc.) you'll have to make a new "dummy" item that looks just like it, but does nothing, of course.

Joe123
12-24-2007, 06:54 PM
I didn't think Link held up scripted items?

Mega Link
12-25-2007, 01:05 PM
import "std.zh"
//Forest Store Script
//By Mega Link

ffc script ForestShop {
void run()
{
if (Link->Item[12] == true)
{Screen->Message(14);
Link->Item[12] = false;
Waitframe();
Screen->Message(15);
Link->Item[26] = true;
Waitframe();
int timer; ffc hold = Screen->LoadFFC(32);
for(timer = 0; timer < 60; timer++){
Link->Action = LA_HOLD2LAND;
hold->Data = 146;
hold->X = Link->X;
hold->Y = Link->Y-16;
Waitframe();
}
Link->Action = 0;
hold->Data = 0;
Screen->Message(16);
void quit;

} else {Link->Action = LA_FROZEN;
Link->Dir = DIR_UP;
Link->SwordJinx = -1;
Link->ItemJinx = -1;
Screen->Message(17);
Link->Action = 0;
Link->SwordJinx = 0;
Link->ItemJinx = 0;
void quit;
}
}
}

ffc script PlayMessage {
void run(int msgID)
{
Screen->Message(msgID);
}
}The red area of the script runs too fast!
How do I add a delay?

Edit: I tried using waitframes, but it doesn't wait.