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

Medic gun healing beam between two entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geel9
Senior Member
Join Date: Mar 2009
Old 07-10-2010 , 13:55   Medic gun healing beam between two entities
Reply With Quote #1

What about this won't make that happen?
Code:
			AttachParticle(client, ent, String:particleType[],controlpoint)
{
    //This is used to attach a particle that has two control points
    //such as the medic gun beam. One originates from the medic
    //and the other to its healer
    
    //This particle is attached to the source player
    //This will be visible
    particle[client]  = CreateEntityByName("info_particle_system");
    
    //This particle is attached to the destination player
    //This will not be visibile, we only need it so the source particle
    //is attached in the apropriate place
    particle2[client] = CreateEntityByName("info_particle_system");

    if (IsValidEdict(particle[client]))
    {    
        //Name the originating source, usually the player
        new String:tName[128];
        Format(tName, sizeof(tName), "target%i", ent);
        DispatchKeyValue(ent, "targetname", tName);
        
        //Name the destination, usually another player
        new String:cpName[128];
        Format(cpName, sizeof(cpName), "target%i", controlpoint);
        DispatchKeyValue(controlpoint, "targetname", cpName);
        
        //Name the particle (this particle is attached to the source player)
        new String:particleName[128];
        Format(particleName, sizeof(particleName), "tf2particle%i", particle[client]);
        DispatchKeyValue(particle[client], "targetname", particleName);
        
        //Tell it what effect name it is then spawn it so we can use it
        DispatchKeyValue(particle[client], "effect_name", particleType);
        DispatchSpawn(particle[client]);
        
        //--------------------------------------
        new String:cp2Name[128];
        
        //Give the destination particle a unique anme
        Format(cp2Name, sizeof(cp2Name), "tf2particle%i", particle2[client]);
        
        DispatchKeyValue(particle2[client], "targetname", cp2Name);
        
        //Attach the destination particle to the destined player
        DispatchKeyValue(particle2[client], "parentname", cpName);
        
        SetVariantString(cpName);
        AcceptEntityInput(particle2[client], "SetParent");
        
        //-----------------------------------------------
        
        //Here's where we "join" the two particles
        //Parent the source particle to the source player
        DispatchKeyValue(particle[client], "parentname", tName);
        SetVariantString(tName);
        AcceptEntityInput(particle[client], "SetParent");
        
        //Join the source particle to the destination particle
        DispatchKeyValue(particle[client], "cpoint1", cp2Name);
        
        //Attach the source particle to the "flag" (stomach area)
        SetVariantString("laser_origin");
        AcceptEntityInput(particle[client], "SetParentAttachment");
        
        ActivateEntity(particle[client]);
        AcceptEntityInput(particle[client], "start");
        PrintToChatAll("Made particle.")
    }
}

Calling it:

Code:
AttachParticle(x, SGs[x], "medicgun_beam_blue", RepairNodes[x])
It just travels from the correct entity TO THE CENTER OF THE MAP.

Last edited by Geel9; 07-11-2010 at 18:27.
Geel9 is offline
FoxMulder
Senior Member
Join Date: Jan 2009
Location: Orlando, FL
Old 07-10-2010 , 22:08   Re: Medic gun healing beam between two entities
Reply With Quote #2

PHP Code:
AttachParticle(entString:particleType[],controlpoint)
{
    
//This is used to attach a particle that has two control points
    //such as the medic gun beam. One originates from the medic
    //and the other to its healer
    
    //This particle is attached to the source player
    //This will be visible
    
new particle  CreateEntityByName("info_particle_system");
    
    
//This particle is attached to the destination player
    //This will not be visibile, we only need it so the source particle
    //is attached in the apropriate place
    
new particle2 CreateEntityByName("info_particle_system");

    if (
IsValidEdict(particle))
    {    
        
//Name the originating source, usually the player
        
new String:tName[128];
        
Format(tNamesizeof(tName), "target%i"ent);
        
DispatchKeyValue(ent"targetname"tName);
        
        
//Name the destination, usually another player
        
new String:cpName[128];
        
Format(cpNamesizeof(cpName), "target%i"controlpoint);
        
DispatchKeyValue(controlpoint"targetname"cpName);
        
        
//Name the particle (this particle is attached to the source player)
        
new String:particleName[128];
        
Format(particleNamesizeof(particleName), "tf2particle%i"particle);
        
DispatchKeyValue(particle"targetname"particleName);
        
        
//Tell it what effect name it is then spawn it so we can use it
        
DispatchKeyValue(particle"effect_name"particleType);
        
DispatchSpawn(particle);
        
        
//--------------------------------------
        
new String:cp2Name[128];
        
        
//Give the destination particle a unique anme
        
Format(cp2Namesizeof(cp2Name), "tf2particle%i"particle2);
        
        
DispatchKeyValue(particle2"targetname"cp2Name);
        
        
//Attach the destination particle to the destined player
        
DispatchKeyValue(particle2"parentname"cpName);
        
        
SetVariantString(cpName);
        
AcceptEntityInput(particle2"SetParent");
        
        
//Attach the destination particle to the "flag" (stomach area)
        
SetVariantString("flag");
        
AcceptEntityInput(particle2"SetParentAttachment");
        
//-----------------------------------------------
        
        //Here's where we "join" the two particles
        //Parent the source particle to the source player
        
DispatchKeyValue(particle"parentname"tName);
        
SetVariantString(tName);
        
AcceptEntityInput(particle"SetParent");
        
        
//Join the source particle to the destination particle
        
DispatchKeyValue(particle"cpoint1"cp2Name);
        
        
//Attach the source particle to the "flag" (stomach area)
        
SetVariantString("flag");
        
AcceptEntityInput(particle"SetParentAttachment");
        
        
//The particle is finally ready
        
ActivateEntity(particle);
        
AcceptEntityInput(particle"start");
        
        
//PrintToChatAll("Particle 1: %i   Particle 2: %i",particle,particle2);
    
}

This is a snippet from some code I have although I haven't used it in a good while so I really don't know how well it works now.
When it was working I would do something like

Code:
AttachParticle(Client1, "medicgun_beam_blue" ,Client2)
and that would attach the heal beam from Client 1 to Client 2.

Edit: Damn, I knew this seemed like Déjà vu https://forums.alliedmods.net/showpo...89&postcount=7
__________________

Last edited by FoxMulder; 07-10-2010 at 22:12.
FoxMulder is offline
Geel9
Senior Member
Join Date: Mar 2009
Old 07-10-2010 , 23:00   Re: Medic gun healing beam between two entities
Reply With Quote #3

It always just goes from the entity to the center of the map. FFFUU

Here's MY attachparticle:

Code:
AttachParticle(client, ent, String:particleType[],controlpoint)
{
    //This is used to attach a particle that has two control points
    //such as the medic gun beam. One originates from the medic
    //and the other to its healer
    
    //This particle is attached to the source player
    //This will be visible
    particle[client]  = CreateEntityByName("info_particle_system");
    
    //This particle is attached to the destination player
    //This will not be visibile, we only need it so the source particle
    //is attached in the apropriate place
    particle2[client] = CreateEntityByName("info_particle_system");

    if (IsValidEdict(particle[client]))
    {    
        //Name the originating source, usually the player
        new String:tName[128];
        Format(tName, sizeof(tName), "target%i", ent);
        DispatchKeyValue(ent, "targetname", tName);
        
        //Name the destination, usually another player
        new String:cpName[128];
        Format(cpName, sizeof(cpName), "target%i", controlpoint);
        DispatchKeyValue(controlpoint, "targetname", cpName);
        
        //Name the particle (this particle is attached to the source player)
        new String:particleName[128];
        Format(particleName, sizeof(particleName), "tf2particle%i", particle[client]);
        DispatchKeyValue(particle[client], "targetname", particleName);
        
        //Tell it what effect name it is then spawn it so we can use it
        DispatchKeyValue(particle[client], "effect_name", particleType);
        DispatchSpawn(particle[client]);
        
        //--------------------------------------
        new String:cp2Name[128];
        
        //Give the destination particle a unique anme
        Format(cp2Name, sizeof(cp2Name), "tf2particle%i", particle2[client]);
        
        DispatchKeyValue(particle2[client], "targetname", cp2Name);
        
        //Attach the destination particle to the destined player
        DispatchKeyValue(particle2[client], "parentname", cpName);
        
        SetVariantString(cpName);
        AcceptEntityInput(particle2[client], "SetParent");
        
        //-----------------------------------------------
        
        //Here's where we "join" the two particles
        //Parent the source particle to the source player
        DispatchKeyValue(particle[client], "parentname", tName);
        SetVariantString(tName);
        AcceptEntityInput(particle[client], "SetParent");
        
        //Join the source particle to the destination particle
        DispatchKeyValue(particle[client], "cpoint1", cp2Name);
        
        //Attach the source particle to the "flag" (stomach area)
        SetVariantString("laser_origin");
        AcceptEntityInput(particle[client], "SetParentAttachment");
        
        ActivateEntity(particle[client]);
        AcceptEntityInput(particle[client], "start");
        PrintToChatAll("Made particle.")
    }
}
And I call it:
Code:
AttachParticle(x, SGs[x], "medicgun_beam_blue", RepairNodes[x])

Last edited by Geel9; 07-11-2010 at 18:26.
Geel9 is offline
Geel9
Senior Member
Join Date: Mar 2009
Old 07-11-2010 , 18:26   Re: Medic gun healing beam between two entities
Reply With Quote #4

I REALLY need help with this!
Geel9 is offline
FoxMulder
Senior Member
Join Date: Jan 2009
Location: Orlando, FL
Old 07-11-2010 , 20:28   Re: Medic gun healing beam between two entities
Reply With Quote #5

Would really like to help you as I'd like to see this on the repair node but I'm busy with a project atm. I'll be able to look into this later on in the week.
__________________
FoxMulder is offline
Geel9
Senior Member
Join Date: Mar 2009
Old 07-13-2010 , 23:11   Re: Medic gun healing beam between two entities
Reply With Quote #6

I fixed it. It was an issue where the Repair Node had no attachments for the control point. So I fixed it very cleverly, if I may say so myself. I made an invisible, nocollide dispenser model at the exact location the node is, and used its attachment
Geel9 is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 07-14-2010 , 00:41   Re: Medic gun healing beam between two entities
Reply With Quote #7

Quote:
Originally Posted by Geel9 View Post
I fixed it. It was an issue where the Repair Node had no attachments for the control point. So I fixed it very cleverly, if I may say so myself. I made an invisible, nocollide dispenser model at the exact location the node is, and used its attachment
oh man.. i recommend to use info_target entity for doing that...
javalia is offline
Geel9
Senior Member
Join Date: Mar 2009
Old 07-14-2010 , 02:34   Re: Medic gun healing beam between two entities
Reply With Quote #8

Quote:
Originally Posted by javalia View Post
oh man.. i recommend to use info_target entity for doing that...

As I recall that doesn't work.
Geel9 is offline
KawMAN
SourceMod Donor
Join Date: Sep 2007
Location: Cracov
Old 07-14-2010 , 03:46   Re: Medic gun healing beam between two entities
Reply With Quote #9

This is no working because player model (*.mdl) dont have "laser_origin" attachment area, you must attach this to existing part of body(model), to see available run SourceSDK choose Team Fortress 2, run Model Viewer, open some player model go to Attachments Tab and on to right is list called Attachment, you can only attach other thinks to point on this list. I recommend "flag" area.

Also you can change postion of that attachment using "SetParentAttachmentMaintainOffset" (not "SetParentAttachment") but first you need to Teleport entity to right place, note that you still need to point correct attachment eg. "flag"
__________________
KawMAN is offline
Send a message via ICQ to KawMAN Send a message via Skype™ to KawMAN
Geel9
Senior Member
Join Date: Mar 2009
Old 07-14-2010 , 03:55   Re: Medic gun healing beam between two entities
Reply With Quote #10

Quote:
Originally Posted by KawMAN View Post
This is no working because player model (*.mdl) dont have "laser_origin" attachment area, you must attach this to existing part of body(model), to see available run SourceSDK choose Team Fortress 2, run Model Viewer, open some player model go to Attachments Tab and on to right is list called Attachment, you can only attach other thinks to point on this list. I recommend "flag" area.

Also you can change postion of that attachment using "SetParentAttachmentMaintainOffset" (not "SetParentAttachment") but first you need to Teleport entity to right place, note that you still need to point correct attachment eg. "flag"
First of all, notice I said two entites not a player. Also, I said I already fixed this. I am NOT trying to connect it to a player.
Geel9 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 16:43.


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