Jump to content

Photo

mapdata->EntryX and EntryY are not working


  • Please log in to reply
9 replies to this topic

#1 Mitchfork

Mitchfork

    no fun. not ever.

  • Contributors
  • Real Name:Mitch
  • Location:Alabama

Posted 10 November 2020 - 08:07 PM

I am modifying Fox's freeform shutter script and adding some new functionality.

 

https://www.purezc.n...e=scripts&id=61

 

One of the big ones is that if you fall into a Pitfall or Water combo, you'll respawn inside the shutter.  I want to use mapdata->EntryX and mapdata->EntryY to set these inside the script to avoid this.

 

This is the snippet I added to the code at the appropriate time....

int map = Game->GetCurMap();
int screen = Game->GetCurScreen();
mapdata richard = Game->LoadMapData(map,screen);
Trace(richard->EntryX);
Trace(richard->EntryY);
richard->EntryX = Link->X;
richard->EntryY = Link->Y;
Trace(richard->EntryX);
Trace(richard->EntryY);

And once Link is outside of the shutter, this gets printed via Trace(); (these are two different entries to the room).

 

http://puu.sh/GMa3C/b655016c2e.png

 

However, if I fall into a pit, Link still respawns inside the shutter, not at the coordinates printed via the script.

 

Am I doing it wrong? I can provide greater code context if needed.



#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 November 2020 - 05:59 AM

When you are on a screen, modifications to it's mapdata do not apply until you re-enter the screen. You want 'Screen->EntryX', not 'mapdata->EntryX'.

 

*There is an exception: If you use the current screen's temporary mapdata, using 'Game->LoadTempScreen(0);'. That's because calling this with a layer of 0 is effectively identical to writing to 'Screen->'.

But, this is rarely useful, and not a good idea for your problem. Using 'Screen->' is far easier.


  • Mitchfork likes this

#3 Mitchfork

Mitchfork

    no fun. not ever.

  • Contributors
  • Real Name:Mitch
  • Location:Alabama

Posted 11 November 2020 - 08:44 AM

Trace(Screen->EntryX);
Trace(Screen->EntryY);			
Screen->EntryX = Link->X;
Screen->EntryY = Link->Y;
Trace(Screen->EntryX);
Trace(Screen->EntryY);

I replaced the above code with this... but as far as I can tell, Link is still spawning inside of the shutter, not at the coordinates printed.  It is now resetting to (0,0) when I re-enter a room, which makes sense with how mapdata was working before.  Here's the trace printout:

 

http://puu.sh/GMms4/2c0f20363e.png



#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 November 2020 - 11:33 AM

....you should spawn at the entry coordinates, so unless you are setting them inside the shutter, you shouldn't spawn in the shutter.



#5 Mitchfork

Mitchfork

    no fun. not ever.

  • Contributors
  • Real Name:Mitch
  • Location:Alabama

Posted 11 November 2020 - 12:39 PM

Yeah - it's just not actually doing what it should.  I added a Trace printout to my Hero script as well - when Hero->Falling==70, it will print out what it thinks the entry coordinates are...

Spoiler

And this is the output while running:
tEQB2Qh.png
 
And this is a screenshot showing where those coordinates are vs. where I'm actually respawning:
DeM4fOT.png

So I think there's something else going on here I think. Screen->Entry* is definitely set as it should be and is not getting overwritten by any other code.
I also have water on the screen to test and drowning is yielding the same results.

 

Using the latest build, 2.55 a83 b52.



#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2020 - 08:24 AM

I will look into it. For now, you can get around this as follows:

 

mapdata m = Game->LoadTempScreen(0);
m->EntryX = Link->X;
m->EntryY = Link->Y;
Trace(m->EntryX);
Trace(m->EntryY);

 

This, as-is, without a pending instruction rule should work for the current screen.


  • Bagu likes this

#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2020 - 09:37 AM

Please send the quest and the scripts to me. I think that this is a simple timing issue, as writing Screen->EntryX, EntryY, should both write to tempscr right now. I suspect that the entry point is being set on screen init, before you phase Link through the fake shutter. 



#8 Mitchfork

Mitchfork

    no fun. not ever.

  • Contributors
  • Real Name:Mitch
  • Location:Alabama

Posted 12 November 2020 - 11:15 AM

Sure, here is the quest and my scripts folder that I do all my imports from.  You should walk one screen to the left for my testing screen - the crumble floor tiles will turn into pitfalls if you stand on them half a second, or you can use the water combos in the middle of the room.

 

https://drive.google...iew?usp=sharing

 

I did try setting this through LoadTempScreen as mentioned above and this did not change anything.  Tracing Screen->EntryX did correctly display the parameters that I was setting to mapdata->EntryX.

 

I don't think it's a timing issue - like I said, the traced coordinates are what they should be, but it's possible.  Thanks for taking a look.



#9 Mitchfork

Mitchfork

    no fun. not ever.

  • Contributors
  • Real Name:Mitch
  • Location:Alabama

Posted 15 November 2020 - 12:07 AM

Sorry to double post - I saw in the 2.55 a85 build release that "Added a script quest instruction setting to cause Link's respawn points to match script-written EntryX and EntryY for Screen->Entry*" was in the changelog.  This has enabled my script to work, thank you. 

 

I do want to note that setting EntryX and EntryY via mapdata with Game->LoadTempScreen(0) does not work for the currently active screen, even though reading Screen->EntryX will look identical.  I don't really know if this is intended behavior for any reason.


Edited by Ebola Zaire, 15 November 2020 - 12:07 AM.


#10 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 16 November 2020 - 05:46 PM

As of Alpha 85, these should now work as anticipated. You may need to toggle a rule for your quest:

Zscript (Menu)->Quest Script Settings->Instructions->Writing EntryX, EntryY, Resets Spawn Points. 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users