Jump to content

Photo

Variable dmap target for Warp


  • Please log in to reply
3 replies to this topic

#1 NoeL

NoeL

    Legend

  • Members
  • Real Name:Jerram

Posted 08 October 2017 - 04:13 AM

Hi guys,
 
So, I don't know anything about zscript... but I need a script done. XD Here's the problem I'm trying to solve:
 
There are several different "versions" of the overworld, each with a different dmap. I want to be able to enter a dungeon from any version, then come back to that same version when leaving the dungeon. This means keeping track of which version of the overworld I'm entering from (in this case the triforce counter achieves that) and dynamically changing the side warp dmap target of dungeon screens that lead back to the overworld.
 
This is what I've come up with, but I can't even get it to load into zquest (giving me an error for the first line!)

import "std.zh"

global script TriforceExit // Sets the dmap warp target based on the triforce count
{
  void run()
  {
    while(Game->GetCurScreen() == Game->LastEntranceScreen)
    {			
      itemdata curTriforce = LoadItemData(I_TRIFORCE);
      int wScreen = Screen->GetSideWarpScreen(0);
      int wType = Screen->GetSideWarpType(0);
	
      Screen->SetSideWarp(0, wScreen, curTriforce.Amount ,wType);
      Waitframe();
    }
  }
}

So, if anyone would be kind enough to write a version that works I'd be very appreciative. Thanks!



#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 08 October 2017 - 04:41 AM

ffc script TriforceExit{
	void run(){
		int wScreen = Screen->GetSideWarpScreen(0);
		int wType = Screen->GetSideWarpType(0);
		int wDMap = Screen->GetSideWarpDMap(0);
		Screen->SetSideWarp(0, wScreen, wDMap+NumTriforcePieces(), wType);
	}
}

I feel like I just spat your own script back at you, except I fixed an error and made it an FFC. You pretty much had it all figured out yourself. :P

 

If the room you're putting the FFC in has a triforce in it, I believe you should offset the exit warp by 1 DMap to account for the extra triforce you'll get after the script runs.



#3 NoeL

NoeL

    Legend

  • Members
  • Real Name:Jerram

Posted 08 October 2017 - 05:10 AM

Works like a charm - thanks for that.



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 October 2017 - 05:22 PM

If you are at all curious, I do this in two parts. The first, is an ffc that stores the source dmap+screen into a global variable; and the second (on the destination screen), reads the global variable and sets the exit warp to match.

There aren't many other options, save for hand-warping Link. :D


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users