AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D] No Mercy's Elevator [APRIL/2020] (https://forums.alliedmods.net/showthread.php?t=323532)

axelnieves2012 04-21-2020 19:33

[L4D] No Mercy's Elevator [APRIL/2020]
 
1 Attachment(s)

DESCRIPTION:
This plugin removes elevator's doors at chapter 4, just for fun.

CONVARS:
PHP Code:

//Enable/Disable this plugin.
l4d_nomercy_elevator_enable "1" 

CHANGELOG:
Version 1.0: 26 april 2020
- Initial stable release.
- Added explosions on doors.
- Removed elevator's ceiling.

Todo list:
- Make elevator lift faster.

Known bugs:
- None at the moment, post on comments.

Credits:
- Thanks Dragokas for optimizations tips.

Warning:
Not tested on L4D2, please, post here.

Beta testing versions:
- Beta testing versions will be posted on comments.
The purpose of this is posting my work progress oftenly. They may include unused code, unstable behaviors, non-working features.
Beta testing plugins will be removed without warning.

axelnieves2012 04-21-2020 19:36

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
I tried many ways to create an explosion on doors but nothing worked.
My idea was creating a propane tank on doors, make it invisible and make it explode, but it didn't work because propane tank got in flames but it never explodes. Even if I shoot at it, it doesn't explode. I have to pick it up and drop it to make it vulnerable to bullets.

Silvers 04-21-2020 19:50

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
Look at other plugins for examples. "expode" from "env_explosion" in Mutants (bomb type), or Flare Gun, or Pourgas, or Airstrike plugin. They all demonstrate one method. Another for replicating Propane tank would be using "prop_physics" and "break" input, see Greandes or Pourgas which does this using the firework /gascan models, just change to use propane model and you should have the same effect.

axelnieves2012 04-22-2020 00:17

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
Quote:

Originally Posted by Silvers (Post 2695190)
Look at other plugins for examples. "expode" from "env_explosion" in Mutants (bomb type), or Flare Gun, or Pourgas, or Airstrike plugin. They all demonstrate one method. Another for replicating Propane tank would be using "prop_physics" and "break" input, see Greandes or Pourgas which does this using the firework /gascan models, just change to use propane model and you should have the same effect.

It was very helpful. "prop_physics" is what I was looking for, thanks. Explosion is now working. I will update it soon

Dragokas 04-22-2020 13:35

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
Interesting idea, thanks !

login101 04-22-2020 21:36

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
good

Dragokas 04-23-2020 02:14

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
The code is very non-optimized.

I would suggest to hook "player_use" only when map is "l4d_hospital04_interior" instead of checking it constantly.
You can use OnMapStart forward to do that.

Anyway, "player_use" is also fire too often. It's inefficient to make the check everytime.
Instead you could just hook exactly that entity. If you decide to follow this way, some entities could not initialize yet at map start stage so "round_freeze_end" is preferrable.

PHP Code:

public void OnPluginStart()
{
    
HookEvent("round_freeze_end",         Event_RoundFreezeEnd,    EventHookMode_PostNoCopy);
}

public 
void Event_RoundFreezeEnd(Event event, const char[] namebool dontBroadcast)
{
    static 
char sMap[32], sName[64];
    
int entity = -1;
    
    
GetCurrentMap(sMapsizeof(sMap));
    
    if (
strcmp(sMap"l4d_hospital04_interior") == 0)
    {
        while (-
!= (entity FindEntityByClassname(entity"func_button")))
        {
            
GetEntPropString(entityProp_Data"m_iName"sNamesizeof(sName));
            if (
strcmp(sName"elevator_button") == 0)
            {
                
HookSingleEntityOutput(entity"OnPressed"OnButtonActiontrue);
                break;
            }
        }
    }
}

void OnButtonAction(const char[] outputint callerint activatorfloat delay)
{
    
// some code



axelnieves2012 04-26-2020 15:34

Re: [L4D1] Door-less elevator at No Mercy [APRIL/2020]
 
Quote:

Originally Posted by Dragokas (Post 2695535)
The code is very non-optimized.

I would suggest to hook "player_use" only when map is "l4d_hospital04_interior" instead of checking it constantly.
You can use OnMapStart forward to do that.

Anyway, "player_use" is also fire too often. It's inefficient to make the check everytime.
Instead you could just hook exactly that entity. If you decide to follow this way, some entities could not initialize yet at map start stage so "round_freeze_end" is preferrable.

PHP Code:

public void OnPluginStart()
{
    
HookEvent("round_freeze_end",         Event_RoundFreezeEnd,    EventHookMode_PostNoCopy);
}

public 
void Event_RoundFreezeEnd(Event event, const char[] namebool dontBroadcast)
{
    static 
char sMap[32], sName[64];
    
int entity = -1;
    
    
GetCurrentMap(sMapsizeof(sMap));
    
    if (
strcmp(sMap"l4d_hospital04_interior") == 0)
    {
        while (-
!= (entity FindEntityByClassname(entity"func_button")))
        {
            
GetEntPropString(entityProp_Data"m_iName"sNamesizeof(sName));
            if (
strcmp(sName"elevator_button") == 0)
            {
                
HookSingleEntityOutput(entity"OnPressed"OnButtonActiontrue);
                break;
            }
        }
    }
}

void OnButtonAction(const char[] outputint callerint activatorfloat delay)
{
    
// some code



Hello, your optimization is very helpful. I wrote this code like this only for testing. My plan for initial release was adding a timer on OnMapStart() and check once for mapname, but round_freeze_end is better, I completely forgot about that event.
I will consider this for first stable version.

axelnieves2012 04-26-2020 18:20

Re: [L4D] Door-less elevator at No Mercy [APRIL/2020]
 
Version 1.0 stable released!

axelnieves2012 05-04-2020 23:02

Re: [L4D] Door-less elevator at No Mercy [APRIL/2020]
 
1 Attachment(s)
Beta testing version released.
Source: Attachment 181204
Get plugin!


Beta Changelog:
- Removed: Explosion on door opening.
- Added: Now door will open manually.
- Added: Special infected inside elevator.
- Added a witch on ventilation duct.
- Added: Elevator break and fall down to floor (may be removed on next version).


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

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