Jump to content

Photo

GB Style Compass


  • Please log in to reply
18 replies to this topic

#1 Sephiroth

Sephiroth

    The Legendary Sephiroth

  • Members
  • Location:Somewhere... Lemme know if you find me :)

Posted 03 October 2008 - 07:14 AM

Ok, I don't know whether or not this may be possible, however, I want a way to make the compass item work like it would in the GB games, where if you enter a screen where a key is, it will play a tone. However, if you've already grabbed the key, it won't play the tone upon screen entry.

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 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 03 October 2008 - 09:17 AM

I made half of a script like that over at AGN (Can't link to it right now.) The only problem is that it doesn't work with the compass, and it'll still play a sound if you picked-up the item. However, in the same thread, Joe123 made one that DOES work with the compass, but I'm not sure if it won't work if you have found the item already though. It's an FFc script, though, so that's a bonus, I guess.

I believe there is also one here, as well.

Edited by blaman, 03 October 2008 - 09:18 AM.


#3 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 03 October 2008 - 10:03 AM

AGN's thread on it
PureZC's thread on it

I am not sure if the scripts in either work correctly since I have not tested them.

#4 Sephiroth

Sephiroth

    The Legendary Sephiroth

  • Members
  • Location:Somewhere... Lemme know if you find me :)

Posted 03 October 2008 - 05:17 PM

Nothing I can find seems to work in 864. icon_shrug.gif

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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 03 October 2008 - 06:28 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.

#6 Sephiroth

Sephiroth

    The Legendary Sephiroth

  • Members
  • Location:Somewhere... Lemme know if you find me :)

Posted 03 October 2008 - 08:41 PM

QUOTE(drzchulo973 @ Oct 3 2008, 06:28 PM) View Post

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 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 04 October 2008 - 02:08 AM

Okay, here you go, a working gameboy compass script. It is an ffc script, so just place it on all of the screens where a key is. The inputs are all explained within the script. There is one bug I found that I think has to do with ZClassic: treasure chest combos do not work with the script. However, all other special item types (item cellar, armos, tall grass with inherent flag 10) work correctly. I am going to post this bug over at AGN, so hopefully by the next build this script will be working perfectly.

CODE

//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 Sephiroth

Sephiroth

    The Legendary Sephiroth

  • Members
  • Location:Somewhere... Lemme know if you find me :)

Posted 04 October 2008 - 07:42 AM

Hmm, the script works fine. However, even if I have the key as a normal item on the screen, the tone plays even after I have picked up the item. Other than that, this is perfect.

#9 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 04 October 2008 - 08:41 AM

Really? It doesn't play the sound again for me, unless I use treasure chest combos in special item mode. So if for example you set it up with special item mode, set the key as a special item, and used an item cellar for the player to get the key, the sound should not play in that room anymore after getting the key. Make sure that your level number matches the dmap as well, that could cause problems.

#10 Sephiroth

Sephiroth

    The Legendary Sephiroth

  • Members
  • Location:Somewhere... Lemme know if you find me :)

Posted 04 October 2008 - 08:47 AM

Level number matches. Sounds replay always. I have two keys in chests, three others are normal items, one is the result of Enemies->Item. Sound always replay on each of the five screens no matter what. icon_razz.gif It's a good start. icon_smile.gif

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. icon_shrug.gif

#11 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 04 October 2008 - 10:42 PM

Wow, one script finding two bugs is weird. Okay, this definitely made me think I was going crazy. I had tested everything in one quest file, so I decided to start a new one to show how I had set everything up. However, I did it a little differently (without realizing it), and when I tested it, everything stopped working, just like it did for you. I finally found out what the problem was: if you place the level on map 0, everything works fine. If you place it on map 1 (or higher I suppose, I didn't try), the screen state variables are not updated. So, here is a rewrite of the script. It should work on all maps, but it only works with keys or level keys now, whereas the original script worked with any item. The treasure chest combos work perfectly fine with this one, the only problem is item cellars, since you leave the screen to go there. Setup is the exact same as before.

CODE

//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 Sephiroth

Sephiroth

    The Legendary Sephiroth

  • Members
  • Location:Somewhere... Lemme know if you find me :)

Posted 05 October 2008 - 07:20 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. icon_blah.gif

Anyways, thanks for this! icon_biggrin.gif

#13 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 October 2008 - 08:56 PM

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.

#14 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 05 October 2008 - 10:59 PM

QUOTE(Sephiroth @ Oct 5 2008, 08:20 PM) View Post

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. icon_blah.gif

Anyways, thanks for this! icon_biggrin.gif


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?

QUOTE(drzchulo973 @ Oct 5 2008, 09:56 PM) View Post

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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 October 2008 - 11:31 PM

yea im using version 2 of the script..when the key is already picked up the sound still plays...its probably because the sound is set to the FFC in the arguments tab..theres no other explanation for it i guess.. icon_confused2.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users