Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ffc script HoleLava{
- void run(int lava, int warpto, int damage){
- this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
- if(lava){
- this->Misc[0] = WSP_LAVA;
- this->Misc[1] = SFX_LAVA;
- }
- //Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
- if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
- Waitframes(5);
- this->X = Link->X; this->Y = Link->Y;
- }
- this->Misc[2] = warpto;
- if(damage) this->Misc[3] = damage;
- else this->Misc[3] = 8;
- while(true){
- while(!OnPitCombo()) Waitframe(); //Idle while not on pit
- int pitclk = 0;
- while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
- if(pitclk >= 5) Fall(this); //Fall
- }
- }
- void Fall(ffc Info){
- Screen->ClearSprites(SL_LWPNS);
- Game->PlaySound(Info->Misc[1]);
- int wait = CreateGraphic(Info->Misc[0]);
- Link->Invisible = true; Link->CollDetection = false;
- for(int i=0;i<wait+30;i++) WaitNoAction();
- Link->Invisible = false; Link->CollDetection = true;
- if(Info->Misc[2]) Warp(Info);
- Link->X = Info->X; Link->Y = Info->Y;
- Link->HP -= Info->Misc[3];
- Game->PlaySound(SFX_OUCH);
- }
- void Warp(ffc Warp){
- int orig = Warp->Data;
- Warp->Data = CMB_AUTOWARP;
- Warp->Flags[FFCF_CARRYOVER] = true;
- Waitframe();
- Warp->Data = orig;
- Warp->Flags[FFCF_CARRYOVER] = false;
- Link->Z = Link->Y;
- Quit();
- }
- bool OnPitCombo(){
- return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+8)] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
- }
- int CreateGraphic(int sprite){
- lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
- l->HitXOffset = 500;
- l->UseSprite(sprite);
- l->DeadState = l->NumFrames*l->ASpeed;
- l->X = Link->X; l->Y = Link->Y;
- return l->DeadState;
- }
- }
Add Comment
Please, Sign In to add comment