Jump to content

Photo

Clone map progress between two (nearly) identical maps.


  • Please log in to reply
1 reply to this topic

#1 ShadowTiger

ShadowTiger

    The Doctor Is In

  • Members

Posted 05 May 2017 - 10:33 PM

So imagine you're going through a dungeon and you encounter these odd gems above a few closed doors and some that are open. Later in the dungeon you find a switch that you step on that toggles these gem doors' states of openness and closedness. (Totally a word. :tard: )

The reason this effect works is because you're instantly warped to an identical copy of the entire map, except the states of those doors is the only difference between the two identical maps.

Now, let's assume we have the spacebar map enabled. Is there a way to have the map not look like it's been wiped after you step on that floor switch for the first time because you're now on a new map that you haven't been on yet?


tl;dr - how 2 join 2 maps 2gether plz on spacebar map.

Really, is there a way, really? Even if it involves scripting. I'm mostly curious.

#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 06 May 2017 - 12:13 AM

IoR had a script like this. I think I recall I wanted it for something at one point but was too lazy to rewrite it for my own quest. So thanks for unlazying me I guess. :P

//I have no idea if this will cause horrible problems
const int MAPCARRYOVER_CARRYALL = 1;

void MapCarryover(){
	//Set the indices of sourceMap to the maps we're checking for (for multistate dungeons you want all states of the dungeon in here)
	int sourceMap[] = {1, 2, 3};
	//Set destMap to the ones we're copying the state over to (0 for none)
	int destMap1[]  = {2, 3, 1};
	int destMap2[]  = {3, 1, 2};
	int destMap3[]  = {0, 0, 0};
	
	//Cycle to the array until we find the current map
	for(int i=SizeOfArray(sourceMap)-1; i>=0; i--){
		if(Game->GetCurMap()==sourceMap[i]){
			//If the constant is set, carry over all screen states
			if(MAPCARRYOVER_CARRYALL){
				for(int j=0; j<15; j++){
					Game->SetScreenState(destMap1[i], Game->GetCurScreen(), j, Screen->State[ST_VISITED]);
					if(destMap2[i]>0)
						Game->SetScreenState(destMap2[i], Game->GetCurScreen(), j, Screen->State[ST_VISITED]);
					if(destMap3[i]>0)
						Game->SetScreenState(destMap3[i], Game->GetCurScreen(), j, Screen->State[ST_VISITED]);
				}
			}
			//Otherwise just the visited one
			else{
				Game->SetScreenState(destMap1[i], Game->GetCurScreen(), ST_VISITED, Screen->State[ST_VISITED]);
				if(destMap2[i]>0)
					Game->SetScreenState(destMap2[i], Game->GetCurScreen(), ST_VISITED, Screen->State[ST_VISITED]);
				if(destMap3[i]>0)
					Game->SetScreenState(destMap3[i], Game->GetCurScreen(), ST_VISITED, Screen->State[ST_VISITED]);
			}
		}
	}
}

This function goes in your global's main loop before waitdraw. You'll want to change the arrays at the beginning to suit your quest, and be sure they're all the same size. If MAPCARRYOVER_CARRYALL is 1, it will try to carry everything over instead of just the visited state. So that's chest, lock blocks, room items, it basically does screen state carryover for you. I can't guarantee this won't have unforeseen consequences, though.


  • ShadowTiger likes this


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users