Raised This Month: $51 Target: $400
 12% 

Custom effects in game?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 10-03-2008 , 11:06   Custom effects in game?
Reply With Quote #1

I remember a while back Wowzer from 3pg was making all sorts of strange effects in game, and I never really thought much of it at the time. I was just curious if anyone has any clue what he was doing, using, etc? I would like to create effects like lightning on players, etc if at all possible, but I cannot think of anything like that that I have seen in SM.
__________________
CrimsonGT is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-03-2008 , 11:14   Re: Custom effects in game?
Reply With Quote #2

I'm just learning about this myself. This is the code (which I modified from flyingmongoose), to handle lightning to a player. I run it on a timer repeatedly for a set amount of time.

Code:
g_lightning = PrecacheModel("materials/sprites/tp_beam001.vmt");
Lightning()
{
    if (IsClientInGame(winner) && IsPlayerAlive(winner))
    {
        // get player position
        new Float:playerpos[3];
        GetClientAbsOrigin(winner,playerpos);

        // set lightning settings
        // set the top coordinates of the lightning effect
        new Float:toppos[3];
        toppos[0] = playerpos[0];
        toppos[1] = playerpos[1];
        toppos[2] = playerpos[2]+1000;
        // set the color of the lightning
        new lightningcolor[4];
        lightningcolor[0] = 255;
        lightningcolor[1] = 255;
        lightningcolor[2] = 255;
        lightningcolor[3] = 255;

        // how long lightning lasts
        new Float:lightninglife = 0.1;
        // width of lightning at top
        new Float:lightningwidth = 5.0;
        // width of lightning at bottom
        new Float:lightningendwidth = 5.0;
        // lightning start frame
        new lightningstartframe = 0;
        // lightning frame rate
        new lightningframerate = 1;
        // how long it takes for lightning to fade
        new lightningfadelength = 1;
        // how bright lightning is
        new Float:lightningamplitude = 1.0;
        // how fast the effect is drawn
        new lightningspeed = 250;

        TE_SetupBeamPoints(toppos, playerpos, g_lightning, g_lightning, lightningstartframe, lightningframerate, lightninglife, lightningwidth, lightningendwidth, lightningfadelength, lightningamplitude, lightningcolor, lightningspeed);

        TE_SendToAll(0.0);
    }
}
This one is a neat ragdoll dissolve effect which LDuke ported or created.

Code:
public Action:DissolveRagdoll(Handle:timer, any:client)
{
  if (!IsValidEntity(client) || IsPlayerAlive(client))
  {
    return;
  }
    
  new ragdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");

  if (ragdoll < 0)
  {
    return;
  }
    
  new String:dname[32];
  Format(dname, sizeof(dname), "dis_%d", client);
  
  new entid = CreateEntityByName("env_entity_dissolver");

  if (entid > 0)
  {
    DispatchKeyValue(ragdoll, "targetname", dname);
    DispatchKeyValue(entid, "dissolvetype", "0");
    DispatchKeyValue(entid, "target", dname);
    AcceptEntityInput(entid, "Dissolve");
    AcceptEntityInput(entid, "kill");
  }
}
I'm still trying to learn about more advanced affects. Putting the lightning on a short timer (0.1) still looks jagged and weird when they walk around. Not as smooth as I was hoping for.

Hope some of this points you in the right direction.
XARIUS is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 10-04-2008 , 10:26   Re: Custom effects in game?
Reply With Quote #3

The lightning effect is pretty cool, thank you
__________________
CrimsonGT is offline
Reply



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


All times are GMT -4. The time now is 00:38.


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