///////////////////////// /// Generic LWeapon /////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// D0: MP or Counter cost per use. /// /// D1: Speed that Subweapon Travels across screen; suggest 240. /// /// D2: Amount of Damage that Subweapon Deals to Enemies. /// /// D3: Sprite used by Subweapon; select from: /// /// Quest->Graphics->Sprites->WeaponsMisc. /// /// D4: The counter to use for this item (numeric from std_constants.zh /// /// D5: Error Sound Effects. /// /// D6: Item Sound Effects. Select sounds from: /// /// Quest->Audio->SFX Data /// /// D7: The kind of LWeapon to generate (numeric) from std_constants.zh /// /////////////////////////////////////////////////////////////////////////// item script ProjectileLWeapon { void run(int Cost, int speed, int power, int spriteUsed, CountertoUse, int SXF_ERROR, int SFX_ITEM, int lType) { if(Game->Counter[CountertoUse] >= (Cost - 1) //If the player has enough MP based on amount set in D0 MP cost. { Game->Counter[CountertoUse] -= Cost; //Select a counter from std_constants.zh and set the value for the counter in D, and the cost in D0. lweapon lw = Screen->CreateLWeapon(lType); //Set (numerical) type of LWeapon to generate as argument D7 (from std_constants.zh) arrow->UseSprite(spriteUsed); // the number of the sprite used for the projectile. Use two tiles, the first for up/down, the second for left/right lw->X = Link->X; //Find Link's Position X lw->Y = Link->Y; //Find Link's Position Y lw->Dir = Link->Dir; //Find the Direction that Link is facing. lw->Step = speed; // the speed the projectile travels lw->Damage = power; //the damage the projectile will do Game->PlaySound(SFX_ITEM); // the sound effect for the weapon if(Link->Dir == DIR_DOWN) //If Link is facing down... { lw->Flip = 2; //Change direction of spriteUsed to down. } if(Link->Dir == DIR_RIGHT) //If Link is facing right. { lw->Tile += 1; //Use next tile as well. } if(Link->Dir == DIR_LEFT) { lw->Tile += 1; //If Link is facing left. lw->Flip = 1; //Flip spriteUsed tile and use next tile as well. } } else{ Game->PlaySound(SFX_ERROR); //If out of MP, play ERROR SOund Effects. } } }