Forum

Need Help Emulating SoTN Batsmash on player touch

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Need Help Emulating SoTN Batsmash on player touch

Postby gnounc » Sun Apr 24, 2011 2:16 am

I'm trying to emulate the batsmash from symphony of the night,
so when you fly towards an enemy, they go flying backwards.
I have the flying forwards part down, but setting the enemies
velocity just freezes the enemy.

I've added a .touch function for the player and have a .smash flag
and a .smash_finished timer as well.

Any ideas?
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am

Re: Need Help Emulating SoTN Batsmash on player touch

Postby OneManClan » Sun Apr 24, 2011 8:42 am

gnounc wrote:I'm trying to emulate the batsmash from symphony of the night,
so when you fly towards an enemy, they go flying backwards.
I have the flying forwards part down, but setting the enemies
velocity just freezes the enemy.

I've added a .touch function for the player and have a .smash flag
and a .smash_finished timer as well.

Any ideas?


Hey Gnounc,
Perhaps MauveBibs chaplain_pushplayers function could be modified for your purpose (more info here):

Code: Select all
//  Credit: MauveBib
void() chaplain_pushplayers =
{
   local entity guy;
   local vector direc;
   local float dist;

   guy = findradius(self.origin, 100);
   
   while(guy)
   {
      if ((guy.flags & FL_CLIENT) && (guy.team != self.team))
      {
         if (vlen(guy.origin - self.origin) < 100)
         {
            direc = normalize(guy.origin - self.origin);
            dist = (100 - (vlen(guy.origin - self.origin)));
            guy.velocity = guy.velocity + direc * (dist * 3);
            self.velocity = self.velocity - direc * dist;
         }
      }   
      guy = guy.chain;
   }
};
OneManClan
 
Posts: 243
Joined: Sat Feb 28, 2009 2:38 pm

Thanks Error

Postby gnounc » Sun Apr 24, 2011 8:42 am

Error pointed out that to set the enemies velocity, you need to remove their on ground flag like so:

other.flags = other.flags - (other.flags & FL_ONGROUND);
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest