Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Auto Fire
Auto Fire
2004-09-02, 5:20 AM #1
I need a cog, that when an enemy gets in your pov, it automatically fires without have to push the fire button. So far, I have a weap_conc that auto aims, I just need to add code so that as soon as the enemy is in view, it fires on the enemy.

I already have the auto aim part figured out, I just need to have it fire automatically.

Any ideas?

Arden Lyn
2004-09-02, 7:31 AM #2
Golem Forge auto gun!!!! Edit that!!!

------------------
SpriteMod (JO 2003) Roger Wilco Skin
SpriteMod (JO 2003) Roger Wilco Skin

Snail racing: (500 posts per line) ---@%
2004-09-02, 7:40 AM #3
Code:
   // Check all things for our victim.
   victim = -1;
   maxDot = 0;

   // Search for all players and actors.
   potential = FirstThingInView(player, 35, 8, 0x404);
   while(potential != -1)
   {
      if(
         HasLOS(player, potential) &&
         (potential != player) &&
         (VectorDist(GetThingPos(player), GetThingPos(potential)) <= 5) &&
         !(GetThingFlags(potential) & 0x200))
      {
         dot = ThingViewDot(player, potential);
         if(dot > maxDot)
         {
            victim = potential;
            maxDot = dot;
         }
      }
      potential = NextThingInView();
   }

   // If we have a victim...
   if(victim != -1)
   {
      powerBoost = GetInv(player, 63);
      ActivateWeapon(player, fireWait/powerBoost, mode);
   }
   else
   {
      DeactivateWeapon(player, mode);
   }


Something like that could do the trick, though implementing it into the weapon will take a little more than copy/pasting.

QM

↑ Up to the top!