Jump to content

Photo

Sidescroll Ladder script needed.


  • Please log in to reply
14 replies to this topic

#1 Surreal Canine

Surreal Canine

    Master of Disaster

  • Members
  • Real Name:Brian
  • Location:Somewhere

Posted 10 December 2007 - 01:54 PM

I need a script for a flag that lets Link move up and down normally when Sideview Gravity is on.
I want it to work like the ladders in Link's Awakening did: when Link is standing on the flagged (walkable) combo, he can move up and down without falling. But when he moves off the combo, he'll fall.

Does anybody have what it takes to script this?
(buld 679)

#2 Dawnlight

Dawnlight

    My name is NOT Jason!

  • Members
  • Real Name:Justin
  • Location:Chicago, IL

Posted 10 December 2007 - 09:06 PM

Same Here.

#3 Joe123

Joe123

    Retired

  • Members

Posted 10 December 2007 - 09:11 PM

According to a certain Mr. Gleeok, this is on the to-do list, so it's not worth someone scripting it.

#4 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 10 December 2007 - 09:20 PM

Actually, I believe it was more along the lines of "This might be on the to do list, you should check it out first."

Want a quick answer, you'll probably have to pester L about it. I'm doubting the implementation of ladder combos in 2.5 more and more these days.

Edited by Gleeok, 10 December 2007 - 09:22 PM.


#5 Joe123

Joe123

    Retired

  • Members

Posted 11 December 2007 - 03:00 AM

In which case, I might have a look at it next week =P

How would you go about doing that Gleeok? Changing Link's Y coordinate every frame?
It's a shame we don't have control of the screen flags.

#6 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 12 December 2007 - 01:51 AM

I haven't used gravity yet so i'm unsure of how L made it. The easiest way would be to set Links "float" or (Z?) if that's possible. I dunno if it'll work though. If not maybe try:

if(Link->InputUp){ Link->Y -= 0.3;}

would be the next thing i'd do, along with some ComboAt and canMove or ComboS acrobatics.

#7 Joe123

Joe123

    Retired

  • Members

Posted 12 December 2007 - 03:07 AM

Yeah, that was what I was thinking.
I, personally, wouldn't try to move Link less than a pixel though, you can't just up the systems resolution because you want sidescrolling ladders =P

#8 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 12 December 2007 - 03:53 PM

Actually, storing decimals for coordinates for ffc's works great, so i've found out. I use this alot for bosses now.

...and it doesn't change the resolution silly, it just stores the data.

#9 Joe123

Joe123

    Retired

  • Members

Posted 12 December 2007 - 04:02 PM

Yes, but you can't put things to the coordinates (15,17.5) because they're pixel coordinates, and ZC can't put things at a smaller denomination than a pixel; that would require a higher resolution engine.

#10 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 12 December 2007 - 05:20 PM

Well try it and see for yourself. icon_wink.gif

#11 Joe123

Joe123

    Retired

  • Members

Posted 12 December 2007 - 05:21 PM

I did...
Didn't work for Link in any case

#12 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 12 December 2007 - 05:26 PM

AH, well that sucks. I was more referring to this working great on ffc's, and assumed you could do the same with Link.

..well good luck with that then!

#13 Joe123

Joe123

    Retired

  • Members

Posted 12 December 2007 - 05:32 PM

If you want to increment the movement of things by less than one pixel, you just have to do them every other frame or in smaller denominations instead.

#14 Surreal Canine

Surreal Canine

    Master of Disaster

  • Members
  • Real Name:Brian
  • Location:Somewhere

Posted 13 December 2007 - 12:58 PM

The wait is over! A script for sidescroll ladders is finally here!
CODE

import "std.zh"

//Courtesy of Saffith, beefster09, and pkmnfrk
bool isSolid(int x, int y) {
  
  if(x<0 || x>255 || y<0 || y>175) return false;
  int mask=1111b;
    
  if(x % 16 < 8)
    mask &= 0011b;
  else
    mask &= 1100b;
  
  if(y % 16 < 8)
    mask &= 0101b;
  else
    mask &= 1010b;
  
  int ret = Screen->ComboS[ComboAt(x, y)] & mask;
  return (ret!=0);

}

ffc script ladder {
  void run(int f) {
    if(f == 0) f = 98;
    
    while(true) {
      if(Screen->ComboF[ComboAt(Link->X+8, Link->Y)] == f) {
        if(Link->Jump < 0) Link->Jump = 0;
        
        if(Link->InputDown) {
          if(!isSolid(Link->X, Link->Y + 1)) Link->Y += 1;
        }
        if(Link->InputUp) {
          if(!isSolid(Link->X, Link->Y - 1)) Link->Y -= 1;
        }
      }
      Waitframe();
    }
  }
}

The way this script works is: On every screen where you have ladders, make an invisible FFC with this script. Then put flag 98 on every "ladder" combo on that screen.
Thank you, pkmnfrk!

#15 pkmnfrk

pkmnfrk

    Initiate

  • Members
  • Real Name:Mike Caron

Posted 13 December 2007 - 07:34 PM

(Wow, I can't remember registering for an account here, must've been a while ago)

In case I update this (which has a non-zero chance), the script is hosted on my site:

http://zctut.com/ladder.php


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users