Jump to content

Photo

Time-Freezing Item?


  • Please log in to reply
5 replies to this topic

#1 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 17 August 2009 - 12:52 PM

I'm looking for an item that, when used, stops everything in time except for Link. While it's active, it'd need to drain magic. Is such an item possible? Any help would be greatly appreciated. icon_smile.gif

Edited by Blaman, 17 August 2009 - 12:53 PM.


#2 SwordOfSeals

SwordOfSeals

    Peace now, food later

  • Members
  • Real Name:Akai, really...
  • Location:Xenia, OH

Posted 17 August 2009 - 09:14 PM

My best guess is using a script that imitates the clock item but is scripted to consume magic, lasting until deactivated (used again) or you're out of magic. I know nothing of scripts, though. :/

#3 Zim

Zim

    Freelance Nobody

  • Members
  • Real Name:Zim
  • Location:Washington

Posted 17 August 2009 - 10:13 PM

Totally sounds doable.
I've never used a clock before.. You want it to last as long as the magic points are getting drained? How about if you want it to stop before the magic is all the way out? Like, hit the button again to make it stop?
Item scripts only run once, so it'd have to be combined with a global, and I'll see about the duration of the clock and get back to you. I'll see what I can do. icon_smile.gif


#4 Zim

Zim

    Freelance Nobody

  • Members
  • Real Name:Zim
  • Location:Washington

Posted 17 August 2009 - 11:56 PM

CODE

                            
import "std.zh"
//canMove courtesy of Saffith.. I think.
bool canMove(int x, int y){    
        if(x<0 || x>255 || y<0 || y>175)
            return false;
        int mask=1111b;
        
        // x % 16 = 7, so
        // mask = 1111 & 0011 = 0011
        if(x%16<8)
            mask&=0011b;
        else
            mask&=1100b;
        
        // y % 16 = 2, so
        // mask = 0011 & 0101 = 0001
        if(y%16<8)
            mask&=0101b;
        else
            mask&=1010b;
    return ((Screen->ComboS[ComboAt(x, y)]&mask)==0);}

int STOP=0;

item script STOPTIMEWITHMP //Attach this to item.
{
    void run()
    {if(STOP==0 && Link->MP>0)
        {STOP++;}
    }
}

global script SLOT_2 //combine this with any globals you have,
//place in SLOT 2.
{
    void run()
    {
    while(true)
        {
        while(STOP==1 && Link->InputB)
            {
            if(Link->MP>0)
                {
                Link->MP--; Link->Item[4]=true;
                if(Link->InputUp && canMove(Link->X, Link->Y-1))
                    {Link->Dir=0; Link->Y--;}
                else if(Link->InputDown && canMove(Link->X, Link->Y+16))
                    {Link->Dir=1; Link->Y++;}
                else if(Link->InputLeft && canMove(Link->X-1, Link->Y))
                    {Link->Dir=2; Link->X--;}
                else if(Link->InputRight && canMove(Link->X+16, Link->Y) )
                    {Link->Dir=3; Link->X++;}
                else
                    {Link->Dir=Link->Dir;}
                }
            else if(Link->MP==0)
                {Link->Item[4]=false; STOP=0;}
            }
        while(STOP==1 && !Link->InputB)
            {STOP=0;}
        Waitframe();
        }
    }
}


This script actually does exactly what you asked.. The B button has to be held for the enemies to stay frozen, and you CAN move whilst everything else freezes... However.. You can't see Link! I haven't been able to figure out how to get him to stay visible.. This could seem to be a disadvantage.. But it also makes Link seem like a NINJA! icon_smile.gif
Hope that helps. I'll continue working on it later if this is not sufficient.

Edited by Zim, 17 August 2009 - 11:56 PM.


#5 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 18 August 2009 - 10:59 AM

Awesome! icon_biggrin.gif Thank you so much for this. I may try to tweak it and see if I can get Link to become visible, but still, awesome! icon_biggrin.gif

#6 Zim

Zim

    Freelance Nobody

  • Members
  • Real Name:Zim
  • Location:Washington

Posted 18 August 2009 - 11:54 AM

You're welcome. icon_smile.gif I might try and fiddle with it some more later too. Another added bonus that I didn't even know about the clock item is that the spikes combos and conveyors freeze in animation, consequentially, with this script, you can move right over them without the damage/moving...
And I guess Link doesn't really disappear, the his graphic just doesn't move while he does.
I'mma see about at least getting a linedraw going on it or something so that his path will be shown at least in some way.

Edited by Zim, 18 August 2009 - 12:03 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users