GB Style Compass
#1
Posted 03 October 2008 - 07:14 AM
I'm thinking this may end up being a global script, which probably wouldn't affect me, seeing as I currently don't have any globals active.
#2
Posted 03 October 2008 - 09:17 AM
I believe there is also one here, as well.
Edited by blaman, 03 October 2008 - 09:18 AM.
#3
Posted 03 October 2008 - 10:03 AM
PureZC's thread on it
I am not sure if the scripts in either work correctly since I have not tested them.
#4
Posted 03 October 2008 - 05:17 PM
I'd try to script this myself, but I don't understand how to load screen items and see if the special item is no longer there, or if the item (placed by "i" when editing a room) is there, (Usually coincides with Enemies->Item)
#5
Posted 03 October 2008 - 06:28 PM
#6
Posted 03 October 2008 - 08:41 PM
that build 864 gives me the creeps nothing seems to work in that build..why dont you just try to use one of the younger builds there more stable and scripts works really good rather than 864.
Since this is like the first thing that doesn't work for me? Everything else works flawlessly.
#7
Posted 04 October 2008 - 02:08 AM
//EDIT: This version does not work due to a bug in b864. Use version 2 below.
import "std.zh"
//Gameboy style compass
//D0: level # of current dmap
//D1: use 0 if the key is a special item, or 1 if it is a regular item
//D2: sound effect to play when there is an item in the room
ffc script gbcompass
{
void run(int level, int mode, int sfx)
{
bool hascompass=false;
if( (Game->LItems[level]&LI_COMPASS) == LI_COMPASS ) hascompass=true; //If Link has compass, set variable to true
if(hascompass && mode==0 && !Screen->State[ST_SPECIALITEM]) //If Link has not gotten special item, play sound
{
Game->PlaySound(sfx);
}
else if(hascompass && mode==1 && !Screen->State[ST_ITEM]) //If Link has not gotten regular item, play sound
{
Game->PlaySound(sfx);
}
}
}
Edited by Elmensajero, 05 October 2008 - 10:47 PM.
#8
Posted 04 October 2008 - 07:42 AM
#9
Posted 04 October 2008 - 08:41 AM
#10
Posted 04 October 2008 - 08:47 AM
Edit: Ok, this is starting to get annoying, no matter what I try, I cannot seem to make it not play the sound again when I enter the screen when the NORMAL item is missing.
#11
Posted 04 October 2008 - 10:42 PM
//Version 2: Last updated 10/05/08
import "std.zh"
//Gameboy style compass
//D0: level # of current dmap
//D1: use 0 if the key is a special item, 1 if it is a regular item, or 2 if it is a boss key
//D2: sound effect to play when there is an item in the room
ffc script gbcompass
{
void run(int level, int mode, int sfx)
{
bool hascompass=false;
bool hasbosskey=false;
int keys=Game->Counter[CR_KEYS];
int lkeys=Game->LKeys[level];
if( (Game->LItems[level]&LI_COMPASS) == LI_COMPASS ) hascompass=true; //If Link has compass, set variable to true
if( (Game->LItems[level]&LI_BOSSKEY) == LI_BOSSKEY ) hasbosskey=true; //If Link has boss key, set variable to true
if(hascompass && mode==0 && !Screen->State[ST_SPECIALITEM]) //If Link has not gotten special item, play sound
{
Game->PlaySound(sfx);
}
if(hascompass && mode==1 && !Screen->State[ST_ITEM]) //If Link has not gotten regular item, play sound
{
Game->PlaySound(sfx);
}
if(hascompass && mode==2 && !hasbosskey)
{
Game->PlaySound(sfx);
}
while(true)
{
if(Game->Counter[CR_KEYS]>keys)
{
if(mode==0) Screen->State[ST_SPECIALITEM]=true;
else if(mode==1) Screen->State[ST_ITEM]=true;
Quit();
}
if(Game->LKeys[level]>lkeys)
{
if(mode==0) Screen->State[ST_SPECIALITEM]=true;
else if(mode==1) Screen->State[ST_ITEM]=true;
Quit();
}
Waitframe();
}
}
}
Edited by Elmensajero, 05 October 2008 - 10:49 PM.
#12
Posted 05 October 2008 - 07:20 PM
Now, one last request. Would it be possible to alter this to also work with the boss key? Seeing as the boss key is technically a key.
Anyways, thanks for this!
#13
Posted 05 October 2008 - 08:56 PM
#14
Posted 05 October 2008 - 10:59 PM
That could have been my problem, seeing as my level was on map seven. Hmm, if you have wrote up a workaround script, I guess I could use it.
Now, one last request. Would it be possible to alter this to also work with the boss key? Seeing as the boss key is technically a key.
Anyways, thanks for this!
Sure, I updated post 11 above ("version 2" of the script) to allow this as well. This introduces a new mode, specifically for boss keys. By the way, would it be helpful if I changed the script to have a constant sound effect variable you modify once, in the script, instead of adding the sound effect parameter to every single ffc? Or do you want to keep the option of being able to have different sound effects for different rooms?
the script works flawlessly but wouldnt it be possible to set this up as an ITEM script and attach it to the compass in the Action's tab? the compass works good and all, but when you receive the key and enter the same room , the sfx still plays on that same room even if the dungeon already's been completed.
Well, first of all, it could not be attached to the action portion of an item script, because the script would never be executed unless the compass was used as an actual selectable item. It would be difficult to set up the script as a pickup item script controlled by a global script (and avoid using it as an ffc script) because the locations of the rooms where the keys are would have to be hardcoded into the script, and so the script would become unusable to quest designers who don't know anything about scripting. As far as it playing the sound even after picking up the key, are you using version 2 of the script?
#15
Posted 05 October 2008 - 11:31 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users