Forum

exploding nails.

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

exploding nails.

Postby ceriux » Fri Jan 21, 2011 4:19 am

so iv been trying to implement my own version of exploding nails and iv been quite successful. the nails fire, hit the wall , stick for a few seconds, then explode. now the problem im coming to is with damage.

the spikes damage me as the explode i know this, they "might" damage the enemy's as they explode. (thats a little bit hard to test.) but when the nails strike the enemy's they explode. but the enemy's dont die.

so, here's my code someone please help me figure this out.


(iv more or less mixed the rocket code with the nail code)



Code: Select all
void() spike_boom =

{
   sound (self, CHAN_BODY, "weapons/r_exp3.wav", 0.5, ATTN_NORM);
   particle (self.origin, self.oldorigin*0.05, 235, 16);
   BecomeExplosion();
   T_RadiusDamage (self, self.owner, 30, other);
};





Code: Select all

void() superspike_touch =
{
   local float rand;
   local float   damg;
   if (other == self.owner)
      return;

   if (other.solid == SOLID_TRIGGER)
      return;   // trigger field, do nothing

   if (pointcontents(self.origin) == CONTENT_SKY)
   {
      remove(self);
      return;
   }
   //T_RadiusDamage (self, self.owner, 120, other);
   self.origin = self.origin - 8*normalize(self.velocity);
// hit something that bleeds
   if (other.takedamage)
   {
      spawn_touchblood (18);
           sound (self, CHAN_BODY, "weapons/r_exp3.wav", 0.5, ATTN_NORM);
   particle (self.origin, self.oldorigin*0.05, 235, 16);
   BecomeExplosion();
   T_RadiusDamage (self, self.owner, 30, other);
      return;
   }
   else
   
        {
                WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
               
                if (self.classname == "wizspike")
                        WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
                else if (self.classname == "knightspike")
                        WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
                else
                        WriteByte (MSG_BROADCAST, TE_SPIKE);
                WriteCoord (MSG_BROADCAST, self.origin_x);
                WriteCoord (MSG_BROADCAST, self.origin_y);
                WriteCoord (MSG_BROADCAST, self.origin_z);
        }
   self.velocity = '0 0 0';        //add this, it makes the nail stop

   
   self.nextthink = time + 3;
   
   
   self.think = spike_boom;
   
   //particle (self.origin, self.oldorigin*0.05, 235, 16);
   //sound (self, CHAN_BODY, "weapons/r_exp3.wav", 0.5, ATTN_NORM);
   

};



i still have some code from me experimenting commented out. sorry.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby leileilol » Fri Jan 21, 2011 4:36 am

why'd you nuke the t_damage? even the rocket launcher uses t_damage
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby ceriux » Fri Jan 21, 2011 4:47 am

it seemed it only used t_damage on shamblers idk i really only wanted radius damage caused by the nails. although, what i could do is have it do t_damage to just simulate the damage from the explosion. but i want the explosion to push the enemy's away from the explosions. sorta like how other explosions work.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Orion » Fri Jan 21, 2011 4:54 am

Your T_RadiusDamage() call on your spike won't do damage to the entity the spike is hitting.

Take a look:

T_RadiusDamage (self, self.owner, 30, other);

That's why the enemies won't die. Change that last other to world, so the radius damage won't ignore any entity unless the world.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby ceriux » Fri Jan 21, 2011 4:56 am

both instances of other? the one in spike boom and in spike touch?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Orion » Fri Jan 21, 2011 4:57 am

Yep.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby ceriux » Fri Jan 21, 2011 4:58 am

okay thank you. ill try it out.

defiantly worked thanks =)
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest