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

[L4D1 & L4D2] HP Laser [v1.0.9 | 14-November-2021]


Post New Thread Reply   
 
Thread Tools Display Modes
azureblue
Member
Join Date: Oct 2021
Location: Two Steps from Hell
Old 10-17-2021 , 13:18   Re: [L4D1 & L4D2] HP Laser [v1.0.8 | 24-July-2021]
Reply With Quote #21

wow, this plugin very useful for doctor class when using survivor talent plugin. worked perfectly!
thanks alot marttt ! nice work !
azureblue is offline
ChrisP
Member
Join Date: Jan 2010
Old 10-18-2021 , 23:27   Re: [L4D1 & L4D2] HP Laser [v1.0.8 | 24-July-2021]
Reply With Quote #22

Quote:
Originally Posted by Marttt View Post
Hi @ChrisP, thanks for feedback and the snippet code. I will check.

I already have played on XPMod server and it has nice features and concepts.

For dummy entities, I recommend using an "info_target" entity which is less expensive.

The problem with the HP laser is that I have to calculate the angles for each player every moment to teleport it correctly for the player's view.

I know someone with a similar plugin and AFAIK is not public but is better than mine.

I have the HP Sprite plugin aswell, which is good but need FastDL to use the custom sprite.
You could use TE_SendToClient to send only to an individual client instead of using TE_SendToAll. I suppose the entity count could get out of hand pretty quickly though, because I bet you're doing multiple beams for each health bar and you would need two dummy entities per beam. Might not want to run that on a 8v8 server or more, but could be feasible for normal servers. I suppose a hybrid approach could work if the entity count starts to grow beyond a certain amount.

Unfortunately, info_target didn't work when I tried it. Maybe I'm missing something, but the only thing that made it work for me is prop_dynamic with a model set. I have guesses as to why, but honestly, I'm not sure why prop_dynamic works and the others I've tried don't. I should poke at it more to find the most performant working option.
ChrisP is offline
xZk
Senior Member
Join Date: Nov 2017
Location: cl
Old 10-19-2021 , 13:49   Re: [L4D1 & L4D2] HP Laser [v1.0.8 | 24-July-2021]
Reply With Quote #23

I think the problem here is not exactly attaching the TempEnts to other entities, but controlling them so that the hp bar looks good, which must necessarily be recreated for this purpose. Although a long time ago I was also trying and it is possible to recreate it by relating it to 2 ents and to be able to change the size of the laser by moving those 1 of those 2 entities to simulate the hp bar, but I had the problem that in certain viewing angles the bar is inverted for which I left it abandoned.
here is the code in case someone is interested:
PHP Code:
int CreateSpriteBar(int entityfloat height 2.0float widthfloat durationint color[4]){
    
float pos[3];
    
GetEntPropVector(entityProp_Data"m_vecAbsOrigin"pos);
    
pos[2]+=80.0;
    
int ent CreateEntityByName("env_sprite");
    if (
ent 0)
    {
        
DispatchKeyValueVector(ent"origin"pos);
        
DispatchKeyValue(ent"model"SPRITE_WHITE);
        
DispatchSpawn(ent);
        
SetVariantString("!activator");
        
AcceptEntityInput(ent"SetParent"entityent);
        
AcceptEntityInput(ent"HideSprite");
    }
    
pos[2]+=height;
    
int ent2 CreateEntityByName("env_sprite");
    if (
ent2 0)
    {
        
DispatchKeyValueVector(ent2"origin"pos);
        
DispatchKeyValue(ent2"model"SPRITE_WHITE);
        
DispatchSpawn(ent2);
        
SetVariantString("!activator");
        
AcceptEntityInput(ent2"SetParent"entent2);
        
//AcceptEntityInput(ent2, "SetParent", entity, ent2);
        
AcceptEntityInput(ent2"HideSprite");
    }
    
TE_SendBeamBar(entent2widthdurationcolor);
    return 
ent;
}

TE_SendBeamBar(int startEntint endEntfloat sizefloat durationint color[4])
{
    
TE_SetupBeamEnts(startEntendEntg_iLaserMaterialg_iHaloMaterial00durationsizesize11.0color0);
    
TE_SendToAll();
}

stock void TE_SetupBeamEnts(int StartEntityint EndEntityint ModelIndexint HaloIndexint StartFrameint FrameRatefloat Lifefloat Widthfloat EndWidthint FadeLengthfloat Amplitude, const int Color[4], int Speed)
{
    
TE_Start("BeamEnts");
    
TE_WriteEncodedEnt("m_nStartEntity"StartEntity);
    
TE_WriteEncodedEnt("m_nEndEntity"EndEntity);
    
TE_WriteNum("m_nModelIndex"ModelIndex);
    
TE_WriteNum("m_nHaloIndex"HaloIndex);
    
TE_WriteNum("m_nStartFrame"StartFrame);
    
TE_WriteNum("m_nFrameRate"FrameRate);
    
TE_WriteFloat("m_fLife"Life);
    
TE_WriteFloat("m_fWidth"Width);
    
TE_WriteFloat("m_fEndWidth"EndWidth);
    
TE_WriteFloat("m_fAmplitude"Amplitude);
    
TE_WriteNum("r"Color[0]);
    
TE_WriteNum("g"Color[1]);
    
TE_WriteNum("b"Color[2]);
    
TE_WriteNum("a"Color[3]);
    
TE_WriteNum("m_nSpeed"Speed);
    
TE_WriteNum("m_nFadeLength"FadeLength);


Last edited by xZk; 10-19-2021 at 13:49.
xZk is offline
ChrisP
Member
Join Date: Jan 2010
Old 10-19-2021 , 15:33   Re: [L4D1 & L4D2] HP Laser [v1.0.8 | 24-July-2021]
Reply With Quote #24

Thank you xZk! env_sprite works for a dummy entity replacement and I'm sure this is much lighter than using prop_dynamic. I'll be using this for Rochelle's rope and any other similar use cases in the future.

Also, I like that you took a different approach to what I was thinking. You put the beam start and end points vertical instead of horizontal, which solves the issue of needing to adjust angles for each client because the sprite rotates to each client's view automatically. I played around a little bit with your code and made it work, but with what might be a deal breaker for some. The health indicator bar has to be in the middle of the health bar. If this is acceptable, then it only needs two dummy entities per client health bar and don't have to mess with rotation. Cool Stuff!

ChrisP is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 11-14-2021 , 11:54   Re: [L4D1 & L4D2] HP Laser [v1.0.9 | 14-November-2021]
Reply With Quote #25

Plugin updated (1.0.9)

Code:
1.0.9 (14-November-2021)
   - Added center align laser option. (thanks to "xZk" for the code snippet)
   - Removed outline lasers.
__________________
Marttt is offline
thewintersoldier97
Senior Member
Join Date: Aug 2021
Location: Vietnam
Old 11-14-2021 , 13:00   Re: [L4D1 & L4D2] HP Laser [v1.0.9 | 14-November-2021]
Reply With Quote #26

Great plugin My buds and I loved this, pretty sure other folks played on my sv feel the same. Excellent work Marttt!
__________________

Looking for some fun!
thewintersoldier97 is offline
little_froy
Senior Member
Join Date: May 2021
Old 02-12-2022 , 05:24   Re: [L4D1 & L4D2] HP Laser [v1.0.9 | 14-November-2021]
Reply With Quote #27

nice work for 4+ survivors game.
little_froy 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 09:26.


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