Jump to content

Photo

Scripts wanted for my Quest

Quest; Script

  • Please log in to reply
35 replies to this topic

#16 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 04 March 2015 - 05:48 AM

Yes. That has worked. Thx justin. At some time I'll come back again for more script request.

Oh that reminds me. As you have scripted this do you want to submit this in the database?

 

EDIT: OUCH!!! Forgot to say that. I'm using DMap Enhanced music at my quest so I am trying to test it with this method.

It cames out that it changed to another MIDI, not back to the enhanced DMap music. I'm trying to edit the script with Game->SetDMapEnhancedMusic. Maybe you are faster than me since you are a good scripter. :D


Edited by Sparkster, 04 March 2015 - 06:10 AM.


#17 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 04 March 2015 - 09:12 AM

Can you test this?

import "std.zh"

ffc script BossMusic
{
    void run()
    {
        Waitframes(5);
        int filename[] = "BB1KIU.ogg";
        int cmidi = Game->GetMIDI();
        Game->PlayEnhancedMusic(filename,0);
        while(Screen->NumNPCs() != 0) Waitframe();
        Game->SetDMapEnhancedMusic();
    }
}


#18 justin

justin

    Adept

  • Members

Posted 04 March 2015 - 09:37 AM

why wouldn't you test it?

but it won't run, you have no arguments set for Game->SetDMapEnhancedMusic(). 

 

here

import "std.zh"

ffc script BossMusic
{
   void run()
   {
      Waitframes(5);
      int filename[] = "BB1KIU.ogg";
      int orig[256];
      Game->GetDMapMusicFilename(Game->GetCurDMap(), orig);
      Game->PlayEnhancedMusic(filename,0);
      while(Screen->NumNPCs() != 0) Waitframe();
      Game->PlayEnhancedMusic(orig,0); 
    }
}

as for me submitting it to the database.  at the moment the design of it is very specific, and not generalized for many quests which I'd prefer to see on the database.  it is hardcoded to use just one boss music file, so you'd either need to have all your boss battles using the same song, or multiple versions of the script.  it also has no fallback if it errors playing a song at any point.  and it relies on the fact that the questmaker is using enhanced music for both.  i'll consider returning to it, and making a more general version.


Edited by justin, 04 March 2015 - 10:01 AM.


#19 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 04 March 2015 - 09:46 AM

why wouldn't you test it?

but it won't run, you have no arguments set for Game->SetDMapEnhancedMusic().

 

 

Forgot to say that I already tested it but there was an error with the game-> playenhancedmusic thingy.

 

EDIT:

Pass 1: Parsing
Pass 2: Preprocessing
Pass 3: Building symbol tables
Pass 4: Type-checking/Completing function symbol tables/Constant folding
tmp, line 10: Error T21: Could not match type signature GetCurDMap().


Edited by Sparkster, 04 March 2015 - 09:48 AM.


#20 justin

justin

    Adept

  • Members

Posted 04 March 2015 - 10:01 AM

Forgot to say that I already tested it but there was an error with the game-> playenhancedmusic thingy.

 

EDIT:

Pass 1: Parsing
Pass 2: Preprocessing
Pass 3: Building symbol tables
Pass 4: Type-checking/Completing function symbol tables/Constant folding
tmp, line 10: Error T21: Could not match type signature GetCurDMap().

 

oops, edited the code in my previous post.  



#21 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 04 March 2015 - 10:05 AM

Ok got it. Thank you.



#22 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 18 March 2015 - 02:11 PM

I have found a bug in the Holelava Script by Mero.

If Link falls into a hole he can still move. I had found it out after I fall into a hole near to a cave entrance. While I was falling I entered the cave. Can someone edit that global script of mine to make Link stop moving when falling. Here's the code.

 

Spoiler

Edited by Sparkster, 18 March 2015 - 02:12 PM.


#23 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 21 April 2015 - 04:18 AM

Hey everyone. The next request is a bit complicated. In the volcano area, I have 4 torches set on 4 screens. Can you make a script, that checks the four lit combos based on the combo index. If they are here it will activate the secret. But well this is complicated since I have set them on four screens. Maybe I should put all 4 torches into one screen. The D Arguments are for the number of the combo.

 

Can you do this?

 

Or should I switch back to the two torches thing that must be lit and the secret carries over?



#24 justin

justin

    Adept

  • Members

Posted 21 April 2015 - 11:10 AM

Sounds possible. So you have four screens with a torch each, and when all are lit a secret is triggered on another screen? Does lighting a torch on one screen trigger that screen's secrets, or did you want to have another secret on the screen, so would rather not have the torch trigger secrets?

Can be done in two ways that I can think of. Lighting the torch either triggers that screen's secrets or sets a Screen->D register. The screen you want all the torches to trigger has a script that checks each room for that condition, and sets secrets if all are triggered.

Any thing else this is supposed to do?

#25 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 21 April 2015 - 12:08 PM

Ah yes the Screen->D register thingy is also possible. Well I don't want to lit them by myself in this quest. Best explained by the 5 screens here:

If all 4 torches on each screen showing are lit on (or if those combo are available at the screen)

SeChe01.png

SeChe02.png

SeChe03.png

SeChe04.png

 

It triggers the screen secret flags 16-31.

 

SeChe05.png

 

I hope you understand what I mean.



#26 justin

justin

    Adept

  • Members

Posted 21 April 2015 - 01:27 PM

What do you mean they aren't lit by you? How are they lit?

#27 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 21 April 2015 - 01:44 PM

I want to lit them via screen secret carryover. Does this work with that script?



#28 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 21 April 2015 - 01:56 PM

Yes it works. The question is, how does the player lit them? Are you using the burn flag for them? If yes, then use this script:
 
const int All4TriggersCheck_Map = 0; //the map where the triggers are
const int All4TriggersCheck_Screen1 = 0; //first screen
const int All4TriggersCheck_Screen2 = 0; //second screen
const int All4TriggersCheck_Screen3 = 0; //third screen
const int All4TriggersCheck_Screen4 = 0; //fourth screen

ffc script All4TriggersCheck{
    void run(){
        while(true){
            if ( GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen1, ST_SECRET) == true
            && GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen2, ST_SECRET) == true
            && GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen3, ST_SECRET) == true
            && GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen4, ST_SECRET) == true
            && Screen->State[ST_SECRET] == false ) {
                Screen->TriggerSecrets();
                Screen->State[ST_SECRET] = true;
            }
            Waitframe();
        }
    }
}
How to use it:
Note down the map number and the screen numbers of the 4 screens.
Then use this Hex to Decimal converter to find out the decimal numbers of the 4 screens. http://www.binaryhex...cimal-converter
Enter the numbers in the script for the "const int" variables.
Import the script and put it on the screen with the door. The script checks for the secret state of the 4 screens.

Edited by Avataro, 21 April 2015 - 01:59 PM.


#29 justin

justin

    Adept

  • Members

Posted 21 April 2015 - 02:02 PM

here's my version.  i'm still not sure how the torches are being lit, but doesn't matter much with my script.

 

two ffcs.  one goes on the screen you want secrets to be triggered on, it just watches a screen->D register than you specify for a certain value indicating all the torches are lit.  the other goes on all the torch combos, and when changed to the combo you specify sets the screen->D register on the final screen indicating it has been lit.  you can have multiple torches per screen (even torches on the final screen).  they do currently have to be on the same dmap as the final screen (although this can be easily changed).

 

edit: like Avataro's you need the decimal# for the typical hex# screen.  this might help, http://www.purezc.ne...showtopic=65681

import "std.zh"  // only need this once
 
// Place this ffc on the combo you want to check for.  In your case the unlit torch.
// D0 = the combo# of the new combo we are watching for. In your case the lit torch.
// D1 = the screen# of the screen we want to trigger secrets on.  if on the same dmap
// D2 = the Screen->D register of that screen we want to use.  Number between 0-7 unused by other scripts.  
//      all the screens in this script should point to the same screen and same D register
// D3 = the bit# to write to.  if you have 4 torches, you'll have bits 0, 1, 2, 3.  which one is which doesn't matter.
 
ffc script FFC_ComboCheckPlus
{
 void run(int comboNum, int scrn, int Dreg, int Dbit)
 {
  int loc = ComboAt(this->X,this->Y);
 
  while(true)
  {
   if(Screen->ComboD[loc] == comboNum)
   {
    SetScreenDBit(scrn, Dreg, Dbit, true);
    Quit();
   }
 
   Waitframe();
  }
 }
}
 
 
// Place this on the screen you want secrets to be triggered on, once all the torches are lit
// D0 = the Screen->D register the above FFCs have been writing to
// D1 = the number of bits we've been writing to.  Equal to the number of torches in your puzzle.
 
ffc script FFC_ScreenDtoSecrets
{
 void run(int Dreg, int numBits)
 {
  int regVal = Pow(2,numBits)-1;
 
  while(true)
  {
   if(Screen->D[Dreg] == regVal)
   {
    Screen->TriggerSecrets();
    Screen->State[ST_SECRET] = true;
    Quit();
   }
 
   Waitframe();
  }
 }
}

Edited by justin, 21 April 2015 - 02:05 PM.

  • Avaro likes this

#30 justin

justin

    Adept

  • Members

Posted 21 April 2015 - 07:36 PM

Just thinking about it, and if the torches aren't being lit by player, but rather from another screen as a Screen state carryover, my script would actually require the player to go to each screen to "see" the torch has been lit. But avataro's does not require this (well I'd assume not, unless there is some weird zc thingy going on).

I'd also rewrite Avataro's version more efficiently, so less stuff is happening each frame on the screen. Like this

 

const int All4TriggersCheck_Map = 0; //the map where the triggers are
const int All4TriggersCheck_Screen1 = 0; //first screen
const int All4TriggersCheck_Screen2 = 0; //second screen
const int All4TriggersCheck_Screen3 = 0; //third screen
const int All4TriggersCheck_Screen4 = 0; //fourth screen
 
ffc script All4TriggersCheck{
    void run(){
        if(Screen->State[ST_SECRET]) Quit();
        while(!GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen1, ST_SECRET)) Waitframe();
        while(!GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen2, ST_SECRET)) Waitframe();
        while(!GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen3, ST_SECRET)) Waitframe();
        while(!GetScreenState(All4TriggersCheck_Map, All4TriggersCheck_Screen4, ST_SECRET)) Waitframe();
        Screen->TriggerSecrets();
        Screen->State[ST_SECRET] = true;
    }
}

Edited by justin, 21 April 2015 - 07:40 PM.




Also tagged with one or more of these keywords: Quest;, Script

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users