PDA

View Full Version : Script Request: Shutters at Item Quantity



Lelouche Vi Britannia
03-23-2018, 08:16 PM
This is for another project I'm working on. I have no idea how to even begin this one or if its possible.

I would like a script that will only open a set of dungeon Shutters if you have a specific number of a collectable item. The script does not have to be fancy, just able to take 2 arguments; item to look for, and quantity of that item.

Option for more than one unique item would be nice but not necessary. Thanks to whoever decides to attempt this one.

ZoriaRPG
03-23-2018, 11:44 PM
D0: Item ID. Use a negative value for a counter ID.
D1: Counter minimum if D0 is < 0.
D2: Door direction to open. Uses standard direction values (see std_constants.zh)



ffc script OpenShutters
{
void run(int itm, int quantity, int direction)
{
bool do_open;
while(1)
{
if ( itm < 0 ) //counter
{
if ( Game->Counter[itm*-1] >= quantity )
{
do_open = true;
}
}
else if ( itm > 1 && itm < 256 )
{
if ( Link->Item[itm] )
{
do_open = true;
}
}
if ( do_open )
{
Screen->Door[direction] =D_OPEN;
Game->PlaySound(SFX_SHUTTER);
this->Data = 0; Quit();
}
Waitframe();
}
}
}

Lelouche Vi Britannia
03-24-2018, 11:15 AM
Woot! Zoria to the rescue. Thanks a lot for this. I do feel a bit silly though as the script is simpler than I thought it would be.

ZoriaRPG
03-25-2018, 08:50 AM
Woot! Zoria to the rescue. Thanks a lot for this. I do feel a bit silly though as the script is simpler than I thought it would be.

Not a problem. Opening shutters is quite easy. I wasn't sure if you wanted counter-based mechanics, from reading your post, but it's the only thinng that makes sense for a 'quantity' field, per yourrequest.

Closing shutters is just a matter of writing to Screen->Door[], too..

I fixed a typo in the script, in the event that you didn't catch it.

Lelouche Vi Britannia
03-25-2018, 10:25 PM
Haven't copied it yet but thanks for that.

And yeah quantity was what I was really looking for. The quest idea has a central hub with teleporters that lead to dungeons. Each one has a collectable. Once enough collectables are gained, the shutters open revealing the next sets of dungeons. So kinda like Gauntlet Dark Legacy only in Zelda form. There is a lot more to it than this but this script is necessary for the main method of advancement further into the content.