Re: [hlcoders] Weapon script overrides

2010-11-29 Thread Nova Silisko
Well, I'm having some more issues. I have a simple temporary solution of
using a placeholder model with different skins to represent different items
- it works fine, but the weapon selection is broken.

I overrode the filter for not picking up weapons you already have with an
exception for weapon_item, which also works.

The problem being the actual weapon selection as stated earlier, I can
select one, then the other, but after that I can't switch back again. I've
been rooting around in the weapon_selection.cpp file and
hud_weaponselection.cpp file and haven't been able to find much that works.

I'd hope it will be a lot easier than getting the weapon_item working in the
first place...
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-27 Thread Saul Rennison
I'm afraid that DEFINE_AUTO_ARRAY_KEYFIELD is broken. That's why you can't
set the spotlight texture in the Hammer entity properties dialog, a proper
fix would be to change:

#define DEFINE_AUTO_ARRAY_KEYFIELD(name,fieldtype,mapname) _FIELD(name,
fieldtype, SIZE_OF_ARRAY(((classNameTypedef *)0)-name), FTYPEDESC_SAVE,
mapname, 0 )

to

#define DEFINE_AUTO_ARRAY_KEYFIELD(name,fieldtype,mapname) _FIELD(name,
fieldtype, SIZE_OF_ARRAY(((classNameTypedef *)0)-name), FTYPEDESC_KEY |
FTYPEDESC_SAVE, mapname, 0 )

Note how the second has the FTYPEDESC_KEY flag set (which should be set for
all KEYFIELD data descs). This automatically does the networked var value
setting instead of manually in ::KeyValue

Thanks,
 - Saul.


On 26 November 2010 22:58, Nova Silisko novasili...@gmail.com wrote:

 Also, in env_projectedtexture.cpp there is:

 DEFINE_AUTO_ARRAY_KEYFIELD( m_SpotlightTextureName, FIELD_CHARACTER,
 texturename ),

 Does this mean it doesn't need a Keyvalues() function or is it something
 else?
 ___
 To unsubscribe, edit your list preferences, or view the list archives,
 please visit:
 http://list.valvesoftware.com/mailman/listinfo/hlcoders


___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-27 Thread Nova Silisko
All that's really worrying me right now is the fact that it seems to be
impossible to get the string itself to actually network to the client..

Here's the latest code by the way:

(I updated DEFINE_AUTO_ARRAY_KEYFIELD like you suggested, by the way)

http://pastebin.com/uYxviT6W
http://pastebin.com/TUcupE1T

I'm frankly about ready to give up on thisI'd like to at least get a
rough build going, even if it's sloppy and inefficient, just a bare minimum
of allowing me to even START the project would be lovely.
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-27 Thread Nova Silisko
Yaay the custom build step managed to break itself.
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-27 Thread Nova Silisko
As it turns out:

The Msg command not working was due to it being in the Spawn function.
In hud_weaponselection.cpp, the weapon name is pulled from the script, not
the actual GetPrintName() function.

Now I have a temporarily workable solution, just without viewmodels.
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



[hlcoders] Weapon script overrides

2010-11-26 Thread Nova Silisko
I currently have a goal - make an inventory system using the existing weapon
framework.

I have a fairly good plan:

weapon_item

Needs several keyvalues;

View Model - Overrides the weapon script for view model.
World Model - Same as above but with world.
Bucket number - Position horizontally in the weapon list.
Bucket order - Vertical bucket position.
Display Name - Self explanatory

~edit
ALTERNATIVELY

Instead of specific keyvalues for the above properties, a single one loading
a script (say, scripts/items/pipe.txt)

Already tried this method but ran into more difficulties.

I THOUGHT they were good plans anyway... Then I tried to code them.

So far, my only results have been a world model showing, and the weapon
slot/bucket being correct. View model and display name are currently NOT
working, and I can't determine why.

Here is the code for both client and server:
Client - http://pastebin.com/ZesQCzeY
Server - http://pastebin.com/G9ib6ik2

Much of it is a mess of overrides to the CBaseCombatWeapon class, but I feel
as though there is a simpler way it could be done...

Right now I've done the terrifically barbaric solution of hardcoding all the
names and viewmodels and referring to them based on an integer in the
keyvalues - integers seem to be the only thing I can properly network.

Originally posted on steam forums, but I'm getting desperate now...
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-26 Thread Saul Rennison
Hi Nova,

I'm not entirely sure how strings are networked but I'm pretty sure it only
networks string_t's. So therefore, to network character arrays (i.e.
strings), go to your server file and in your datatable replace:

DEFINE_KEYFIELD( m_kvWorldModel, FIELD_STRING, worldmodel ),

with:


DEFINE_AUTO_ARRAY( m_kvWorldModel, FIELD_CHARACTER ),


You may be wondering why I haven't defined that as a _KEYFIELD, well due to
some bug (or maybe feature?), string AUTO_ARRAY's do not network when they
are changed via KeyValues. Therefore we need to do it manually by adding the
following to your KeyValue() method of your entity class:


if( FStrEq(szKeyName, worldmodel ) ){

Q_strncpy( m_kvWorldModel.GetForModify(), szValue, MAX_PATH );

}


EDIT: just saw that you are using string_t's! I suggest removing all
your string_t's and just networking the character arrays as stated
above. I don't know how strings are networked around in other parts of
the game but env_projectedtexture definitely uses this to transmit the
texture name and that seems to work fine. Hope I've helped you sort
the networking issue out!


Thanks,
 - Saul.


On 26 November 2010 10:35, Nova Silisko novasili...@gmail.com wrote:

 I currently have a goal - make an inventory system using the existing
 weapon
 framework.

 I have a fairly good plan:

 weapon_item

 Needs several keyvalues;

 View Model - Overrides the weapon script for view model.
 World Model - Same as above but with world.
 Bucket number - Position horizontally in the weapon list.
 Bucket order - Vertical bucket position.
 Display Name - Self explanatory

 ~edit
 ALTERNATIVELY

 Instead of specific keyvalues for the above properties, a single one
 loading
 a script (say, scripts/items/pipe.txt)

 Already tried this method but ran into more difficulties.

 I THOUGHT they were good plans anyway... Then I tried to code them.

 So far, my only results have been a world model showing, and the weapon
 slot/bucket being correct. View model and display name are currently NOT
 working, and I can't determine why.

 Here is the code for both client and server:
 Client - http://pastebin.com/ZesQCzeY
 Server - http://pastebin.com/G9ib6ik2

 Much of it is a mess of overrides to the CBaseCombatWeapon class, but I
 feel
 as though there is a simpler way it could be done...

 Right now I've done the terrifically barbaric solution of hardcoding all
 the
 names and viewmodels and referring to them based on an integer in the
 keyvalues - integers seem to be the only thing I can properly network.

 Originally posted on steam forums, but I'm getting desperate now...
 ___
 To unsubscribe, edit your list preferences, or view the list archives,
 please visit:
 http://list.valvesoftware.com/mailman/listinfo/hlcoders


___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-26 Thread Nova Silisko
Another thing I've noticed seems to be that even directly forcing the values
in GetPrintName() and the other similar functions does not work. Is there
some specific thing going on in CBaseCombatWeapon preventing those functions
from being overridden in derived classes?
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-26 Thread Nova Silisko
Also, in env_projectedtexture.cpp there is:

DEFINE_AUTO_ARRAY_KEYFIELD( m_SpotlightTextureName, FIELD_CHARACTER,
texturename ),

Does this mean it doesn't need a Keyvalues() function or is it something
else?
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Weapon script overrides

2010-11-26 Thread Nova Silisko
And I did some more testing, put in two message functions, both in the spawn
function but on client and server:

Msg(CLIENT - VM: %s WM: %s DN: %s B1: %i B2: %i \n, m_szViewModel,
m_szWorldModel, m_szDisplayName, m_iBucket1, m_iBucket2);
Msg(SERVER - VM: %s WM: %s DN: %s B1: %i B2: %i \n, m_szViewModel.Get(),
m_szWorldModel.Get(), m_szDisplayName.Get(), m_iBucket1.Get(),
m_iBucket2.Get());

Unfortunately, it's STILL not transmitting to the client -


SERVER - VM: models/weapons/v_crowbar.mdl WM: models/weapons/w_irifle.mdl
DN: Rage test B1: 1 B2: 2

CLIENT - VM:  WM:  DN:  B1: 0 B2: 0
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders