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 <[email protected]> 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