AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [ANY] Dissolve Ragdolls (https://forums.alliedmods.net/showthread.php?t=161012)

GoRRageBoy 07-02-2011 08:50

[ANY] Dissolve Ragdolls
 
Here's a bit of code you can stick in any plugin to make players ragdolls dissolve on death.

Tested and working in
● Team Fortress 2 (though I'm sure this will work in other games such as DoD:S, L4D, L4D2, CS:S)

Known bugs with this code
● [TF2] When playing as a Spy using the Dead Ringer, when you feign death, your fake corpse doesn't dissolve. (I'm not exactly sure how to fix this, so if someone could help me out, that'd be swell)

Here's what the effect looks like ingame (TF2). The dissolving uses the effect from Half Life 2 for when you dissolve someone using those energy ball things.
[IMG]http://img824.**************/img824/2194/dissolvescout.th.png[/IMG]
(Click thumbnail to view fullsize image)


PHP Code:

public OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathPostEventHookMode_Post);
}


public 
Action:Event_PlayerDeathPost(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));

    if (
IsValidEntity(victim))
    {
        
CreateTimer(0.1Timer_DissolveRagdollany:victim);
    }
    return 
Plugin_Continue;
}


public 
Action:Timer_DissolveRagdoll(Handle:timerany:victim)
{
    new 
ragdoll GetEntPropEnt(victimProp_Send"m_hRagdoll");

    if (
ragdoll != -1)
    {
        
DissolveRagdoll(ragdoll);
    }
}


DissolveRagdoll(ragdoll)
{
    new 
dissolver CreateEntityByName("env_entity_dissolver");

    if (
dissolver == -1)
    {
        return;
    }

    
DispatchKeyValue(dissolver"dissolvetype""0");
    
DispatchKeyValue(dissolver"magnitude""1");
    
DispatchKeyValue(dissolver"target""!activator");

    
AcceptEntityInput(dissolver"Dissolve"ragdoll);
    
AcceptEntityInput(dissolver"Kill");

    return;



klausenbusk 07-23-2011 07:11

Re: [ANY] Dissolve Ragdolls
 
Quote:

Originally Posted by miknew20 (Post 1510073)
i dont know how to download it help D:

This are for plugin developer :)

Bacardi 07-26-2011 05:45

Re: [ANY] Dissolve Ragdolls
 
Credits to L. Duke Dissolve (player ragdolls)

GoRRageBoy 08-03-2011 04:39

Re: [ANY] Dissolve Ragdolls
 
Quote:

Originally Posted by Bacardi (Post 1518704)

^-- No. Just no.

This code isn't from his plugin.

gameguysz 08-14-2011 19:47

Re: [ANY] Dissolve Ragdolls
 
Quote:

Originally Posted by miknew20 (Post 1532347)
i know but how do i use the PHP code :?:


Its not a PHP code its a actual code for a plugin that you can develop.

GoRRageBoy 08-22-2011 02:22

Re: [ANY] Dissolve Ragdolls
 
So apparently we now have team-colored dissolving on weapons like the Righteous Bison, Cow Mangler 5000 and that new Engi weapon...uh...Short Circuit, I think.

Does anyone know how to change this dissolving code to use the team-colored dissolving?

FlaminSarge 09-26-2011 05:56

Re: [ANY] Dissolve Ragdolls
 
Probably set the dissolvetype to something else. Or set the death event's damagecustom to something.

This code looks awfully familiar.

Also, instead of passing victim in the timer, you should pass GetEventInt(event, "userid") and then within the Timer_DissolveRagdoll, client = GetClientOfUserId(userid), check if the client's valid and not 0, and then do the rest of the stuff.

psychonic 09-26-2011 09:19

Re: [ANY] Dissolve Ragdolls
 
Have you tried just changing the dissolver's m_iTeamNum ?

FlaminSarge 09-27-2011 06:37

Re: [ANY] Dissolve Ragdolls
 
Doesn't seem to have any effect.

GoRRageBoy 09-27-2011 19:49

Re: [ANY] Dissolve Ragdolls
 
Quote:

Originally Posted by FlaminSarge (Post 1563445)
Probably set the dissolvetype to something else. Or set the death event's damagecustom to something.

This code looks awfully familiar.

Also, instead of passing victim in the timer, you should pass GetEventInt(event, "userid") and then within the Timer_DissolveRagdoll, client = GetClientOfUserId(userid), check if the client's valid and not 0, and then do the rest of the stuff.

It should look familiar. It's from your Give Weapon plugin.

I actually took the code from your plugin and turned it into it's own plugin.

However, as I stated above, Dead Ringer Spies are left wide open because their fake corpses don't dissolve and I can't figure out how to make that work.


All times are GMT -4. The time now is 21:52.

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