The 'Entity Extension' library, is a library to extend the features of the MW3 Server Addon API which allows the ability to spawn entities. This plugin will be a 'temporary' until @Nukem decides to add this natively into the Addon API (that is, if he decides to).
How do I use this?
Simply download and extract the ZIP and add the DLL as a reference in your plugin, it uses the Addon namespace just like the original Addon so it integrates very nicely. Make sure to put the DLL along with your own plugin in the plugins folder, this is important!
How do I spawn an entity?
To spawn an entity, you use the Entity.Create method, which returns a new Entity object. The constructor for the Entity.Create method is as follows:
string className - This is the classname of the entity. Valid classnames can be found here. The most common one would be script_model.
string modelName - Obviously, as the name suggests, this is the name of the model that the entity will have when it's spawned. Make sure that the model is precache/loaded into the map by default otherwise it won't appear.
Vector origin - This is the origin of where the entity will appear when it's created.
What properties do I have access to?
The Entity class currently exposes the current properties:
float[] Angles - The angles of the entity, index 0 being the X axis and index 1 being the Y axis. (Angles[0] == X axis and Angles[1] == Y axis).
int EntityNum - The entity's index/number, I recommend you don't play around with this.
string HeadModelName - The entity's head model, I'm not sure this will work unless they are a player, note that this property can only be set.
string ModelName - The entity's model, note again that this can only be set as only a model ID is stored in the entity's struct in memory.
Vector Origin - The origin/location of the entity.
Vector ViewOrigin - The view origin of the entity.
Changes:
v1.1:
- Added support for 1.7.413
Credits:
@Nukem - Providing code examples/snippets in C++.
master131 - Converting all the examples into C# including the inline asm (which was a bitch to do but perfectly possible).
How do I use this?
Simply download and extract the ZIP and add the DLL as a reference in your plugin, it uses the Addon namespace just like the original Addon so it integrates very nicely. Make sure to put the DLL along with your own plugin in the plugins folder, this is important!
How do I spawn an entity?
To spawn an entity, you use the Entity.Create method, which returns a new Entity object. The constructor for the Entity.Create method is as follows:
string className - This is the classname of the entity. Valid classnames can be found here. The most common one would be script_model.
string modelName - Obviously, as the name suggests, this is the name of the model that the entity will have when it's spawned. Make sure that the model is precache/loaded into the map by default otherwise it won't appear.
Vector origin - This is the origin of where the entity will appear when it's created.
What properties do I have access to?
The Entity class currently exposes the current properties:
float[] Angles - The angles of the entity, index 0 being the X axis and index 1 being the Y axis. (Angles[0] == X axis and Angles[1] == Y axis).
int EntityNum - The entity's index/number, I recommend you don't play around with this.
string HeadModelName - The entity's head model, I'm not sure this will work unless they are a player, note that this property can only be set.
string ModelName - The entity's model, note again that this can only be set as only a model ID is stored in the entity's struct in memory.
Vector Origin - The origin/location of the entity.
Vector ViewOrigin - The view origin of the entity.
Changes:
v1.1:
- Added support for 1.7.413
Credits:
@Nukem - Providing code examples/snippets in C++.
master131 - Converting all the examples into C# including the inline asm (which was a bitch to do but perfectly possible).
A casual conversation between barata and I about Nukem.