import "std.zh" const int HP_DEAD = -999; //Enemy has been counted for Points (don't touch) ///////////////////////////////////////////////// //Import mandatory script headers and packages.// ///////////////////////////////////////////////// import "ffcscript.zh" import "string.zh" import "ghost.zh" import "ghost_legacy.zh" import "cv_std_extra_MM.zh" //////////////////////////////////////////////////////////////////// //Set up environment, Base Ints, Consts, Floats, Bools, Vars, etc.// //////////////////////////////////////////////////////////////////// const int SFX_ERROR = 65; //In case you want an error SFX const int SFX_SUBWEAPON = 66; //In case you want an error int healsfx = 39; //Sound effect to play when Link is healed int errorsfx = 65; //Sound effect to play when Link's HP is full or MP is empty const int LW_MISC_TIMEOUT = 7; bool IsSolid; bool PressR; bool InputR; bool InputL; bool PressL; //////////////////////////////////////////////////////////////// // Engine Constants. /////////////////////////////////////////// //////////////////////////////////////////////////////////////// // Combo Flag for soft platforms. const int CF_SOFT = 98; //// Block Types. // An empty block. const int BLOCK_EMPTY = 0; // A fallthrough block. const int BLOCK_SOFT = 1; // A standard block. const int BLOCK_HARD = 2; //// Stair combo types. const int CT_NEG = 142; const int CT_CROSS = 143; const int CT_POS = 144; //// Custom Engine Constants. // Link's walk speed. const float LINK_WALK = 1.5; // Link's jump speed. const float LINK_JUMP = -4; // Link's hop speed. const float LINK_HOP = -1; // Link's gravitic acceleration. const float LINK_GRAV = 0.16; // Link's terminal velocity. const float LINK_TERM = 3.2; //////////////////////////////////////////////////////////////// //// Global Variables ////////////////////////////////////////// //////////////////////////////////////////////////////////////// //// Link's State //// How to handle Link's movement. // We're letting the ZC engine handle movement. const int LINK_MODE_ENGINE = 0; // We're dealing with Link's movement ourselves. const int LINK_MODE_CUSTOM = 1; // We're moving link accourding to the stair system. const int LINK_MODE_STAIR = 2; // Link's current movement mode. int LinkMode = LINK_MODE_ENGINE; // Link's Location. This is so we can have fractional movement. float LinkX = 0; float LinkY = 0; // Link's Vertical Velocity. float LinkVy = 0; // What Link is standing on. int LinkBlock = BLOCK_HARD; //// Fake input since we're cancelling it. bool InputJump = false; bool PressJump = false; //// Various parts of Link's state from last frame. // Link's Position. float OldLinkX = 0; float OldLinkY = 0; int OldLinkAction = LA_NONE; //// Stair State. // On a down-left up-right stair. const int STAIR_NEG = -1; // Not on any stairs. const int STAIR_NONE = 0; // On an up-left down-right stair. const int STAIR_POS = 1; // The current kind of stair that Link is standing on. int StairMode = STAIR_NONE; // If the stairs were mounted this frame. bool StairMount = false; // The left edge of the stairs that Link is on. int StairLeft = 0; // The right edge of the stairs that Link is on. int StairRight = 0; // The y offset of the current stair. int StairY = 0; ///////////////////////////////// //// Screen Change ////////////// ///////////////////////////////// //// Screen State on the previous frame. // DMap from last frame. int OldDMap = -1; // DMap Screen from last frame. int OldDScreen = -1; // If the dmap has changed from the last frame. bool DMapChanged = false; // If the screen has changed from the last frame. bool ScreenChanged = false; // Used so that ScreenChanged is only set on the first frame // of a scrolling screen change. bool _ScreenChanged_ScrollFlag = false; // The ScreenChange FFC sets this so that maze screens can be used. bool _ScreenChanged_ForceFlag = false; // If the screen change has been handled by custom code. bool ScreenChangeHandled = true; // We're pretty sure that the screen change was caused by a warp of // some sort. const int SCREEN_CHANGE_WARP = -1; // Best guess for which direction we changed screens in // based on Link's current position. int ScreenChangeDir = SCREEN_CHANGE_WARP; /////////////////////////////////// // Global Script ////////////////// /////////////////////////////////// global script Active { void run() { LinkX = Link->X; LinkY = Link->Y; while (true) { explodeEnemies(); //Put this in your active script's while(true) loop //Weapon checks checkEnemiesKilled(); UpdateEWeapons(); CleanUpGhostFFCs(); // Only needed if __GH_USE_DRAWCOMBO is 0 Waitdraw(); AutoGhost(); DrawGhostFFCs(); /////////////////// ////Begin Points/// /////////////////// /////////////////// /// End Points /// /////////////////// Waitframe();}} } void explodeEnemies(){ for ( int i = 0; i < Screen->NumNPCs(); i++ ){ npc enem = Screen->LoadNPC(i); if ( enem->Attributes[11] == 0 //If not an AutoGhost enemy && enem->Attributes[10] > 0 //Attribute 11 more than 0 && enem->HP <= 0 //And dead && enem->HP > HP_DEAD //But not counted dead by this script ){ enem->HP = HP_DEAD; //Count it dead lweapon explosion = CreateLWeaponAt(LW_BOMBBLAST, enem->X, enem->Y); explosion->CollDetection = false; } } } ////////////////////////////////////////////////////////////////////////////////// // To make an Enemy EXPLODE!: Set Misc Attr 11 to '1' and Misc. Attr 12 to '0'. // // Script from MoscowModder, 14th April 2013 //////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////// /// END GLOBAL SCRIPT ////////////// //////////////////////////////////// void checkEnemiesKilled(){ for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc enem = Screen->LoadNPC(i); if ( enem->HP <= 0 && enem->HP > HP_DEAD ){ enem->HP = HP_DEAD; int worth = enem->Misc[12]; Game->Counter[CR_SCRIPT8]+worth; } } } //import "cv_changescreen.z" //import "cv_points.z" //import "cv_subweapon.z" //import "cv_ra_enemy.z" //import "cv_enemy_points.z" //import "cv_solid_NPC_v3.z" //import "gc_solid_FFC_for_enemies_only.z" //import "cv_giveitem.z" //import "cv_flash.z" //