Jump to content

Photo

Freezing Link's movement and resuming it (via Flags)


  • Please log in to reply
5 replies to this topic

#1 Dream Illusionist

Dream Illusionist

    Junior

  • Members

Posted 12 March 2011 - 05:12 PM

Say, I could use a little bit of help. I'd like to request a script that, via flags 98 and 99, freeze player movement and regain it, respectively. In other words:
  • When Link touched a tile with flag 98, it would stop receiving player input, making Link stop and the player would lose control over him.
  • When Link then touched flag 99, the player's control of Link would be regained - you can move normally again.
  • These flags are also supposed to detect if the change they are trying to execute (freeze or regain movement) is already valid, doing nothing if that is the case. (i.e., if Link's already frozen, flag 98 does nothing more to him; if the player has control over Link, flag 99 does nothing.)
Disabling player input doesn't seem to hard to do, but I'm fairly uncertain how to involve flags. Any assistance would be appreciated. ^^;

Edited by Sylph, 12 March 2011 - 05:12 PM.


#2 lucas92

lucas92

    Defender

  • Members

Posted 12 March 2011 - 05:19 PM

If Link is frozen and is on the flag 98, how would he be able to touch the flag 99?

#3 Dream Illusionist

Dream Illusionist

    Junior

  • Members

Posted 12 March 2011 - 05:26 PM

QUOTE(lucas92 @ Mar 12 2011, 10:19 PM) View Post

If Link is frozen and is on the flag 98, how would he be able to touch the flag 99?


It's supposed to work in connection with conveyor combo types, effectively making a pathway labyrinth.

#4 lucas92

lucas92

    Defender

  • Members

Posted 12 March 2011 - 07:06 PM

CODE
import "std.zh"

const int LINKMISC_FROZEN = 0;

//D0:the flag you want Link to freeze on
ffc script FreezeLinkOnIthFlag
{
    void run(int flag)
    {
        while(true)
        {
            if(Screen->ComboF[ComboAt(Link->X + Link->HitWidth/2,Link->Y + Link->HitHeight/2)] == flag)
                Link->Misc[LINKMISC_FROZEN] = 1;
            Waitframe();
        }
    }
}
//D0 : the flag you want Link to regain control on
ffc script RegainLinkInput
{
    void run(int flag)
    {
        while(true)
        {
            if(Screen->ComboF[ComboAt(Link->X + Link->HitWidth/2,Link->Y + Link->HitHeight/2)] == flag)
                Link->Misc[LINKMISC_FROZEN] = 0;
            Waitframe();
        }
    }
}
global script ContinueScript
{
    void run()
    {
        while(true)
        {
            if(Link->Misc[LINKMISC_FROZEN] == 1)
                NoAction();
            Waitframe();
        }
    }
}


This should work.

#5 Dream Illusionist

Dream Illusionist

    Junior

  • Members

Posted 13 March 2011 - 12:26 AM

Haven't had the time to test it yet, but thanks a bunch! =D

#6 Dream Illusionist

Dream Illusionist

    Junior

  • Members

Posted 24 April 2011 - 04:57 PM

Sorry to be grave-digging and double-posting here, but I found a small problem with the script that eluded me the first time I used it. Apparently, if the combo that has the freeze-flag is above Link's current position, and Link walks into it, he freezes before the conveyor property of the combo takes effect. So, effectively, he remains frozen there, with no means of moving.

Edited by Sylph, 24 April 2011 - 04:57 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users