Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////
- /// Vulcan FFC ///
- /// By: ZoriaRPG ///
- /// Requested by Cedric ///
- /// 21st May, 2017 ///
- /// v0.5 ///
- ///////////////////////////////////////////////////////////////////////////////////////////
- /// D0: Sprite of the fireball from Quest->Graphics->Sprites->Weapons/Misc
- /// D1: Damage of projectiles
- /// D3:Time in seconds beforwe fireballs land. Defaults to 1.75 seconds.
- /// D4: Time in frames before the eruption begins, randomised by +/- 80 frames.
- /// D5: Sound of rumbling
- /// D6: Sound of eruption
- /// D7: Time before we can erupt again.
- ffc script erupt{
- void run(int fireball_sprite, int damage, float falltime, float erupt_time, int rumble_sfx, int erupt_sfx, float time_return){
- eweapon e[10]; //The eight fireballs, and generic indices for looping.
- int q[10]; //[0]: Q loop,
- //[1]: Radians counter,
- //[2]: ffmarker,
- //[3]: Exploding
- //[4]: Remaining fireballs on-screen
- //[5]: Used for positive Angle variation
- //[6]: Used for negative Angle variation
- //[7]: Unused,
- //[8]: Unused,
- //[9]: Unused
- int timers[4]; //[0]: Eruption Timer,
- //[1]: Frame at which rumbling begins.
- //[2]: time before second eruption, randomised.,
- //[3]: Unused,
- //Do initial var set-up.
- if ( falltime <= 0 ) { falltime = 1.75; } //Sanity
- if ( erupt_time <= 0 ) { erupt_time = 300; }
- else { erupt_time = erupt_time * 60; } //Turn seconds into frames.
- timer[0] = Abs(erupt_time + Rand(-80,80)); timer[1] = Rand(30,90); //A slightly randomised eruption rate.
- //Determine the UID to bind a fireball to its parent ffc.
- q[2] = ComboAt(this->X, this->Y) + 1; //A way of determining which ffc made the fireballs.
- //If you place more then one ffc over the same location, this will BREAK.
- //If we want to erupt more than one time, then set the value.
- if ( time_return > 0 ) { time_return *= 60; timer[2] = Abs(time_return + Rand(-80,80)); }
- while(true){
- //Wait to erupt.
- while ( timer[0]-- > 0 ) {
- if ( timer[0] == timer[1] ) {
- //One second before the eruption...
- ///Rumble sound
- if ( rumble_sfx > 0 ) Game->PlaySound(rumble_sfx);
- //Shake screen
- Screen->Quake = timer[1]; //A slightly randomised eruption rate.
- q[3] = 1;
- }
- Waitframe();
- }
- //Animate eruption at this ffc.
- if ( q[3] == 1 ) { //We are exploding )
- //Make the eruption sound.
- if ( erupt_sfx > 0 ) Game->PlaySound(erupt_sfx);
- //Spew eweapons
- for ( q[0] = 0; q [0] < 8l q[0]++ ) {
- e[q] = Screen->CreateEWeapon(EW_SCRIPT);
- e[q]->UseSprite = fireballsprite;
- e[q]->Power = Damage;
- e[q]->Angular = true;
- e[q]->Angle = q[1]; //This angle will be varied a bit as they fall.
- e->Misc[15] = q[2]; //The UID that links them to this specific ffc, because this->ID is not implemented in 2.50.x.
- q[1] += 0.25; //Adust the radians.
- e->Z = falltime * 60; //Give them an initial Z. Do they have shadows?
- }
- q[3] = 0; //Mark that we are done exploding.
- }
- //Now that the volcane has exploded,
- q[4] = 0; //Clear this counter for use.
- //Find all fireballs made by this script, and track them
- for ( q[0] = Screen->NumEWeapons(); q[0] > 0; q[0]-- ) {
- e[8] = Screen->LoadEWeapon(q[0]);
- if ( e[8]->Misc[15] != q[2] ) { continue; } //Ignore weapons without the same UID as we created with this ffc.
- q[4]++; //Track how many fireballs remain.
- q[5] = 0.0050; q[6] = -0.0050;
- e[8]->Angle += Choose(q[5], q[6]); // Vary the angle a bit.
- //If it is still falling, let it fall.
- if ( e[8]->Z > 0 ) { e[8]->Z--; } //Decrement its Z
- //if it hits the ground, make it explode.
- if ( e[8]->Z <= 0 ) {
- e[8]->ID = EW_BOMBBLAST;
- }
- }
- //If we have set to explode again...
- if ( timer[2] > 0 ) {
- if ( timer[2] > 1 ) { timer[2]--; } //Decrement the delay timer until it strikes 1.
- if ( timer[2] <= 1 ) { //When it strikes '1':
- if ( q[4] <= 0 ) { //If no fireballs remain from the last burst.
- ///new explosion
- //Reset the original timer, and start fresh.
- timer[0] = Abs(erupt_time + Rand(-80,80)); timer[1] = Rand(30,90); //A slightly randomised eruption rate.
- }
- //If fireballs remain, we will continue to check every frame as the timer will not continue to decrement.
- }
- }
- //if ( time_return <= 0 && q[4] == 0 ) Quit(); //Do we want to exit?
- Waitframe();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement