ItsMods

Full Version: Entity Extension v1.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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. Tongue
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).
Nice release. But it's pretty stupid you obfuscated it, IMO. There are loads of people who can actually learn from it as well.
If there's enough demand, perhaps I'll upload an unobfuscated version, I haven't even consulted with @Nukem about this yet, I'm not sure he want's me to expose how it works.

EDIT - Turns out I uploaded the unobfuscated version by accident, oh wells, go wild.
Also, "Vector ModelName - " Shouldn't that be String?
I would be interested in soure code though I disagree with @Pozzuh that "loads" of people will learn from it as most people won't understand it. Of course it's your decision.

Anyway @master131 awesome job. Is it possible to rotate the model (Pitch, Roll, Yaw)?
(04-30-2012, 12:41)zxz0O0 Wrote: [ -> ]I would be interested in soure code though I disagree with @Pozzuh that "loads" of people will learn from it as most people won't understand it. Of course it's your decision.

Maybe not loads but a few at least.
I've fixed the string thingies, and if you read my post edit, I accidentally uploaded the unobfuscated one. Doesn't matter anymore anyway.. @zxz0O0 Yes, I think you can, through the ViewOrigin property which I forgot to expose, I'll do it later.

EDIT - Done.
OMA Nice release Nyan Cat
(04-30-2012, 12:44)master131 Wrote: [ -> ]@zxz0O0 Yes, I think you can, through the ViewOrigin property which I forgot to expose, I'll do it later.
Well I mean to do one by one. Like:
RotatePitch( <pitch angle>, <time> );
RotateRoll( <roll angle>, <time> );
RotateYaw( <yaw angle>, <time> );
Very nice @master131 , and i desagree with @Pozzuh , he gives the source if he wants to.

If you are not happy, well i dont care, make your own addon them...

Thanks Barata...
Pages: 1 2 3