Jump to content

Photo

finally... a script!


  • Please log in to reply
12 replies to this topic

#1 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 15 May 2008 - 10:27 AM

ok so youre maybe wondering why someone would need doors on the overworld. Remember the Minsh cap? if link stood under a door and pushed on it, it would open. (if it wasn't locked)

so here is a script i made for house doors, kind of like MC. there is a small delay in the time it takes for the door to open.



D0 is the combo to use for a door that link would walk through going upward
D1 same as D0, but to the right
D2 to the left
D3 downward

^all combos in the arguments should be closed door tiles

the combos that are used for the closed doors cycle one combo to the right, turning them to open doors.

CODE
import "std.zh"

ffc script house_door{
    void run(int c1, int c2, int c3, int c4);

        if(ComboAt(Link->X, (Link->Y-16))==c1 && Link->InputUp==true){//for an upward door
            Waitframes(5);
            ComboD[c1]++;
        }

        if(ComboAt(Link->X+16), Link->Y)==c2 && Link->InputRight==true){//to the right
            Waitframes(5);
            ComboD[c2]++;
        }

        if(ComboAt(Link->X, (Link->Y-16))==c3 && Link->InputDown==true){//down
            Waitframes(5);
            ComboD[c3]++;
        }

        if(ComboAt((Link->X-16), Link->Y)==c4 && Link->InputLeft==true{//left
            Waitframes(5);
            ComboD[c4]++;
        }
    }
}


i haven't tested it yet, so i am not sure how the ComboD[]++ parts will work...

Edited by Master Maniac, 15 May 2008 - 10:30 AM.


#2 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

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

Posted 15 May 2008 - 11:22 AM

It's a good start, but a few things;

You need a while loop.
Check you parenthesis.
What comboAt equals 'c1', and where combo D? I'm not sure it will do anything in it's current state.

#3 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 15 May 2008 - 11:43 AM

i absolutely have to have a while loop?

i hoped it would trigger those when the conditions are met...

but yeah i figured it would have a few problems. ill fix it later.

thanks gleeok =)

#4 Joe123

Joe123

    Retired

  • Members

Posted 15 May 2008 - 12:30 PM

Yes, you can't not have a while loop.

While loop says 'run all this every frame while Link's on the screen'.

Your script says 'run this once when Link first enters the screen'.



I was going to post my version of this script, but then I realised actually it'd be nice not to rob your thread =P

#5 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 15 May 2008 - 07:28 PM

CODE
import "std.zh"

ffc script house_door{
    void run(int c1, int c2, int c3, int c4);
        while(true){
        if(ComboD[ComboAt(Link->X, (Link->Y-16))]==c1 && Link->InputUp==true){//for an upward door
            Waitframes(5);
            ComboD[c1]++;
        }

        if(ComboD[ComboAt((Link->X+16), Link->Y)]==c2 && Link->InputRight==true){//to the right
            Waitframes(5);
            ComboD[c2]++;
        }

        if(ComboD[ComboAt(Link->X, (Link->Y-16))]==c3 && Link->InputDown==true){//down
            Waitframes(5);
            ComboD[c3]++;
        }

        if(ComboD[ComboAt((Link->X-16), Link->Y)]==c4 && Link->InputLeft==true{//left
            Waitframes(5);
            ComboD[c4]++;
        }
    }
}


ok included while loop and fixed the parentheses. i still have to fix the ComboD stuff... but its a start.

when using SetComboDara() is the parameter for the change the ID of the combo to change to or the amount to change by?

#6 Joe123

Joe123

    Retired

  • Members

Posted 16 May 2008 - 06:08 AM

CODE
import "std.zh"

ffc script house_door{
    void run(int c1, int c2, int c3, int c4){
        while(true){
            if(ComboD[ComboAt(Link->X,Link->Y-16)]==c1 && Link->InputUp{//up
                Waitframes(5);
                ComboD[ComboAt(Link->X,Link->Y-16)]++;
                //Game->PlaySound(sfx); maybe?
                Quit();
            }

            if(ComboD[ComboAt(Link->X, Link->Y-16)]==c3 && Link->InputDown){//down
                Waitframes(5);
                ComboD[ComboAt(Link->X, Link->Y-16)]++;
                Quit();
            }

            if(ComboD[ComboAt(Link->X-16, Link->Y)]==c4 && Link->InputLeft){//left
                Waitframes(5);
                ComboD[ComboAt(Link->X-16, Link->Y)]++;
                Quit();
            }

            if(ComboD[ComboAt(Link->X+16, Link->Y)]==c2 && Link->InputRight){//right
                Waitframes(5);
                ComboD[ComboAt(Link->X+16, Link->Y)]++;
                Quit();
            }
        Waitframe();
        }
    }
}


That's how you have to reference changing the combo.
And I put those Quit()s in cause it could get a little buggy otherwise.

Spose you might want to take them out for lots of doors facing the same way on one screen though, I dunno.
Musn't forget Waitframe(); in your while loop ;-)

#7 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 17 May 2008 - 08:40 PM

well, joe, you beat me to it =)

anyway, here it is. and as joe said, be careful not to place multiple doors facing the same way on the same screen, because it might open them all at the same time that are facing the same way.

#8 Radien

Radien

    Courage

  • Members
  • Real Name:Steve
  • Location:Oregon

Posted 18 May 2008 - 05:09 AM

Cool, but hypothetically speaking, wouldn't it be possible to achieve a similar effect by using "Treasure Chest" combos for the doors, and using a screen reset to close them again?

#9 Joe123

Joe123

    Retired

  • Members

Posted 18 May 2008 - 05:36 AM

You can't have more than one per screen that way, and you also can't have a treasure chest, and it won't play a sound effect.

#10 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

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

Posted 18 May 2008 - 01:45 PM

Two things of interest:

Why did you put Quit(); into the script Joe? That's not good for multiple doors on a single screen.

And I don't see why you couldn't have, oooooh say, 67 different treasure chests on a screen that open and reclose, and give link an item every time you open them....though, impractical, very feasible. I might draw the line at 32 though.

#11 Joe123

Joe123

    Retired

  • Members

Posted 18 May 2008 - 04:57 PM

Yah, I realised afterwards it wasn't a very good idea =P

You can't do that with the system.
You could script it obviously.

#12 Radien

Radien

    Courage

  • Members
  • Real Name:Steve
  • Location:Oregon

Posted 18 May 2008 - 10:18 PM

QUOTE(Joe123 @ May 18 2008, 03:36 AM) View Post
You can't have more than one per screen that way, and you also can't have a treasure chest, and it won't play a sound effect.

Yeah, you can't, but in my experience, it's not often that you absolutely need to have a treasure chest right next to an overworld door.

As for the sound effect and one-per-screen limit: okay, fair enough. But it'd still work.

QUOTE(Gleeok @ May 18 2008, 11:45 AM) View Post
And I don't see why you couldn't have, oooooh say, 67 different treasure chests on a screen that open and reclose, and give link an item every time you open them....though, impractical, very feasible. I might draw the line at 32 though.

Treasure chests don't need to contain items in order to work. Or were you referring to something else?

#13 Joe123

Joe123

    Retired

  • Members

Posted 19 May 2008 - 06:27 AM

QUOTE(Radien @ May 19 2008, 04:18 AM) View Post

Yeah, you can't, but in my experience, it's not often that you absolutely need to have a treasure chest right next to an overworld door.

As for the sound effect and one-per-screen limit: okay, fair enough. But it'd still work.


It's all extra limitations though isn't it.
It's better not to have them.

QUOTE(Radien @ May 19 2008, 04:18 AM) View Post
Treasure chests don't need to contain items in order to work. Or were you referring to something else?


I think he's just being silly =P


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users