Unknown Command

Discuss programming in the QuakeC language.
Post Reply
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Unknown Command

Post by smd »

hi!

is there such a command in dp?
i highlighted it red, cause i dont want that the grunt gib a corpse.


if (killed or shoot by a grunt)
self.health=0;
else if (killed or shoot by the player)
self.health=25;

self.th_stand = SUB_Null;
self.th_walk = SUB_Null;
self.th_run = SUB_Null;
self.th_pain = SUB_Gib;
self.th_die = army_really_die;
self.th_melee = SUB_Null;
self.th_missile = SUB_Null;
self.takedamage= DAMAGE_YES;
self.flags = self.flags &! FL_MONSTER;
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

If what you're asking is for the grunt to lose interest in a corpse, then all you have to do is set the classname of whatever's become a corpse to well, "corpse" and then have a check in ai_run() (it's in ai.qc) to make sure that what it's attacking is NOT a corpse.
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Post by smd »

worksssssss :lol:

thank u very much!!!


great forum

8)
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

Don't just thank 'u'. Also thank 'y' and 'o'.
i should not be here
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Re: Unknown Command

Post by Sajt »

smd wrote:self.flags = self.flags &! FL_MONSTER;
Are you actually doing this?
It may work for the case where FL_MONSTER is the only flag set, but what it actually does is remove ALL flags.

FL_MONSTER = 32
!FL_MONSTER = 0

anything & 0 = 0

So you're setting self.flags to 0.

! (logical not) is not a substitute for ~ (bitwise complement). QuakeC doesn't have ~ because it wouldn't work so well with floats. So in QuakeC the correct way to remove a flag is:

self.flags = self.flags - (self.flags & FL_MONSTER);

Or the equivalent:

if (self.flags & FL_MONSTER)
self.flags = self.flags - FL_MONSTER;
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.
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Post by smd »

sorry, but i need your help again :?

i have gibbable corpses, so i can also walk through them and gib them.

all works good, but sometimes suddendly all corpses become solid and i cant walk through them anymore and also all the teleporters in the map dont work then. So i cant finish shub-nigguraths pit for example, cause the teleport dont work. thats really weird!

i hope for a little help 8)
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Post by smd »

i found out that it has something to do with the w_fireaxe


void() W_FireAxe =
{
local float oldsolid;
local vector source;
local vector org;

makevectors (self.v_angle);
source = self.origin + '0 0 16';
if (ext_solidcorpse == TRUE)
{
oldsolid = self.solid;
self.solid = SOLID_BBOX;
}

traceline (source, source + v_forward*64, FALSE, self);
if (trace_fraction == 1.0)
return;

org = trace_endpos - v_forward*4;

if (trace_ent.takedamage)
{
trace_ent.axhitme = 1;
SpawnBlood (org, '0 0 0', 20);
T_Damage (trace_ent, self, self, 20);
}
else
{ // hit wall
sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}
if (ext_solidcorpse == TRUE)
self.solid = oldsolid;

};


wihtout the red code pieces = its the original fireaxe, i cant gib the corpses.


with the red code = i can gib with the axe, but after one slash with the axe, the corpses are all solid and the teleporters dont work!
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

Put the second red bit before the 'if (trace_fraction == 1) return;' bit.

Otherwise, everytime you miss, the player is stuck as SOLID_BBOX forever.

It's customary to reset the solid right after the traceline. I usually make a function called traceline_hitcorpse to make this easy.
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.
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Post by smd »

1000 thanks again, works perfect now


great :D
Post Reply