![]() |
Mdll ??
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); Code:
pEntity->v.origin = Vector (-2107.2, 2448.2, 36.0) And last question, it's possible to redefine with metamod the value of "m_bloodColor" ? Thx for u help. Regards, |
Re: Mdll ??
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 |
Re: Mdll ??
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) ? |
Re: Mdll ??
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 |
Re: Mdll ??
Thx Botman for your reply..
|
Re: Mdll ??
To found pvPrivateData value
http://djeyl.net/forum/index.php?act...=post&id=80628 look here http://djeyl.net/forum/index.php?showtopic=7162 |
All times are GMT +2. The time now is 23:46. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.