// import "std.zh" // import "string.zh" // import "ghost.zh" // The invisible enemy const int DROP_ENEMY_ID = 179; //////////////////////// /// Candle Ghost FFC /// //////////////////////// ///////////////////////////////////////////////////////////////////////////// /// D0: Sets Normal Candle or Enemy Candle Type. /// /// Set to: 0 = Normal Type -or- 1 = Enemy Type. /// /// D1: Sets dropset. Set in Quest->Misc Dats->Item Drop Sets /// /// D2: Sets base enemy. Set to 179 by default. /// /// D3: Sets Normal, Explode (No Damage), or Explode (Damaging) /// /// Set to: 0 = No Explosion -or- 1 = False Explosion -or- 2 = Explosion. /// /// D4: The tile of the Normal Candle; 940 by default. /// /// D5: The tile to change Normal Candle into; 1 by default. /// /// D6: Sound to make on breaking Normal Candle. /// /// D7: Remove Normal Candle on Death. 0 = No / 1 = Yes. /// ///////////////////////////////////////////////////////////////////////////// int dropnpc = 0; ffc script CandleGhost{ void run(int type, int drop, int CANDLE_ENEMY_ID, int explode, int target, int result, int sound, int dieOnComboChange) { if (type == 0){ // Grab the combo id underneath us so we can tell when it changes. int loc = ComboAt(CenterX(this), CenterY(this)); int underComboId = Screen->ComboD[loc]; // Wait for something to happen. bool waiting = true; while (waiting) { // If is set and the combo does change, terminate. if (dieOnComboChange > 0 && Screen->ComboD[loc] != underComboId) { return;} for (int i = 1; i <= Screen->NumLWeapons(); i++) { lweapon lw = Screen->LoadLWeapon(i); // If the LWeapon is touching us. if (lw->CollDetection && Collision(this, lw)) { waiting = false;}} Waitframe();} // Now loop through every combo on screen looking for combos // matching . for (loc = 0; loc < 176; loc++) { bool match = false; // If is positive, test for Combo ID. if (target > 0) { if (Screen->ComboD[loc] == target) { match = true;}} // If is negative, test for the flag being present. else if (target < 0) { if (ComboFI(loc, -target)) { match = true;}} // If the current combo is a match, then transform the combo // according to . if (match) { // If is positive, just change the target to . if (result > 0) { Screen->ComboD[loc] = result;} }} // Now play the message and sound, if appropriate. if (sound != 0) {Game->PlaySound(sound);} DropItem2(drop, this->X, this->Y); this->Data = 0; //Remove sprite } else if (type == 1){ npc ghost; int timer; int weaponSprite; int weaponDamage; eweapon wpn; ghost->CollDetection = false; // Initialize ghost=Ghost_InitCreate(this, CANDLE_ENEMY_ID); //ghost=Ghost_Init(this, ghost); Ghost_SetFlag(GHF_IGNORE_ALL_TERRAIN); Ghost_SetFlag(GHF_CLOCK); Ghost_SetFlag(GHF_NO_FALL); Ghost_SetFlag(GHF_FLYING_ENEMY); //Ghost_Setflag(GHF_NO_COLLISION); Ghost_CheckFreeze(this, ghost); //Link->CollDetection = false; Ghost_SpawnAnimationPuff(this, ghost); Ghost_SetHitOffsets(ghost, -1, -1, -1, -1); while(Ghost_HP > 0){ if(Ghost_HP > 0) Ghost_Waitframe(this, ghost, false, false); } if (explode == 0){ ghost->ItemSet=drop; //Quit(); Ghost_Waitframe(this, ghost, true, true); } else if (explode == 1){ ghost->ItemSet=drop; Ghost_Explode(this, ghost); } else if (explode == 2){ Link->CollDetection = true; ghost->ItemSet=drop; Ghost_ExplodeBlast(this, ghost); } } } } // Drop an item from a dropset. // int dropset: One of the DROP_* constants. // Is actually the enemy id of an enemy to kill instantly. // int x, int y or int loc: location of the drop. //void DropItems(int drop, int x, int y) { // npc n = CreateNPCAt(drop, x, y); // n->HP = HP_SILENT;} //void DropItems(int drop, int loc) { // DropItems(drop, ComboX(loc), ComboY(loc));} // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItem2(int drop, int x, int y) { npc n = CreateNPCAt(DROP_ENEMY_ID, x, y); n->HP = HP_SILENT; n->ItemSet = drop;}