Jump to content

Photo

Question about the map


  • Please log in to reply
16 replies to this topic

#1 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 10:38 AM

I want to have a dungeon map that will simply allow the player to look at the map when pressing the space bar (and nothing else). The "nothing else" part is easy as I only need to remove the minimap feature from the subscreen.

The issue I'm having is that the space bar map is either activated or not by default in the dmap. Is there a way to disable it, yet enable it once the player has the map item? With a script, maybe?

#2 Avaro

Avaro

    >w<

  • Members

Posted 11 May 2013 - 10:49 AM

Theres no way to do it without scripting. Except you could maybe have a duplicate DMap for the entire dungeon and once Link gets the item, you warp him to the other DMap. That'd be a solution.

But it's extremely easy to do with scripting:

import "std.zh"
const int customMapItem = 123; //set this to the item ID of your map item
global script active{
void run(){
	 while(true){
		 if ( !Link->Item[customMapItem] ) {
		 Link->InputMap = false; Link->PressMap = false;
		 }
		 Waitframe();
	 }
}
}

(this script disables the map button for the entire game until Link has the item. it is not scripted to work for individual dungeons and places yet, lol) :)

Edit: by scripting, you could even display a message that says that you're in need of a map, when you press the map button without having the map. Just an idea..

If you're going to do it by DMap warping, then be sure to use Screen State Carryovers, to turn the entrance combo of the dungeon on the overworld into another warp (B for example) that warps you to the second DMap.

Edited by Avataro, 11 May 2013 - 10:57 AM.

  • Bagu likes this

#3 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 10:59 AM

Having a duplicate dmap is more trouble than it is worth for me (I already have a lot of scripts which are dmap specific, so it'll mess everything up).

Perhaps it would be possible to have a different map item for each dungeon, and edit the script so it tells ZC:
- If Link has map item X, and is currently in dmap X -> enable the spacebar map
- Otherwise -> disable it
?

#4 grayswandir

grayswandir

    semi-genius

  • Members

Posted 11 May 2013 - 11:17 AM

You can actually tell if you have the map for a level in scripting. No need for a custom item (untested):
if (Game->LItems[Game->GetCurLevel()] & LI_MAP) {
Of course, this makes you need a map for the overworld too.

Edited by grayswandir, 11 May 2013 - 11:19 AM.


#5 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 11:35 AM

I have tried having this in the global script:
if (Game->LItems[Game->GetCurLevel()] & LI_MAP) {
Link->InputMap = true; Link->PressMap = true;				
}
else{
Link->InputMap = false; Link->PressMap = false;  
}

but no luck, the map works no matter what.

#6 grayswandir

grayswandir

    semi-genius

  • Members

Posted 11 May 2013 - 11:45 AM

Try this:
if (!(Game->LItems[Game->GetCurLevel()] & LI_MAP)) {
  Link->InputMap = false; Link->PressMap = false;}

Setting them both to true every frame means it's acting like you're always holding down the map button.

Edit: I confirmed it working:
import "std.zh"

global script Active {
  void run() {
    while (true) {
      if (!(Game->LItems[Game->GetCurLevel()] & LI_MAP)) {
        Link->InputMap = false;
        Link->PressMap = false;}
      Waitframe();}}}

Edited by grayswandir, 11 May 2013 - 11:48 AM.


#7 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 11:56 AM

I've just tried, the map still works even without the map item :eyebrow:

#8 grayswandir

grayswandir

    semi-genius

  • Members

Posted 11 May 2013 - 12:05 PM

Here's how I have it set up?
Example Quest

Does that work for you?

#9 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 12:18 PM

This is really puzzling. It works fine in your example, and I believe everything is set up the same way in the quest I'm working on, yet it doesn't work for me.

Here is my full global script, if that helps:

global script active
{
void run()
{
	 //Autoghost init
	 StartClock();
InitializeGhostZHData();

	 while(true)
	 {
		 //Autoghost loop
UpdateGhostZHData();
		 UpdateEWeapons();
UpdateClock();
		 CleanUpGhostFFCs();
	 Waitdraw();
DrawGhostFFCs();
AutoGhost();

	 //Bomb ammo fix
		 if(Game->Counter[CR_BOMBS]>0 && !Link->Item[I_BOMB]) {Link->Item[I_BOMB]=true;}

//Platform script
NesMovementFix();
		 MovingPlatforms();

//Map
if (!(Game->LItems[Game->GetCurLevel()] & LI_MAP)) {
Link->InputMap = false;
Link->PressMap = false;
}

	 Waitframe();
	 }
}
}


#10 grayswandir

grayswandir

    semi-genius

  • Members

Posted 11 May 2013 - 12:24 PM

Maybe you already have the map you're testing it out on?

Other than that, I really don't know.

Edited by grayswandir, 11 May 2013 - 12:25 PM.


#11 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 12:34 PM

It has to do with my global script. I have tried adding it to your example quest and when I do that the map no longer works.

Here it is again, except I have commented the platform functions so it can compile:

global script active
{
void run()
{
         //Autoghost init
         StartClock();
InitializeGhostZHData();

         while(true)
         {
                 //Autoghost loop
UpdateGhostZHData();
                 UpdateEWeapons();
UpdateClock();
                 CleanUpGhostFFCs();
         Waitdraw();
DrawGhostFFCs();
AutoGhost();

         //Bomb ammo fix
                 if(Game->Counter[CR_BOMBS]>0 && !Link->Item[I_BOMB]) {Link->Item[I_BOMB]=true;}

//Platform script
// NesMovementFix();
// MovingPlatforms();

//Map
if (!(Game->LItems[Game->GetCurLevel()] & LI_MAP)) {
Link->InputMap = false;
Link->PressMap = false;
}

         Waitframe();
         }
}
}


#12 grayswandir

grayswandir

    semi-genius

  • Members

Posted 11 May 2013 - 12:40 PM

Does it work if you comment everything else out?

#13 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 11 May 2013 - 12:47 PM

Strangely, no.

#14 grayswandir

grayswandir

    semi-genius

  • Members

Posted 11 May 2013 - 01:34 PM

I'm thinking you probably already have the map then, for some reason or another. You can confirm by putting a
TraceB(Game->LItems[Game->GetCurLevel()] & LI_MAP);
in there and seeing if the log keeps printing true.

#15 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 12 May 2013 - 07:33 AM

Never mind about commenting everything out - I had missed something.

I have identified the culprit: the Waitdraw(); command. I don't know why it's doing that. But it's needed for the ghosted enemies to work.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users