Forum

Firebullets Question

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Firebullets Question

Postby lukas2288 » Thu Aug 13, 2009 6:42 pm

Hi inside3d users,
i want to ask if there is someway to add setmodel line to firebullets function?Or how to add efect function from LordHavocs effectinfo.txt?

I?ve try this but nothing happend:

void(float shotcount, vector dir, vector spread) FireBullets =
{
local vector direction;
local vector src;

makevectors(self.v_angle);

src = self.origin + v_right*10;
src_z = self.absmin_z + self.size_z * 0.7;

ClearMultiDamage ();
while (shotcount > 0)
{
direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;

traceline (src, src + direction*2048, FALSE, self);
if (trace_fraction != 1.0)
TraceAttack (4, direction);

shotcount = shotcount - 1;

local entity shot;
local vector shotvec;
shotvec = (trace_endpos - self.origin) + (normalize(direction) * 40);
shot = Gyro_Force_Create("gunshot", self.origin);
setmodel (trails, "progs/tracer.mdl");

Gyro_Force_ApplyFalloff_ConeLinear(shot, shotvec, 20, 20);
Gyro_Force_ApplyAffector_Directional(shot, shotvec, 130, FALSE);
Gyro_Force_AddProperty_Instant(shot);
Gyro_Force_Ignore(shot, self);
}

ApplyMultiDamage ();
};

and for railung effect

void(float shotcount, vector dir, vector spread) FireBullets =
{
local vector direction;
local vector src;

makevectors(self.v_angle);

src = self.origin + v_right*10;
src_z = self.absmin_z + self.size_z * 0.7;

ClearMultiDamage ();
while (shotcount > 0)
{
direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;

traceline (src, src + direction*2048, FALSE, self);
if (trace_fraction != 1.0)
TraceAttack (4, direction);

shotcount = shotcount - 1;

local entity shot;
local vector shotvec;
shotvec = (trace_endpos - self.origin) + (normalize(direction) * 40);
self.effects = (self.effects | TE_TEI_G3);

shot = Gyro_Force_Create("gunshot", self.origin);
Gyro_Force_ApplyFalloff_ConeLinear(shot, shotvec, 20, 20);
Gyro_Force_ApplyAffector_Directional(shot, shotvec, 130, FALSE);
Gyro_Force_AddProperty_Instant(shot);
Gyro_Force_Ignore(shot, self);
}

ApplyMultiDamage ();
};

What i am doing wrong?
________
Marijuana bubbler
Last edited by lukas2288 on Tue Mar 08, 2011 12:50 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby avirox » Thu Aug 13, 2009 11:35 pm

Are you trying to make bullet tracers appear? Quake doesn't have a model for shot bullets; it simply uses tracelines to calculate where they end, and then either damages or deflects depending on what's hit. If you want a bullet "model" to appear flying from the player's weapon, the easiest way (save for an extension which DP probably has) is to spawn a kind of flying bullet model which moves at a very fast velocity towards the trace end point.

It's kind of a server bog though to do it that way, and I suggest CSQC. Anyhoo, good luck!
avirox
 
Posts: 137
Joined: Wed Aug 16, 2006 3:25 pm

Postby Spike » Fri Aug 14, 2009 1:09 am

model trail:
hijack an existing effect, specifically te_beam, and replace the effect (te_beam is not used in regular quake, it was added for one of the expansions, though I forget which).
Note that replacing te_beam with some custom model will work in supposedly any NQ engine without kicking any clients or whatever.
either: float TE_BEAM = 13; //blah, entnum,src,dst
or if you require extensions: void(entity own, vector start, vector end) te_beam = #431; //(DP_TE_STANDARDEFFECTBUILTINS)
Name your model progs/beam.mdl, and make sure its precached in advance.
Note that DP does not support replacing such effects with particle effects. You must use some other network protocol feature in order to use effectinfo.txt in DP.
With the possible exception of DP_TE_STANDARDEFFECTBUILTINS, which is just an easier way to specify it, this requires no extensions and will work in any NQ engine. But it doesn't use DP's effectinfo.txt stuff.

Extensions:
The csqc particletrail builtin will work in ssqc in DP, a bit like it'll work in csqc, but you'll need to ensure that the particle effect numbers will match (ie: same effectinfo.txt). And this doesn't require csqc to be in use.
I'd dig up the prototypes for the csqc-derived particletrail builtin, but DP's is non-compliant, so you'll have to get that from someone else.
This will work only in DP, as it will cause illegible server messages or similar in other engines. They might not all kick you.
But this method does permit you to use effectinfo.txt stuff, and does not require you to provide a csprogs.dat file.
Its not a CSQC-dependant feature, its just meant to be compatible with equivelent functionality previously available only to csqc.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby lukas2288 » Sat Aug 15, 2009 7:01 pm

Spike wrote:model trail:
hijack an existing effect, specifically te_beam, and replace the effect (te_beam is not used in regular quake, it was added for one of the expansions, though I forget which).
Note that replacing te_beam with some custom model will work in supposedly any NQ engine without kicking any clients or whatever.
either: float TE_BEAM = 13; //blah, entnum,src,dst
or if you require extensions: void(entity own, vector start, vector end) te_beam = #431; //(DP_TE_STANDARDEFFECTBUILTINS)
Name your model progs/beam.mdl, and make sure its precached in advance.
Note that DP does not support replacing such effects with particle effects. You must use some other network protocol feature in order to use effectinfo.txt in DP.
With the possible exception of DP_TE_STANDARDEFFECTBUILTINS, which is just an easier way to specify it, this requires no extensions and will work in any NQ engine. But it doesn't use DP's effectinfo.txt stuff.

Extensions:
The csqc particletrail builtin will work in ssqc in DP, a bit like it'll work in csqc, but you'll need to ensure that the particle effect numbers will match (ie: same effectinfo.txt). And this doesn't require csqc to be in use.
I'd dig up the prototypes for the csqc-derived particletrail builtin, but DP's is non-compliant, so you'll have to get that from someone else.
This will work only in DP, as it will cause illegible server messages or similar in other engines. They might not all kick you.
But this method does permit you to use effectinfo.txt stuff, and does not require you to provide a csprogs.dat file.
Its not a CSQC-dependant feature, its just meant to be compatible with equivelent functionality previously available only to csqc.


So you mean that i must create a qc functinon called csqc like in nexuiz for example?
________
Easy vape vaporizer
Last edited by lukas2288 on Tue Mar 08, 2011 12:50 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby Spike » Sat Aug 15, 2009 9:34 pm

look in dpextensions.qc?
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby lukas2288 » Sat Aug 15, 2009 10:16 pm

Spike wrote:look in dpextensions.qc?


yeap i found what you write but i do not know how to use it in qc.
I try in firerocket to add line
missile.effects = TE_BEAM

but it does not work.
________
MARIJUANA HEMP
Last edited by lukas2288 on Tue Mar 08, 2011 12:50 am, edited 1 time in total.
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm

Postby frag.machine » Sun Aug 16, 2009 3:28 pm

No. There's a message TE_BEAM in Quake standard protocol that can be hacked to obtain this effect. Look for WriteByte () calls in vanilla QuakeC source code and you'll have a good start point to make your modification.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby lukas2288 » Tue Aug 18, 2009 12:01 am

frag.machine wrote:No. There's a message TE_BEAM in Quake standard protocol that can be hacked to obtain this effect. Look for WriteByte () calls in vanilla QuakeC source code and you'll have a good start point to make your modification.


Hi fragmachine
i have already do this in firelightning but when i fire the game kicm me.Here is the code i use te_gunshot effect for example:

void() W_FireLightning =
{
local vector org;
local float cells;

if (self.ammo_cells < 1)
{
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
return;
}

// explode if under water
if (self.waterlevel > 1)
{
cells = self.ammo_cells;
self.ammo_cells = 0;
W_SetCurrentAmmo ();
T_RadiusDamage (self, self, 35*cells, world);
return;
}

if (self.t_width < time)
{
sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
self.t_width = time + 0.6;
}
self.punchangle_x = -2;

self.currentammo = self.ammo_cells = self.ammo_cells - 1;

org = self.origin + '0 0 16';

traceline (org, org + v_forward*600, TRUE, self);

WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);

LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
};
________
Burger King Gift Cards
lukas2288
 
Posts: 42
Joined: Sun Jun 14, 2009 4:40 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest