Problems with some new weapon ...

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Problems with some new weapon ...

Postby Doc-Pyton » Thu Sep 13, 2007 11:11 pm

Hi ...

Sgt.Nova alias Backsp!n ... and i started to make some mod for nexuiz ...
I want to remake each weapon model from the existing ones ... the look of them is very innovative and i want to keep that ... but thats not the problem for now ...

Our Problem is cause we didn want to change any of the weapons thats ingame for now we started to include some new one ...
Cause it should be some weapon that uses a Beam like the NEX we started using the code of the NEX ... We found nearly everything thats needet to change the setting of the nex to somethin that fits to our weapon ... the Only Problem now is that we didn found the definition of the Beam effect ... I know that the file nexbeam.tga is used for the beam the nex uses ... but we didn found any connection between the nex and this file ...
So the question is how to change the file thats used for that beam ?

I thought it could be changed here :

// beam effect
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, 76);
WriteCoord (MSG_BROADCAST, w_shotorg_x + w_shotdir_x * 18);
WriteCoord (MSG_BROADCAST, w_shotorg_y + w_shotdir_y * 18);
WriteCoord (MSG_BROADCAST, w_shotorg_z + w_shotdir_z * 18);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
WriteCoord (MSG_BROADCAST, 0);
WriteCoord (MSG_BROADCAST, 0);
WriteCoord (MSG_BROADCAST, 0);

The Only line of this code that could be the connection to the beamfile is this here :
WriteByte (MSG_BROADCAST, 76);
I dont know what this line stands for ... and whats the 76 ? ... we thought it's some impulse but we didn found some impulse numbered with 76 ...

I think were wrong there ... but we searched the whole code ... and didn find anythin that could be used for that beam ...

Can anyone here help us with this problem ?
Doc-Pyton
Alien
 
Posts: 155
Joined: Thu Aug 30, 2007 7:30 pm

Postby Doc-Pyton » Sat Sep 15, 2007 2:26 pm

I just asked LordHavoc ...
he told me that this code is no longer needet since nexuiz 2.3
Instead of this :

// beam effect
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, 76);
WriteCoord (MSG_BROADCAST, w_shotorg_x + w_shotdir_x * 18);
WriteCoord (MSG_BROADCAST, w_shotorg_y + w_shotdir_y * 18);
WriteCoord (MSG_BROADCAST, w_shotorg_z + w_shotdir_z * 18);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
WriteCoord (MSG_BROADCAST, 0);
WriteCoord (MSG_BROADCAST, 0);
WriteCoord (MSG_BROADCAST, 0);

U can just use this :

trailparticles(world, particleeffectnum("TE_MISSIGNO"), w_shotorg + w_shotdir * 18, trace_endpos);

This will just use the effect thats declared as "TE_MISSIGNO" inside the effectsinfo.txt, that can be found in the main data.pk3

Mind on that u can only use effects that are declared in that .txt- file

So if u didn declare the effect "TE_MISSIGNO" it wont work.
U can just use this to create as much effects in that .txt and use it for what u want.

Another example is this here :
pointparticles(particleeffectnum("TE_MISSIGNO_IMPACT"), trace_endpos, w_shotdir * -100, 1);

This works mostly like the trailparticles but instead of some Beam this willl give u the impact effect at the end position. The "1" at the end of this line is some variable for the ammount that will be spawned.
i didn reconize that this codelines are already explained in the extensions.qc
Maybe i didn see that cause i was too fixed on finding that number that was used in the old codeblock.

However this will make things much easyer, thanks to LordHavoc.

for better understanding, here's the original Mail-Reply :

> Then we said that the last weapon in the cycle is 10 :
>
> // For weapon cycling commands
> float WEP_FIRST = 1;
> float WEP_LAST = 10;

So far, so good.

> --------------------------------------------------------------------------
>
> After this we changed this part here of the cl_impulse.qc :
>
> if (imp >= 1 && imp <= 13)
> {
> // weapon switching impulses
> if(self.deadflag == DEAD_NO)
> {
> if (imp <= 10)
> W_SwitchWeapon (imp);
> else if (imp == 11)
> W_NextWeapon ();
> else if (imp == 13)
> W_PreviousWeapon ();
> else if (imp == 12) // last weapon
> W_SwitchWeapon (self.cnt);
> }
> else
> self.impulse = imp; // retry in next frame
> }
> --------------------------------------------------------------------------
>
> The Problem we have now is that the game gives the error : "invalid weapon"
> if i switch the weapons to fast.

You can modify the imp >= 1 && imp <= 12 part to have a 13 like you did, but PLEASE do not renumber the imp values, that would require modifying key bindings in the configs.

Instead replace this:
if (imp <= 9)
W_SwitchWeapon (imp);
else if (imp == 10)
W_NextWeapon ();
else if (imp == 12)
W_PreviousWeapon ();
else if (imp == 11) // last weapon
W_SwitchWeapon (self.cnt);
with this:
if (imp <= 9)
W_SwitchWeapon (imp);
else if (imp == 10)
W_NextWeapon ();
else if (imp == 12)
W_PreviousWeapon ();
else if (imp == 11) // last weapon
W_SwitchWeapon (self.cnt);
else if (imp == 13)
W_SwitchWeapon (10);

Note that the W_SwitchWeapon call needs it to be one of the WEP_ numbers, 10 is one such number.

> The new weapon is just selectable over the "0" key cause we changed that in the default.cfg
> We can change the weapon over the next and prev function weapon too, but only if we do that slowly.
> We didn get from where this error came from.

Most likely the error was to do with self.cnt (the last used weapon, for the laser's second fire button which switches you back to the last weapon you were using).

> The Second Problem is to change the Beam-effect of our new Weapon.
> We made some additional entry in the effects.info that looks like this :
>
> // missignoblaster beam
> effect TE_TEI_G3

You want to change effect TE_TEI_G3 to TE_MISSIGNO, more on this below.

> one of the Problems is this part here of the code :
>
> // beam effect
> WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
> WriteByte (MSG_BROADCAST, 76);
> WriteCoord (MSG_BROADCAST, w_shotorg_x + w_shotdir_x * 18);
> WriteCoord (MSG_BROADCAST, w_shotorg_y + w_shotdir_y * 18);
> WriteCoord (MSG_BROADCAST, w_shotorg_z + w_shotdir_z * 18);
> WriteCoord (MSG_BROADCAST, trace_endpos_x);
> WriteCoord (MSG_BROADCAST, trace_endpos_y);
> WriteCoord (MSG_BROADCAST, trace_endpos_z);
> WriteCoord (MSG_BROADCAST, 0);
> WriteCoord (MSG_BROADCAST, 0);
> WriteCoord (MSG_BROADCAST, 0);

You want to use this line instead of that block of code:
trailparticles(world, particleeffectnum("TE_MISSIGNO"), w_shotorg + w_shotdir * 18, trace_endpos);

This is a new function added in Nexuiz 2.3, we should move many more effects in the Nexuiz code to use this function, but had not done so yet.

You can add any new effects you like with pointparticles() and trailparticles().

For usage of pointparticles, here's an example:
pointparticles(particleeffectnum("TE_MISSIGNO_IMPACT"), trace_endpos, w_shotdir * -100, 1);

That will create an effect at the impact point, and it will have a slight backwards velocity (causing it to kind of splash back from the impact point), the 1 is a modifier for how many particles you want.
Doc-Pyton
Alien
 
Posts: 155
Joined: Thu Aug 30, 2007 7:30 pm


Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron