Jump to content

Photo

LTTP Mirror?

Script Mirror LTTP Magic Dark World

  • Please log in to reply
16 replies to this topic

#1 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 17 October 2016 - 03:10 AM

You guys remember the Mirror from LTTP? Well I'm making a quest with a dark world, and I thought that putting a magic mirror in the quest would be really neat. Is there a script for this? I will love to have it.



#2 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 17 October 2016 - 09:03 AM

By MoscowModder
 
int SFX_MIRROR = 69;
int SFX_ERROR = 129;

const int MIRROR_TIME = 225;
item script mirror{
    void run (){

        int ffcScriptName[] = "mirrorFFC";
        int ffcScriptNum = Game->GetFFCScript(ffcScriptName);
        RunFFCScript(ffcScriptNum, NULL);
    }
}
ffc script mirrorFFC {
    void run(){
        int targetDMap; //DMap to warp to
        int targetMap; //Map (not DMap) to warp to
        if (Game->GetCurDMap() == 19){
            targetDMap = 2; //Sample origin/destination DMap change
            targetMap = 1;
        }
        else if (Game->GetCurDMap() == 2){
            targetDMap = 19; //All other ones start with "else"
            targetMap = 24;
        }
        else{ //Invalid Dmap
            Game->PlaySound(SFX_ERROR);
            return;
        }
        if ( Game->GetComboSolid(targetMap, Game->GetCurScreen(), ComboAt(Link->X+8,Link->Y+ 8)) ){
            Game->PlaySound(SFX_ERROR);
            return;
        }
        Game->PlaySound(SFX_MIRROR);
        Screen->SetSideWarp(0, Game->GetCurDMapScreen(), targetDMap, WT_IWARPWAVE);
       
        Link->CollDetection = false;
        Screen->Wavy = MIRROR_TIME;
        for(int i = 0; i < MIRROR_TIME; i++){
            Link->InputStart = false;
            Link->PressStart = false;
            Link->InputMap = false;
            Link->PressMap = false;

            WaitNoAction();
        }
        Link->CollDetection = true;
       
        this->Data = CMB_AUTOWARPA;
    }
}

Edited by Gégé, 17 October 2016 - 09:10 AM.

  • judasrising likes this

#3 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 17 October 2016 - 03:13 PM

I'm getting an error:

 

TMP, LINE 54: ERROR S09: VARIABLE CMB_AUTOWARPA IS UNDECLARED.



#4 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 17 October 2016 - 03:33 PM

Adds
const int CMB_AUTOWARPA = X;
 
before
item script mirror{
Change X by number combo with Type Auto Side warp [A]

Edited by Gégé, 17 October 2016 - 03:36 PM.


#5 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 17 October 2016 - 10:59 PM

How do I setup the ffc combo? Because it keeps playing the error sound effect.



#6 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 18 October 2016 - 04:11 AM

1.Make screens overworld/darkworld same screen
2. Compile
3. Put mirror ffc in slot ffcscript
4. Put mirror in item script
5.Compile ok
6. Create a item mirror
7. In action script put script mirror
8. in item Scripts :
Setup :
D0 : Sound error
D1 : Id combo Type Auto Side warp [A]
D2 : Mirror time
D3 : Target Map overworld
D4 : Target Dmap overworld
D5 : Target Map darkworld
D6 : Target Dmap darkworld

Updated for custom, untested

item script mirror{
    void run (int SFX_MIRROR,int CMB_AUTOWARPA,int MIRROR_TIME,int Mapoverworld,int Dmapoverworld,int Mapdarkworld,int Dmapdarkworld){
        int args[7] = {SFX_MIRROR, CMB_AUTOWARPA, MIRROR_TIME,Mapoverworld,Dmapoverworld,Mapdarkworld,Dmapdarkworld};
        int ffcScriptName[] = "mirrorFFC";
        int ffcScriptNum = Game->GetFFCScript(ffcScriptName);
        RunFFCScript(ffcScriptNum, args);
    }
}
ffc script mirrorFFC {
    void run(int SFX_MIRROR,int CMB_AUTOWARPA,int MIRROR_TIME,int Mapoverworld,int Dmapoverworld,int Mapdarkworld,int Dmapdarkworld){
        int targetDMap; //DMap to warp to
        int targetMap; //Map (not DMap) to warp to
        if (Game->GetCurDMap() == Dmapdarkworld){
            targetDMap = Dmapoverworld;
            targetMap = Mapoverworld;
        }
        else if (Game->GetCurDMap() == Dmapoverworld){
            targetDMap = Dmapdarkworld;
            targetMap = Mapdarkworld;
        }
        else{ //Invalid Dmap
            Game->PlaySound(SFX_ERROR);
            return;
        }
        if ( Game->GetComboSolid(targetMap, Game->GetCurScreen(), ComboAt(Link->X+8,Link->Y+ 8)) ){
            Game->PlaySound(SFX_ERROR);
            return;
        }
        Game->PlaySound(SFX_MIRROR);
        Screen->SetSideWarp(0, Game->GetCurDMapScreen(), targetDMap, WT_IWARPWAVE);
       
        Link->CollDetection = false;
        Screen->Wavy = MIRROR_TIME;
        for(int i = 0; i < MIRROR_TIME; i++){
            Link->InputStart = false;
            Link->PressStart = false;
            Link->InputMap = false;
            Link->PressMap = false;

            WaitNoAction();
        }
        Link->CollDetection = true;
       
        this->Data = CMB_AUTOWARPA;
    }
}

Edited by Gégé, 18 October 2016 - 04:47 AM.


#7 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 October 2016 - 12:08 PM

 

1.Make screens overworld/darkworld same screen
2. Compile
3. Put mirror ffc in slot ffcscript
4. Put mirror in item script
5.Compile ok
6. Create a item mirror
7. In action script put script mirror
8. in item Scripts :
Setup :
D0 : Sound error
D1 : Id combo Type Auto Side warp [A]
D2 : Mirror time
D3 : Target Map overworld
D4 : Target Dmap overworld
D5 : Target Map darkworld
D6 : Target Dmap darkworld

Updated for custom, untested

item script mirror{
    void run (int SFX_MIRROR,int CMB_AUTOWARPA,int MIRROR_TIME,int Mapoverworld,int Dmapoverworld,int Mapdarkworld,int Dmapdarkworld){
        int args[7] = {SFX_MIRROR, CMB_AUTOWARPA, MIRROR_TIME,Mapoverworld,Dmapoverworld,Mapdarkworld,Dmapdarkworld};
        int ffcScriptName[] = "mirrorFFC";
        int ffcScriptNum = Game->GetFFCScript(ffcScriptName);
        RunFFCScript(ffcScriptNum, args);
    }
}
ffc script mirrorFFC {
    void run(int SFX_MIRROR,int CMB_AUTOWARPA,int MIRROR_TIME,int Mapoverworld,int Dmapoverworld,int Mapdarkworld,int Dmapdarkworld){
        int targetDMap; //DMap to warp to
        int targetMap; //Map (not DMap) to warp to
        if (Game->GetCurDMap() == Dmapdarkworld){
            targetDMap = Dmapoverworld;
            targetMap = Mapoverworld;
        }
        else if (Game->GetCurDMap() == Dmapoverworld){
            targetDMap = Dmapdarkworld;
            targetMap = Mapdarkworld;
        }
        else{ //Invalid Dmap
            Game->PlaySound(SFX_ERROR);
            return;
        }
        if ( Game->GetComboSolid(targetMap, Game->GetCurScreen(), ComboAt(Link->X+8,Link->Y+ 8)) ){
            Game->PlaySound(SFX_ERROR);
            return;
        }
        Game->PlaySound(SFX_MIRROR);
        Screen->SetSideWarp(0, Game->GetCurDMapScreen(), targetDMap, WT_IWARPWAVE);
       
        Link->CollDetection = false;
        Screen->Wavy = MIRROR_TIME;
        for(int i = 0; i < MIRROR_TIME; i++){
            Link->InputStart = false;
            Link->PressStart = false;
            Link->InputMap = false;
            Link->PressMap = false;

            WaitNoAction();
        }
        Link->CollDetection = true;
       
        this->Data = CMB_AUTOWARPA;
    }
}

Allmost working now, but it warps me without i even not using the mirror item and it plays the error sound also.



#8 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 18 October 2016 - 02:19 PM

What about the mirror sound effect?

 

EDIT: It also automatically uses it when I go to a screen.


Edited by ZeldaPlayer, 18 October 2016 - 02:24 PM.


#9 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 18 October 2016 - 02:31 PM

D0 : Sound mirror
D1 : Sound error
D2 : Id combo Type Auto Side warp [A]
D3 : Mirror time
D4 : Target Map overworld
D5 : Target Dmap overworld
D6 : Target Map darkworld
D7 : Target Dmap darkworld

item script mirror{
    void run (int SFX_MIRROR, int SFX_ERROR, int CMB_AUTOWARPA,int MIRROR_TIME,int Mapoverworld,int Dmapoverworld,int Mapdarkworld,int Dmapdarkworld){
        int args[8] = {SFX_MIRROR, CMB_AUTOWARPA, MIRROR_TIME,Mapoverworld,Dmapoverworld,Mapdarkworld,Dmapdarkworld};
        int ffcScriptName[] = "mirrorFFC";
        int ffcScriptNum = Game->GetFFCScript(ffcScriptName);
        RunFFCScript(ffcScriptNum, args);
    }
}
ffc script mirrorFFC {
    void run(int SFX_MIRROR, int SFX_ERROR, int CMB_AUTOWARPA,int MIRROR_TIME,int Mapoverworld,int Dmapoverworld,int Mapdarkworld,int Dmapdarkworld){
        int targetDMap; //DMap to warp to
        int targetMap; //Map (not DMap) to warp to
        if (Game->GetCurDMap() == Dmapdarkworld){
            targetDMap = Dmapoverworld;
            targetMap = Mapoverworld;
        }
        else if (Game->GetCurDMap() == Dmapoverworld){
            targetDMap = Dmapdarkworld;
            targetMap = Mapdarkworld;
        }
        else{ //Invalid Dmap
            Game->PlaySound(SFX_ERROR);
            return;
        }
        if ( Game->GetComboSolid(targetMap, Game->GetCurScreen(), ComboAt(Link->X+8,Link->Y+ 8)) ){
            Game->PlaySound(SFX_ERROR);
            return;
        }
        Game->PlaySound(SFX_MIRROR);
        Screen->SetSideWarp(0, Game->GetCurDMapScreen(), targetDMap, WT_IWARPWAVE);
       
        Link->CollDetection = false;
        Screen->Wavy = MIRROR_TIME;
        for(int i = 0; i < MIRROR_TIME; i++){
            Link->InputStart = false;
            Link->PressStart = false;
            Link->InputMap = false;
            Link->PressMap = false;

            WaitNoAction();
        }
        Link->CollDetection = true;
       
        this->Data = CMB_AUTOWARPA;
    }
}


#10 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 18 October 2016 - 03:35 PM

It automatically respawns me when I'm not using the mirror. 



#11 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 18 October 2016 - 04:08 PM

Forgive me :)
 
Tested, works :

 

Set the constants :

const int SFX_MIRROR =62;
const int SFX_ERROR =61;
const int CMB_AUTOWARPA =2560;
const int MIRROR_TIME =220;
const int Mapoverworld =1;
const int Dmapoverworld =0;
const int Mapdarkworld =2;
const int Dmapdarkworld =1;

item script mirror{
    void run (){
        int ffcScriptName[] = "mirrorFFC";
        int ffcScriptNum = Game->GetFFCScript(ffcScriptName);
        RunFFCScript(ffcScriptNum, NULL);
    }
}
ffc script mirrorFFC {
    void run(){
        int targetDMap; //DMap to warp to
        int targetMap; //Map (not DMap) to warp to
        if (Game->GetCurDMap() == Dmapdarkworld){
            targetDMap = Dmapoverworld;
            targetMap = Mapoverworld;
        }
        else if (Game->GetCurDMap() == Dmapoverworld){
            targetDMap = Dmapdarkworld;
            targetMap = Mapdarkworld;
        }
        else{ //Invalid Dmap
            Game->PlaySound(SFX_ERROR);
            return;
        }
        if ( Game->GetComboSolid(targetMap, Game->GetCurScreen(), ComboAt(Link->X+8,Link->Y+ 8)) ){
            Game->PlaySound(SFX_ERROR);
            return;
        }
        Game->PlaySound(SFX_MIRROR);
        Screen->SetSideWarp(0, Game->GetCurDMapScreen(), targetDMap, WT_IWARPWAVE);
       
        Link->CollDetection = false;
        Screen->Wavy = MIRROR_TIME;
        for(int i = 0; i < MIRROR_TIME; i++){
            Link->InputStart = false;
            Link->PressStart = false;
            Link->InputMap = false;
            Link->PressMap = false;

            WaitNoAction();
        }
        Link->CollDetection = true;
       
        this->Data = CMB_AUTOWARPA;
    }
}

Edited by Gégé, 18 October 2016 - 04:09 PM.

  • judasrising and ZeldaPlayer like this

#12 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 18 October 2016 - 04:59 PM

Awesome! Thanks!



#13 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 October 2016 - 06:02 PM

Fine it works now thanks :bounce:


Edited by judasrising, 18 October 2016 - 06:33 PM.


#14 ZeldaPlayer

ZeldaPlayer

    What's up my playas

  • Members
  • Location:USA

Posted 18 October 2016 - 06:10 PM

Wait, just a question: How can you play the error sound?



#15 judasrising

judasrising

    I play guitar

  • Members
  • Location:Sweden but born in Finland

Posted 18 October 2016 - 06:21 PM

Wait, just a question: How can you play the error sound?

It plays the error sound if there is solid combo on the destination screen in that location you warp to.





Also tagged with one or more of these keywords: Script, Mirror, LTTP, Magic, Dark World

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users