.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
Mdll ??
Old
  (#1)
[CCC]Taz-Devil
Member
 
Status: Offline
Posts: 7
Join Date: Feb 2004
Default Mdll ?? - 06-07-2004

Bonjour,


I would like to know, what's difference between :
This code :
Code:
sprintf (player_origin, "%0.0f %0.0f %0.0f", pPlayer->v.origin.x, pPlayer->v.origin.y, pPlayer->v.origin.z);
pkvd.szClassName = "armoury_entity";
pkvd.szKeyName = "origin";
pkvd.szValue = player_origin;
pkvd.fHandled = FALSE;
MDLL_KeyValue (pGrenade, &pkvd);
it's a sample (for vector value)
Code:
pEntity->v.origin = Vector (-2107.2, 2448.2, 36.0)
Why do u use MDLL_KeyValue ?

And last question, it's possible to redefine with metamod the value of "m_bloodColor" ?

Thx for u help.
Regards,
  
Reply With Quote
Re: Mdll ??
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Mdll ?? - 07-07-2004

MDLL_KeyValue() calls the game DLL KeyValue() function and passes it those 2 parameters.

The game DLL KeyValue() function will extract the key and value from the pkvd argument and store the value in the key of that entity. In this case, it will store the "player_origin" value in the "origin" key of the "armoury_entity" entity.

Sometimes the keys are variables within the entity 'pev' (entvars_t) structure (like 'origin' for example) and sometimes the keys are C++ class member variables (which can't be "easily" accessed outside of the C++ source code for the MOD).

"m_bloodcolor" is a C++ member variable that can't be "easily" accessed outside the MOD source code (the engine and metamod code doesn't have direct access to this variable).

You can get around this with a dirty hack using the pvPrivateData which points to the block of memory used by this C++ class instance. You can modify this data in memory and it will effect the value of variables within that C++ class.

You can search this forum for "pvPrivateData" and it will lead you to examples of doing this.

botman
  
Reply With Quote
Re: Mdll ??
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Mdll ?? - 07-07-2004

Weird or I still haven't fully understood how these key/values work. I haven't given a go at coding for a mod yet, that might be why. But still...
wouldn't a SET_ORIGIN() on his pGrenade do the same thing ?
Or is it that it wouldn't work on respawnable entities (such as ammo packs in TFC) ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Mdll ??
Old
  (#4)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Mdll ?? - 07-07-2004

The way that the KeyValue() function works, is that there is a table for each entity that indicates which member (or pev) variables can be set by a key/value pair in the BSP .map file.

When the engine spawns an entity, it creates the entity, then calls KeyValue() for each key/value pair that is assigned to that entity by the level designer. Like I said above, some of the variables being set are in the entvars_t structure (pev) and some are member variables of the C++ class.

For the variables that are in the entvars_t structure, they can be set directly instead of calling KeyValue() to set them. For example, you can set pev->origin (or pEdict->v.origin, same thing) directly and it will change the 'origin' variable for that entity. SET_ORIGIN() does this as well, but it also updates the engine's collision data information about where that entity is located in the world. If you have an entity that doesn't collide with anything, you can just set pEdict->v.origin directly. If you have an entity that needs to collide with something, you need to call SET_ORIGIN().

All of the key/value pairs are set for that entity before DispatchSpawn() is called to actually spawn that entity into the world. Once the entity is spawned, calling KeyValue() on that entity MAY update the member variables and it MAY NOT (depending on how the Spawn() function works for that particular entity. So don't just assume that you can keep calling KeyValue() on an entity after it has spawned to change any of it's member variables. Also, not all of the member variables can be changed by calling KeyValue(). You can ONLY change the variables that the MOD creators thought would need to be set by level designers when a map was being created and the entity was being spawned into the world.

botman
  
Reply With Quote
Re: Mdll ??
Old
  (#5)
[CCC]Taz-Devil
Member
 
Status: Offline
Posts: 7
Join Date: Feb 2004
Default Re: Mdll ?? - 07-07-2004

Thx Botman for your reply..
  
Reply With Quote
Re: Mdll ??
Old
  (#6)
[CCC]Taz-Devil
Member
 
Status: Offline
Posts: 7
Join Date: Feb 2004
Default Re: Mdll ?? - 08-07-2004

To found pvPrivateData value

http://djeyl.net/forum/index.php?act...=post&id=80628

look here
http://djeyl.net/forum/index.php?showtopic=7162
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com