Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Firebullets Question

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
lukas2288 Joined: 14 Jun 2009 Posts: 42 |

Posted: Thu Aug 13, 2009 6:42 pm Post subject: Firebullets Question |

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?

Back to top |

avirox Joined: 16 Aug 2006 Posts: 109 |

Posted: Thu Aug 13, 2009 11:35 pm Post subject: |

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!

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Fri Aug 14, 2009 1:09 am Post subject: |

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.
_________________
What's a signature?

Back to top |

lukas2288 Joined: 14 Jun 2009 Posts: 42 |

Posted: Sat Aug 15, 2009 7:01 pm Post subject: |

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?

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Sat Aug 15, 2009 9:34 pm Post subject: |

look in dpextensions.qc? _________________ What's a signature?

Back to top |

lukas2288 Joined: 14 Jun 2009 Posts: 42 |

Posted: Sat Aug 15, 2009 10:16 pm Post subject: |

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.

Back to top |

frag.machine Joined: 25 Nov 2006 Posts: 728 |

Posted: Sun Aug 16, 2009 3:28 pm Post subject: |

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. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/

Back to top |

lukas2288 Joined: 14 Jun 2009 Posts: 42 |

Posted: Tue Aug 18, 2009 12:01 am Post subject: |

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);
};

Back to top |

Display posts from previous:

| 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