Jump to content

Photo

chest permanently appear when my crystal switch is hit?


  • Please log in to reply
9 replies to this topic

#1 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 25 December 2016 - 06:54 PM

can someone help me make a chest permanently appear when my crystal switch is hit?

 

I have found scripts that do this but I am not familiar with the phrases that people are using for instruction on how to set them up 

 

this one is from ZoriaRPG

ffc script chestSound{
    void run(int sfx, int comboID){
        while(true){
            if ( Screen->ComboD[ComboAt(this->X, this->Y)] == comboID && sfx ) {
                Game->PlaySound(sfx);
                this->Data = 0;
                this->Script = 0;
                Quit();
            }
            Waitframe();
        }
    }
}



#2 Gégé

Gégé

    Senior

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

Posted 26 December 2016 - 05:34 AM

Try this :
 
const int scd = 0; //ScreenD

ffc script chestSound{
    void run(int sfx, int comboID){
        if(Screen->D[scd]==1){
        Screen->ComboD[ComboAt(this->X, this->Y)] = comboID;
        Quit();
        }
        while(true){
            if ( Screen->ComboD[ComboAt(this->X, this->Y)] == comboID && sfx ) {
                Screen->D[scd]=1;
                Game->PlaySound(sfx);
                this->Data = 0;
                this->Script = 0;
                Quit();
            }
            Waitframe();
        }
    }
}
Click right -> Place + Edit FFC

Data button :
Click left on black rectangle and put an invisible combo (no combo 0)

Flags button :
Check "Run Script at Screen Init"

Arguments button :

d0= sfx ID (sound effect number)
d1= combo ID (combo number)

Edited by Gégé, 26 December 2016 - 06:38 AM.


#3 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 26 December 2016 - 02:02 PM

ok so I put it in the location I want the chest and set d1 to the combo of the chest

I set the ffc's combo to the chest combo since setting it to combo 0 makes the ffc disappear but I made it a changer instead

 

I also made a push block on the same screen with "push wait" type and  "2 push block (4 way, trigger)" flag

 

however it doesn't spawn the chest combo where the ffc is



#4 Gégé

Gégé

    Senior

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

Posted 26 December 2016 - 04:50 PM

Only works with Combo Type "Push wait"

 

Does not use secret trigger.
Here you can combine with a secret.

(eg : this chest + a classic stair)

 

ffc script PermanentSecrets{
 void run(int screen, int sfx, int combo, int x, int y, int delay){
 if(Screen->D[screen]>0){
  Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
  Quit();
 }
 Waitframes(4);
​if(delay<=0)delay=60;
  while(true){
   if(Screen->ComboT[ComboAt(x, y)]!=CT_PUSHWAIT){
    if(delay>0)delay--;
    else{
    Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
    Game->PlaySound(sfx);
    Screen->D[screen]=1;
    break;
    }
   }
   Waitframe();
  }
 }
}

 

d0 : ScreenD variable (if not use screenD, leave 0)

d1: Sfx

d2: Secret Combo

 

You can use warp return square to know the coordinate.

d3: X coordinate "block push wait"

d4: Y coordinate "block push wait"

d5: Delay combo spawn (can leave 0, defaut=1sec)



#5 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 26 December 2016 - 08:33 PM

I got it working.

but can you make it so that the chest appears with a puff of smoke?



#6 Gégé

Gégé

    Senior

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

Posted 27 December 2016 - 03:47 AM

Make an animated combo.
​Setup :
​d6=Combo Puff
d7=Cset color
 
 

ffc script PermanentSecrets{
 void run(int screen, int sfx, int combo, int x, int y, int delay; int puff, int cset){
 if(Screen->D[screen]>0){
  Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
  Quit();
 }
 Waitframes(4);
 if(delay<=0)delay=60;
  while(true){
   if(Screen->ComboT[ComboAt(x, y)]!=CT_PUSHWAIT){
    Screen->FastCombo(2, this->X, this->Y, puff, cset, 128);
    if(delay>0)delay--;
    else{
    Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
    Game->PlaySound(sfx);
    Screen->D[screen]=1;
    break;
    }
   }
   Waitframe();
  }
 }
}

Edited by Gégé, 27 December 2016 - 03:25 PM.


#7 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 27 December 2016 - 05:08 PM

your script doesn't load the chests state before you see that it's closed even with with run script as init checked

 

edit: also I have been trying to get the chest to appear when the puff is on its 3rd frame and allow the puff to animate to the 4th frame before stopping

but I can't seem to get the puff of smoke to draw after the chest appears

 

I do this because the 3rd frame of the puff of smoke is mostly transparent and it doesn't look right to have the chest appear after the whole smoke animation ends

 

here is my code

ffc script PushSecret
{
	void run(int screen, int sfx, int combo, int x, int y, int delay, int puff, int cset)
	{
		//if(Screen->D[screen]>0)
		//{
		//	Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
		//	Quit();
		//}
		
		int delay1 = delay;
		int delay2 = delay1 + 60;
		bool chest = false;
		
		Waitframes(4);
		if(delay1<=0)delay1=60;
		if(delay2<=0)delay2=120;
		
		while(true)
		{
			if(Screen->ComboT[ComboAt(x, y)]!=CT_PUSHWAIT)
			{
				if(delay1>0) delay1--;
				else
				{
					Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
					Game->PlaySound(sfx);
					Screen->D[screen]=1;
					chest = 1;
					break;
				}
			}
			if (chest)
			if(delay2>0) 
			{
				delay2--;
				Screen->FastCombo(3, this->X, this->Y, puff, cset, 128);
			}
			Waitframe();
		}
	}

Edited by Shadowblitz16, 27 December 2016 - 06:13 PM.


#8 Gégé

Gégé

    Senior

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

Posted 27 December 2016 - 06:55 PM

Untested, only with 4 frames combo.
- Create 4 combos (one per animation, no animed)
- Put left combo in D2
- Set Delay animation combo in D5. (defaut 15 frames)
 
ffc script PermanentSecrets{
 void run(int screen, int sfx, int combo, int x, int y, int delayframe, int puff, int cset){
    if(Screen->D[screen]>0){
    Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
    Quit();
    }
    Waitframes(4);
   int frame=0;
   int frames=delayframe;

   if(delayframe<=0)delayframe=15;

  while(true){

   if(Screen->ComboT[ComboAt(x, y)]!=CT_PUSHWAIT && frame<3){
      if(delayframe>0)delayframe--;
      if{delayframe==0 && frame<3){
      frame+=1;
      delayframe=frames;
     }
      Screen->FastCombo(2, this->X, this->Y, puff+frame, cset, 128);
   }
      else if(Screen->ComboT[ComboAt(x, y)]==CT_PUSHWAIT && frame==3){
      Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
      Game->PlaySound(sfx);
      Screen->D[screen]=1;
      break;
     }

   Waitframe();
  }
 }
}

Edited by Gégé, 27 December 2016 - 07:19 PM.


#9 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 27 December 2016 - 08:55 PM

Untested, only with 4 frames combo.
- Create 4 combos (one per animation, no animed)
- Put left combo in D2
- Set Delay animation combo in D5. (defaut 15 frames)
 

ffc script PermanentSecrets{
 void run(int screen, int sfx, int combo, int x, int y, int delayframe, int puff, int cset){
    if(Screen->D[screen]>0){
    Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
    Quit();
    }
    Waitframes(4);
   int frame=0;
   int frames=delayframe;

   if(delayframe<=0)delayframe=15;

  while(true){

   if(Screen->ComboT[ComboAt(x, y)]!=CT_PUSHWAIT && frame<3){
      if(delayframe>0)delayframe--;
      if{delayframe==0 && frame<3){
      frame+=1;
      delayframe=frames;
     }
      Screen->FastCombo(2, this->X, this->Y, puff+frame, cset, 128);
   }
      else if(Screen->ComboT[ComboAt(x, y)]==CT_PUSHWAIT && frame==3){
      Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
      Game->PlaySound(sfx);
      Screen->D[screen]=1;
      break;
     }

   Waitframe();
  }
 }
}

 

I was trying to edit the last script so that it used fastTile since combos animate even when they aren't drawn which causes desyncing

 

here is my current script even though it freezes the game currently


const int INVISIBLE_COMBO = 8;
const int PUFF_SPAWN_OFFSET = 1;
const int PUFF_SPEED = 8;

ffc script PushSecret
{
	void run(int screen, int sfx, int combo, int x, int y, int puff, int frames, int cset)
	{
		this->Data = INVISIBLE_COMBO;
	
		if(Screen->D[screen]>0)
		{
			Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
			Quit();
		}
		
		Waitframes(4);
		
		while(true)
		{
			if(Screen->ComboT[ComboAt(x, y)]!=CT_PUSHWAIT)
			{
			
				for (int i=puff; i<puff + frames; i++) 
				{
					if (i == (puff + frames) - PUFF_SPAWN_OFFSET)
					{
						Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
						Game->PlaySound(sfx);
						Screen->D[screen]=1;
					}
					for (int d=0; d<PUFF_SPEED; d++) { Screen->FastTile(2, this->X, this->Y, i, cset, OP_OPAQUE ); Waitframe(); }
				}
			}
		}
	}
}

Edited by Shadowblitz16, 27 December 2016 - 08:56 PM.


#10 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 27 December 2016 - 11:05 PM

ok so I fixed the freezing I just had to insert the waitframe and break statements again

anyways I can't seem to get the chest to load itself on screen init and I can't seem to get the combo to appear on the second to last frame of the smoke animation

 

I tried messing with the waitframes in between the load and the trigger to get it to load faster but it doesn't seem to work

as for the chest showing up right before the smoke clears I tried checking if the "i" loop was equal to "puff + frames - 1" and then spawning it but it freaks out for some reason.

 

here is the script


const int INVISIBLE_COMBO = 8;
const int PUFF_SPAWN_OFFSET = 1;
const int PUFF_SPEED = 8;

ffc script PushSecret
{
	void run(int screen, int sfx, int combo, int x, int y, int puff, int frames, int cset)
	{
		this->Data = INVISIBLE_COMBO;
	
		if(Screen->D[screen]>0)
		{
			Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
			Quit();
		}
		
		Waitframes(4);
		
		while(true)
		{
			if(Screen->ComboT[ComboAt(x, y)] != CT_PUSHWAIT)
			{
			
				for (int i=puff; i<puff + frames; i++) 
				for (int d=0; d<PUFF_SPEED; d++) { Screen->FastTile(2, this->X, this->Y, i, cset, OP_OPAQUE ); Waitframe(); }
				
				Screen->ComboD[ComboAt(this->X, this->Y)] = combo;
				Game->PlaySound(sfx);
				Screen->D[screen]=1;
				break;
			}
			Waitframe();
		}
	}
}



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users