Inside3D!
     

SOLID_NOT

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Sun Feb 21, 2010 9:54 am    Post subject: SOLID_NOT Reply with quote

I noticed that some monsters are not set to self.solid = SOLID_NOT in their first death frame. Would it be a bad thing to do so?
_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Sun Feb 21, 2010 1:04 pm    Post subject: Reply with quote

solid_not means you can walk through them as soon as they die. it means your nails will suddenly start passing through and hitting the next monster instead of going 'tink' against dead flesh.

It doesn't really matter when they become nonsolid, really it ought to be whenever they're mostly on the ground and dead, rather than while they're still collapsing. gameplay is a little nicer if its instant though.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
c0burn



Joined: 05 Nov 2004
Posts: 158
Location: Liverpool, England

PostPosted: Sun Feb 21, 2010 1:35 pm    Post subject: Reply with quote

Note that the fish code for this is horrible and it needs to be a lot, lot sooner.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Sun Feb 21, 2010 2:29 pm    Post subject: Reply with quote

This is kinda unrealistic but I don't care too much...

But I made players and monsters gibbable by setting self.takedamage = DAMAGE_YES; on Killed() insted of DAMAGE_NO.

When a player or monster dies, it will maintain the original bounding box size, still SOLID_SLIDEBOX. When they're on their last death frame, their maxs_z wil be set to -8, so you can step over them and still gib'em.

Also I had to do deadflag checks on their death function otherwise they'll always get back to their first death frames and playing death sounds right after each other, and when I kill other players I'd be getting dozens of frags and death messages until they're gibbed.

In the case of players, I removed the bodyque functions and I created a particular SpawnCorpse() function, which copies the player's current frame, angles, velocity, etc and have 40 health. This one will be gibbed on 0 health, and will be removed after 10 + random()*10 seconds.
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Sun Feb 21, 2010 5:57 pm    Post subject: Reply with quote

Yep, I did notice my nails going through the monsters or in the case of spikes that stick to walls... they stick to solid dead monsters too, then are floating when the monster is down. In the nail's touch function I added a check for SOLID_NOT on the dieing monster then removed the nail if the monster was not solid. This certainly would take care of that pesky fish problem! Cool

At first I was setting a deadflag for the dieing monster, but preferred the above method as it did make game play a little nicer.

On the other hand I like the idea of being able to gib the dead monsters. An oldie but a goody!
I always wanted to do this, add in fall damage to the monsters, and make them jump back when shot or near an explosion. Then, when they get shot off of a high ledge they will gib when they land... SPLAT!
And Orion... I learned a lot from your Ricocheting Laser that is in the tutorial section... thanks!
_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Sun Feb 21, 2010 7:36 pm    Post subject: Reply with quote

It's not hard to add falling damage or damage knockback to monsters.

To make monsters knock when taking damage, just go to T_Damage() (combat.qc) when you find a line like this:

if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK || targ.flags & FL_MONSTER) )
{
...
if (targ.flags & FL_ONGROUND)
targ.flags = targ.flags - FL_ONGROUND;

}

Just add the code in blue(don't replace anything), will check if the target(targ) is a monster. And the last 2 blue lines will unglue the monster from the floor, otherwise it won't be knocked at all.

It came from the top of my head, untested. So I think it'll be kinda messy for flying or swimming mosters though...


Now to put fall damage to monsters, the code is below:

Code:

// add this at the end of StartFrame() (world.qc)
local entity monster, oself;
monster = find(world, wad, string_null); // cycle through ALL entities
while (monster) // repeat this until monster == world
{
   if (monster.health > 0) // entity must be alive
   if (monster.flags & FL_MONSTER) // the entity must be a monster
   {
      oself = self; // switch self/monster
      self = monster;
      MonsterFallDamage ();
      self = oself;
   }
   monster = find(monster, wad, string_null); // go for next entity in the list
}

// add this function above StartFrame()
void() MonsterFallDamage =
{
   local float damage;

   if (self.flags & FL_ONGROUND && self.jump_flag < -650)
   {
      if (self.jump_flag < -1000)
         damage = 50000; // gib the monster if jumping from too high
      else
      {
         damage = self.jump_flag * -1; // make it a positive number
         damage = damage / 80; // make it reasonable
      }
      T_Damage (self, world, world, damage);
   }

   if (!(self.flags & FL_ONGROUND))
      self.jump_flag = self.velocity_z;
};

_________________
There's no signature here. Stop looking for one.


Last edited by Orion on Mon Feb 22, 2010 4:25 pm; edited 1 time in total
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Mon Feb 22, 2010 6:36 am    Post subject: Reply with quote

Orion wrote:
if (targ.flags & FL_ONGROUND)
targ.flags = targ.flags - FL_ONGROUND

This can be done a lot cleaner as targ.flags = targ.flags - (targ.flags & FL_ONGROUND); as demonstrated in the armor pickup code in items.qc

It can be done even more cleanly if the ~ operator is available (which it is in C), but I don't even think that FTEQCC supports it.

Don't forget the semicolon at the end, though. It's important...
_________________
<ekiM> Son, you're writing data structures your CPU can't cache.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Feb 22, 2010 10:28 am    Post subject: Reply with quote

<offtopic>
The ~ operator only works on integers in C. You can't do a binary not on a float. The same is true in QC.
FTEQCC does support a "&~=" operator though, which does lhs = lhs - (lhs & rhs);
(HexenC notation means "(-)" could be used as the operator instead, with "(+)"=="|=").

So basically:
targ.flags &~= FL_ONGROUND;
</offtopic>
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
goldenboy



Joined: 05 Sep 2008
Posts: 310
Location: Kiel

PostPosted: Mon Feb 22, 2010 4:40 pm    Post subject: Reply with quote

fteqcc is full of surprises.
_________________
ReMakeQuake
The Realm of Blog Magic
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group