Forum

applying health to weapons

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby redrum » Mon Oct 15, 2007 4:05 pm

Orion? Urre?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby leileilol » Mon Oct 15, 2007 7:49 pm

Bueller.......?
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby redrum » Mon Oct 15, 2007 10:13 pm

Hey, that's my line...
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Mon Oct 15, 2007 10:44 pm

Try this:

Replace the following code at health_touch():

Code: Select all
// Megahealth = rot down the player's super health
   if (self.healtype == 2)
   {
      other.items = other.items | IT_SUPERHEALTH;
      self.nextthink = time + 5;
      self.think = item_megahealth_rot;
      self.owner = other;
   }
   else
   {
      if (deathmatch != 2)      // deathmatch 2 is the silly old rules
      {
         if (deathmatch)
            self.nextthink = time + 20;
         self.think = SUB_regen;
      }
   }


To this:

Code: Select all
if (deathmatch != 2)      // deathmatch 2 is the silly old rules
{
   if (deathmatch)
      self.nextthink = time + 20;
   self.think = SUB_regen;
}


This will remove the health rotting, I think the problem comes from that.
When you get a megahealth box, you health will no longer rot down, but it'll still limit to 250.
If you don't like that I'll try to write a different health rotting code.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Mon Oct 15, 2007 11:13 pm

Thanks man! I'll try it out :)
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Mon Oct 15, 2007 11:32 pm

That fixed the problem, I could live without the rot!
Thanks!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Thu Oct 25, 2007 4:16 am

I'm running into one small problem.
If I'm standing on a spawnpoint for an item and it respawns beneath me I get stuck. I have to shoot my way out.
Why doesn't the player "pick up" the item?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Electro » Thu Oct 25, 2007 6:54 am

in SUB_regen
do

setorigin(self, self.origin);

This will force the entity to update so the touch will register.

...or some bullshit
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Postby Urre » Thu Oct 25, 2007 8:00 am

Why not rather use forceretouch or whatever it was called?

redrum: instead of doing what the un-cool Electro said, in SUB_Regen, add a line at the bottom that says:

Code: Select all
force_retouch = 2;


That should do the trick!
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby redrum » Thu Oct 25, 2007 4:32 pm

Already had setorigin(self, self.origin); in there.
force_retouch = 2; didn't help :cry:
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Wed Oct 31, 2007 1:06 am

Bueller?

Code: Select all
void() SUB_regen =
{       
   self.model = self.mdl;                                                // restore original model
   self.solid = SOLID_BBOX;                                              // allow it to be touched again
        self.health = 25;
        self.takedamage = DAMAGE_AIM;
        self.th_die = ItemDie;
        self.touch = self.blocked;
   sound (self, CHAN_VOICE, "items/itembk2.wav", .8, ATTN_NORM);         // play respawn sound
   setorigin (self, self.origin);
        force_retouch = 2;                                                    //not working
};

This is what I have, still getting "stuck"
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Sajt » Wed Oct 31, 2007 1:14 am

It sucks that your mod isn't on some cool engine because then the items could just be SOLID_CORPSE (though i'm not sure if SOLID_CORPSE register trigger-like touches)...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby redrum » Wed Oct 31, 2007 2:20 am

Tried to get DP running, won't work though.
Stupid NVidia card! :cry:

Anyway, I figured my problem out. I changed self.solid = SOLID_BBOX; to self.solid = SOLID_TRIGGER;

Not the best fix, items don't blow up when you hit them, b/c you don't actually hit them anymore. BUT, when a rocket explodes nearby then they explode! :D

Also, the bots won't grab an item until after it respawns :cry:

I'm still hoping FrikaC will make some QW friendly bots. Just need them to be able to transfer map to map. That would complete my mod :D
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Chris » Wed Oct 31, 2007 9:54 pm

at work now so I can't double check this, but a way around checking to see if you'll get stuck is for the item before it spawns running a small findradius. If it returns an entity with

classname == "player"

that means you, (or any other client on the server) would get stuck in it. Or you could make it a broader scope and just check if the entity's

.takedamage == DAMAGE_YES.


Now to recall the code, I think it would be

Code: Select all

local entity e;

e = findradius (self.origin, (choose radius size here));

    self.solid = SOLID_BBOX;// make solid object by default.

while (e)
{

       if (e.classname == "player") // found player in radius
       {
        self.solid = SOLID_TRIGGER;// make non solid or else get stuck
        return;   
       }

e = e.chain;  // loop through entities.
}


That's work for the initial check I'd think to make it so if you would've gotten stuck it makes it SOLID_TRIGGER. However then the issue you have as you said before things like traceline and TraceAttack stuff can't inflict damage, only spawned entities moving in 3d space or the T_RadiusDamage stuff. So you may want to consider giving the entitiy if it is SOLID_TRIGGER a think function that updates every couple of seconds checking to see if a player is still in it.


Or you could force retouch as stated above however I've never come across this issue, mainly because DP supports SOLID_CORPSE and a few ways around this. You could possibly start by giving it a SOLID_TRIGGER and give it a .think, and if something is touching it and is a player then continue running this check until no player is touching it and then make it SOLID_BBOX.
Granted continuous findradius's can be taxing, but once every couple of seconds and stopping once a player or damageable object is no longer in it's immediate collision space is well within bounds.
Chris
 
Posts: 79
Joined: Sat Aug 05, 2006 5:31 am

Postby redrum » Thu Nov 01, 2007 3:11 am

Thanks for the additional knowledge!!
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest