Smoke Ring Gun (based on Foly's Throwing Bombs script)

Version:

2.0

Added on:

10 Jul 2013 18:52

Tags:

Description:
This changes the Electroblaster projectiles to smoke rings, and that's it.

Credit to Foly.
  1. const int cRingLifeTime = 55;
  2.  
  3. void CreateRing(int objectID) {
  4.   int playerID = jjObjects[objectID].creator - 32768;
  5.   int ringID = jjAddObject(OBJECT::SMOKERING, jjPlayers[playerID].xPos+(jjPlayers[playerID].direction*48), jjPlayers[playerID].yPos, jjPlayers[playerID].playerID, CREATOR::PLAYER);
  6.   jjObjects[ringID].determineCurAnim(ANIM::CATERPIL, 6, true);
  7.   jjObjects[ringID].direction = jjPlayers[playerID].direction;
  8. }
  9.  
  10. void DestroyRing(int ringID) {
  11.   int explosionID = jjAddObject(OBJECT::ELECTROBULLET, jjObjects[ringID].xPos, jjObjects[ringID].yPos, jjObjects[ringID].creator, CREATOR::PLAYER);
  12.   jjDeleteObject(ringID);
  13.   jjObjects[explosionID].determineCurAnim(ANIM::AMMO, 1, true);
  14.   jjObjects[explosionID].state = STATE::EXPLODE;
  15. }
  16.  
  17. void onMain() {
  18.  
  19.   p.ammo[9] = 3;
  20.  
  21.   for(int i = 1; i < jjObjectCount; i++) {
  22.     if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::SMOKERING) {
  23.       jjObjects[i].ySpeed = 0;
  24.       jjObjects[i].xPos = jjObjects[i].xPos+(jjObjects[i].direction*10);
  25.       if (jjObjects[i].counter > 10) jjDeleteObject(i);
  26.     }
  27.   }
  28.  
  29.   for (int i = 0;  i < jjObjectCount; i++)
  30.     if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::PLAYER) {
  31.     //Create smokering
  32.     if (jjObjects[i].eventID == OBJECT::ELECTROBULLET && jjObjects[i].state != STATE::EXPLODE) {
  33.       jjDeleteObject(i);
  34.       CreateRing(i);
  35.       continue;
  36.     }
  37.    
  38.     //Destroy smokering
  39.     if (jjObjects[i].eventID == OBJECT::SMOKERING) {
  40.       jjObjects[i].age++;
  41.         if (jjObjects[i].age > cRingLifeTime)
  42.       DestroyRing(i);
  43.       continue;
  44.     }
  45.     }
  46. }