AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] Tempents Extension with example (https://forums.alliedmods.net/showthread.php?t=54096)

API 04-16-2007 22:34

[EXTENSION] Tempents Extension with example
 
2 Attachment(s)
Hey guys,

For those of you that do not know what tempents is, it is the interface in-which allows you to make special effects, like a beam for hookmod, or things like rings around players.

Credit
Thanks to everyone in IRC, especially BAILOPAN and cybermind, FlyingMongoose inspired me to do it.

Installation
1. Extract 'tempents.ext.dll' and 'tempents.ext.so' to the 'addons/sourcemod/extensions' folder.
2. Extract 'tempents.inc' to the 'addons/sourcemod/scripting/include' folder.

Functions
There are 8 different functions that you can use in your plugins.
They are documented and called as follows.
Code:

/**
 * Create a Armor Ricochet effect
 *
 * @param index                        Index of player to display to
 * @param delay                        Delay before effect is emitted
 * @param position                Position of effect
 * @param direction                Direction of effect
 * @return                                -1 means you passed the incorrect number of parameters
 */
native TEArmorRicochet(index, Float:delay, Float:position[3], Float:direction[3]);
       
/**
 * Create a beam between 2 points
 *
 * @param modelindex        Index of the precached texture
 * @param index                        Index of player to display to
 * @param delay                        Delay before the effect is displayed
 * @param startpos                The position the beam starts at
 * @param endpos                The position the beam ends at
 * @param life                        How long the beam lives
 * @param width                        How wide the beam is
 * @param endwidth                How wide the end of the beam is
 * @param color[4]                The color [0]=r, [1]=g, [2]=b, [3]=alpha
 * @param startframe        The frame for the model to start on, usually just 0
 * @param framerate                The frame rate
 * @param fadelength        The fade length of the effect
 * @param amplitude                The amplitude of the effect
 * @param speed                        The speed of the effect
 * @return                                -1 means you passed the incorrect number of parameters
 */
native TEBeamPoints(modelindex, index, Float:delay, Float:startpos[3], Float:endpos[3], Float:life, Float:width, Float:endwidth, color[4], startframe, framerate, fadelength, Float:amplitude, speed);
       
/**
 * Create an effect to follow an entity
 *
 * @param modelindex        Index of the precached texture
 * @param index                        Index of player to display to
 * @param entindex                Index of entity to follow
 * @param delay                        Delay before the effect is displayed
 * @param life                        How long the beam lives
 * @param width                        How wide the beam is
 * @param endwidth                How wide the end of the beam is
 * @param color[4]                The color [0]=r, [1]=g, [2]=b, [3]=alpha
 * @param fadelength        The fade length of the effect
 * @return                                -1 means you passed the incorrect number of parameters
 */
native TEBeamFollow(modelindex, index, entindex, Float:delay, Float:life, Float:width, Float:endwidth, color[4], fadelength);
       
/**
 * Create a ring around a point
 *
 * @param modelindex        Index of the precached texture
 * @param index                        Index of player to display to
 * @param delay                        Delay before the effect is displayed
 * @param centerpos                The position of the ring's center
 * @param startradius        The radius at the beginning of the effect
 * @param endradius                The radius at the ending of the effect
 * @param life                        How long the beam lives
 * @param width                        How wide the beam is
 * @param color[4]                The color [0]=r, [1]=g, [2]=b, [3]=alpha
 * @param startframe        The frame for the model to start on, usually just 0
 * @param framerate                The frame rate
 * @param amplitude                The amplitude of the effect
 * @param spread                The spread of the effect
 * @param speed                        The speed of the effect
 * @return                                -1 means you passed the incorrect number of parameters
 */
native TEBeamRingPoint(modelindex, index, Float:delay, Float:centerpos[3], Float:startradius, Float:endradius, Float:life, Float:width, color[4], startframe, framerate, Float:amplitude, spread, speed);
       
/**
 * Create a Smoke effect
 *
 * @param modelindex        Index of the precached texture
 * @param index                        Index of player to display to
 * @param delay                        Delay before effect is emitted
 * @param position                Position of effect
 * @param scale                        Scale of texture
 * @param framerate                The frame rate
 * @return                                -1 means you passed the incorrect number of parameters
 */
native TESmoke(modelindex, index, Float:delay, Float:position[3], Float:scale, framerate);

/**
 * Create a Metal Spark effect
 *
 * @param index                        Index of player to display to
 * @param delay                        Delay before effect is emitted
 * @param position                Position of effect
 * @param direction                Direction of effect
 * @return                                -1 means you passed the incorrect number of parameters
 */
native TEMetalSparks(index, Float:delay, Float:position[3], Float:direction[3]);

/**
 * Emit a sound to an entity from an entity
 *
 * @param emit_to Player to Emit the sound to
 * @param source  Entity to Emit the sound from
 * @param sound  Path to the sound file
 * @param volume  Volume of the sound 
 * @return -1 means wrong number of params
 */
native TEEmitSound(emit_to,source,const String:sound[],Float:volume);

native TEExplosion(modelindex,emit_to,Float:delay,Float:pos[3],Float:scale,framerate,radius,magnitude,Float:normal[3]);

Here is a small example on usage of the functions, note, the effect is only displayed to player with index 1, you need to call it multiple times for multiple players, the best way to do that is a loop.
Code:

#include <sourcemod>
#include <tempents>

public Plugin:myinfo =
{
        name = "Tempents Test",
        author = "PimpinJuice",
        description = "Testing out the tempents extension",
        version = "1.0.0.0",
        url = "http://pimpinjuice.net/"
};

public OnPluginStart()
{
        RegServerCmd("test_command", Command_Test)
}
 
public Action:Command_Test(args)
{
        new Float:delay=0.0;
        new Float:pos[3];
        pos[0]=138.0;
        pos[1]=-1548.0;
        pos[2]=64.0;
        new Float:dir[3];
        dir[0]=0.0;
        dir[1]=0.0;
        dir[2]=0.0;
        TEMetalSparks(1, delay, pos, dir);
}

Have fun. :)

FlyingMongoose 04-17-2007 00:18

Re: [EXTENSION] Tempents Extension with example
 
Dude...you're fast and awesome :) much much <3 this will provide so much nifty stuff!

otstrel 04-17-2007 03:32

Re: [EXTENSION] Tempents Extension with example
 
Wow, that's nice!

API 04-17-2007 09:42

Re: [EXTENSION] Tempents Extension with example
 
Oh... I forgot... If you want to define a variable for color, you would do the following:
Code:

new color[4];
color[0]=255; // all red
color[1]=128; // half green
color[2]=0; // no blue
color[3]=128; // half visible

Then you just pass color.
Thanks :)

FlyingMongoose 04-17-2007 13:33

Re: [EXTENSION] Tempents Extension with example
 
okay so it's a color array, 0,1,2 are RGB, and 3 = Alpha :)
Awesome.

DiscoBBQ 04-23-2007 20:46

Re: [EXTENSION] Tempents Extension with example
 
pwn pwn

API 04-24-2007 21:14

Re: [EXTENSION] Tempents Extension with example
 
I added the sourcecode.

FlyingMongoose 04-25-2007 16:40

Re: [EXTENSION] Tempents Extension with example
 
I've kicked this into gear in one of my plugins: expect niftyness on SpawnProtect soon ;).

API 04-29-2007 11:22

Re: [EXTENSION] Tempents Extension with example
 
Update
Added TETraceline and TEEmitSound.

API 04-29-2007 20:43

Re: [EXTENSION] Tempents Extension with example
 
Update
Fixed EmitSound problem playing throughout the whole map.


All times are GMT -4. The time now is 15:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.