PDA

View Full Version : Give A Key To Another Level



pkmnfrk
04-14-2009, 11:50 PM
Real simple snippet today, with debatable use, but here it is anyway:


//Gives link a key for level (CurLevel - 9)
item script LevelXKey {
void run() {
Game->LKeys[Game->GetCurLevel() - 9]++;
}
}

Basically, you assign this script to an item, and it gives you a key in the numbered level (X - 9). What is the purpose, you ask? Well, let me answer!

I came up with this to go with an idea for a quest I want to make. In this quest, there are seventeen main dungeons. There's Levels 1 - 9, which are as in an ordinary quest (Triforce pieces/Ganon/whatever), and then there's Levels A - H (numbered 10 - 17). These extra levels are actually prerequisites to competing the first eight dungeons. This is accomplished by sticking a locked door at the entrance to each dungeon.

I created an item of type "Triforce Pieces", gave it a "Cutscene" of 1, and this script, and suddenly I have an end of dungeon item that "unlocks" another dungeon!

The tl;dr version: If you give this script to a Triforce item, and put this item in levels 10 - 17, you can use it to unlock levels 1 - 8.

Joe123
04-15-2009, 06:36 AM
When I read the topic title I thought it was gonna be a little more like this:

ffc script LevelKey{
void run(int level){
Game->LKeys[level]++;
}
}

pkmnfrk
04-15-2009, 07:29 AM
I only just now realized that the arguments tab in the item editor also applies to the pickup script, as well as the use script? Dur.

Of course, to use your script, you would need a separate item for every level for which you want to give a key.

Joe123
04-15-2009, 07:33 AM
Why's that?
It's an ffc script.

pkmnfrk
04-15-2009, 09:22 AM
Oh, hey, look at that. So it is. Do note that mine is an item script.

In other words, our scripts are totally different, and used for different purposes?

Joe123
04-15-2009, 09:35 AM
Well, I just posted what I thought when I saw the thread title :shrug:

If you're using yours to give Link a key when he recieves a triforce piece though, and you're using a cutscene to do it, placing this script on one of the screens of the cutscene would acheive the same effect.
Not that it's better, just a different way of doing it.

pkmnfrk
04-15-2009, 10:20 AM
True. Again, I wrote it for the purpose I described, and thought "Hey, someone else might be able to use this!"

Also, two minor flaws with your script:

1. You can trigger it more than once, and
2. You could trigger it without actually getting the Triforce piece.

And, just for completeness' sake, I could also achieve the effect I wanted with a script like this:


ffc script UnlockLevelIfCompletedOtherLevel {
void run(int lev) {
if((Game->LItems[lev] & LI_TRIFORCE) != 0) {
Screen->Door[DIR_UP] = D_OPEN;
}
}
}

Joe123
04-15-2009, 01:08 PM
Well, not if it's in a cutscene.
If you put it on a screen you can only enter once, you can only get it once.

And that's true, but if you put it on a screen where you're warped on top of a triforce item (I'm probably imagining this differently to you), there would be a 4 frame gap between getting one and getting the other.

Yeah, you could do that if you were using the door template tool. Can't say I like it personally.

Although it wouldn't be hard to change it to work without using the template.