Raised This Month: $ Target: $400
 0% 

Solved help with glow


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
finishlast
Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-21-2020 , 15:26   help with glow
Reply With Quote #1

I am currently a bit lost.
I want to make the button glow and stop glowing after being activated.

I was able to do it with a prop_glowing_object but that was glowing through walls too, so I guess that was the wrong approach.

I tried several stuff I found on the forums but I think I am missing something. (i.e. [L4D & L4D2] Extinguisher and Flamethrower)

So I reset the script to where I started i.e. without the button glow…

If someone would be so kind to direct me in the right direction. That would be awesome.

You can test on (l4d1) l4d_smalltown01_caves (coop or vs) to see what I got so far.
(last part with stairs outside / like on Mirinda server)

What I have atm is a working button, a shutter gate that opens and a panic event.

Besides the obvious coding mistakes (don't be too mean) I only need the button to glow.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_smalltown01_caves_pimp.sp - 37 views - 6.5 KB)
__________________

Last edited by finishlast; 10-25-2020 at 14:56.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-24-2020 , 15:20   Re: help with glow
Reply With Quote #2

L4D1

Give target name to your dynamic prop (button world model)
DispatchKeyValue -> "targetname", "mybutton"

In func button, set Glow Entity (that mybutton)
DispatchKeyValue -> "glow", "mybutton"


You have two way to do this.

- Turn Off dynamic prop:
Add output command into func button
Code:
		"OnIn" "mybutton,TurnOff,,0,-1"
		"OnOut" "mybutton,TurnOn,,0,-1"
Yes, it silly, to hide model.

Or

- Use HookEntityOutput, listen one of func_button outputs
Code:
  output: OnDamaged
  output: OnPressed
  output: OnUseLocked
  output: OnIn
  output: OnOut
  output: OnUser1
  output: OnUser2
  output: OnUser3
  output: OnUser4
  output: OnKilled
Get func button entity index and look propertie: m_glowEntity
Code:
int glowentity = GetEntProp(func_button, Prop_Send, "m_glowEntity");
By default, when no entity have set to glow, it's -1
But when glow entity has set, you get unique entity index. It's not entity index or entity reference.
I'm not sure what kind/type number it is.

Now you make code when button is pressed and so on.
PHP Code:
// Remove glow entity from func_button
SetEntProp(func_buttonProp_Send"m_glowEntity", -1); 

*ps:
I quickly tried this L4D in-game with addons. I have not tested through Dedicated Server.
And this could also glow dynamic prop through walls, when someone is aiming to func_button. Hard to test alone.
Also, I made those entities with Hammer map editor, not by plugin...
__________________
Do not Private Message @me

Last edited by Bacardi; 10-24-2020 at 16:02.
Bacardi is offline
finishlast
Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-25-2020 , 05:24   Re: help with glow
Reply With Quote #3

Thank you!

But appearantly I am still too dumb to make it glow.

I referenced:

PHP Code:
        PrecacheModel("models/props_unique/generator_switch_01.mdl",true);

        
ent_dynamic CreateEntityByName("prop_dynamic"); 
        
DispatchKeyValue(ent_dynamic"model""models/props_unique/generator_switch_01.mdl");
        
DispatchKeyValue(ent_dynamic"targetname""customswitch");
        
DispatchSpawn(ent_dynamic);
        
TeleportEntity(ent_dynamicvPosvAngNULL_VECTOR);

        if(
type)button CreateEntityByName("func_button");
        else 
button CreateEntityByName("func_button_timed");

        
DispatchKeyValue(button"glow""customswitch"); 
But the dynamic prop is not glowing. Do I have to initialize the glow?!

p.s. since I don't understand everything yet of the code I used of Silver there might be something preventing the glow.

As I understand you have to give dynamic prop a targetname and then reference glow in the func_button to that dynamic prop targetname which will make it glow out of the box?
Attached Files
File Type: sp Get Plugin or Get Source (l4d_smalltown01_caves_pimp.sp - 22 views - 6.0 KB)
__________________

Last edited by finishlast; 10-25-2020 at 11:09.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-25-2020 , 12:21   Re: help with glow
Reply With Quote #4

Ok, finally. I had difficulties and I had to make dedicated server also.

Use sm_test to spawn button in front of you.

- prop_dynamic glows when player aim to func_button.
- Will glow through walls, but player need still aim to func_button
- Not sure, does other players see glow when another player aim func_button
- When press button, it stay in (-1) and glow stop when button in.

I guess, this not satisfy you...

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{

    
SpawnButtonFrontOfMe(client);

    return 
Plugin_Handled;
}


// Get position front of player
void SpawnButtonFrontOfMe(int client)
{
    if(
client || client MaxClients) return;

    
float pos[3], ang[3], fwd[3];

    
GetClientEyePosition(clientpos);
    
GetClientEyeAngles(clientang);


    
GetAngleVectors(angfwdNULL_VECTORNULL_VECTOR);
    
ScaleVector(fwd100.0);
    
AddVectors(fwdposfwd);

    
char origin[100];
    
Format(originsizeof(origin), "%0.1f %0.1f %0.1f"fwd[0], fwd[1], fwd[2]);

    
// Flip 180
    
float output[3];
    
MakeVectorFromPoints(fwdposoutput);
    
GetVectorAngles(outputang);
    
ang[0] = 0.0;

    
char targetname[100];
    
int tick GetGameTickCount();
    
    
Format(targetnamesizeof(targetname), "@glow_%i"tick);

    
CreateModel(fwdangorigintargetname);
    
CreateButton(fwdangorigintargetname);
}



// Create dynamic model
void CreateModel(const float fwd[3], const float ang[3], const char[] origin, const char[] targetname)
{
    
PrecacheModel("models/props_lab/freightelevatorbutton.mdl");
    
    
int prop CreateEntityByName("prop_dynamic");
    
    if(
prop == -1) return;

    
DispatchKeyValue(prop"origin"origin);
    
DispatchKeyValue(prop"targetname"targetname); // important for func_button glow entity

    
DispatchKeyValue(prop"model""models/props_lab/freightelevatorbutton.mdl");
    
DispatchKeyValue(prop"spawnflags""0");
/*
16 = Break on Touch
32 = Break on Pressure
64 = Use Hitboxes for Renderbox
256 = Start with collision disabled
*/

    
DispatchSpawn(prop);
    
    
TeleportEntity(propfwdangNULL_VECTOR);
}



void CreateButton(const float fwd[3], const float ang[3], const char[] origin, const char[] targetname)
{
    
PrecacheModel("models/props_lab/freightelevatorbutton.mdl");

    
int prop CreateEntityByName("func_button");
    
    if(
prop == -1) return;
    
    
DispatchKeyValue(prop"origin"origin); // important or button start flying to 0, 0, 0 coordinates after press
    
DispatchKeyValue(prop"glow"targetname);

    
DispatchKeyValue(prop"wait""-1");    // Default 3 sec, -1 stay. Glowing stop when button OnIn
    
DispatchKeyValue(prop"spawnflags""1025"); // Don't move + Use Activates
/*
1 = Don't move
32 = Toggle
256 = Touch Activates
512 = Damage Activates
1024 = Use Activates
2048 = Starts Locked
4096 = Sparks
*/


    
DispatchSpawn(prop);
    
ActivateEntity(prop);
    

    
TeleportEntity(propfwdangNULL_VECTOR);

    
SetEntityModel(prop"models/props_lab/freightelevatorbutton.mdl");

    
float vMins[3] = {-30.0, -30.00.0}, vMaxs[3] = {30.030.0200.0};
    
SetEntPropVector(propProp_Send"m_vecMins"vMins);
    
SetEntPropVector(propProp_Send"m_vecMaxs"vMaxs);
    

    
// This disable entity error
    // ERROR:  Can't draw studio model models/props_lab/freightelevatorbutton.mdl because CBaseButton is not derived from C_BaseAnimating

    
int enteffects GetEntProp(propProp_Send"m_fEffects");
    
enteffects |= 32;
    
SetEntProp(propProp_Send"m_fEffects"enteffects);

__________________
Do not Private Message @me
Bacardi is offline
finishlast
Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-25-2020 , 14:54   Re: help with glow
Reply With Quote #5

Thanks a lot, I integrated your code and the button is working.

I am unsure about the vector origin part because I think the button glow disappears weather or not I put SetEntProp(dynamic_prop_button, Prop_Send, "m_glowEntity", -1); in it, so I assume it goes to
0,0,0 like stated in your source.

So for the glowing part I mark the thread solved.

Thank you for your help!
Attached Files
File Type: sp Get Plugin or Get Source (l4d_smalltown01_caves_pimp.sp - 22 views - 7.0 KB)
__________________

Last edited by finishlast; 10-26-2020 at 13:26.
finishlast is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-25-2020 , 16:12   Re: help with glow
Reply With Quote #6

Nice.

You still have little typo in map name
l4d__smalltown01_caves
Bacardi is offline
finishlast
Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-26-2020 , 13:27   Re: help with glow
Reply With Quote #7

Thank you, corrected! ;)
Attached Files
File Type: sp Get Plugin or Get Source (l4d_smalltown01_caves_pimp.sp - 2 views - 7.3 KB)
__________________

Last edited by finishlast; 11-13-2020 at 14:53.
finishlast is offline
Reply


Thread Tools
Display Modes

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:00.


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