Raised This Month: $32 Target: $400
 8% 

L4d1 lock saferoom door, announce tank spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 02-22-2020 , 06:02   L4d1 lock saferoom door, announce tank spawn
Reply With Quote #1

Hi there,

I'm trying to set up a script that locks the saferoom door on start and unlocks it when the tank is dead.
On multiple tanks after each other it is always closed again then opened after death of tank.

I included a condition to disable it on final maps of the standard map set of l4d1.

Since I have a tank on every map, it works on my server for my needs.

It is based on:
[L4D / L4D2] Lockdown System | 1.7 [Final] : Jan. 30, 2019 |
https://forums.alliedmods.net/showthread.php?t=281305

since it got - what seems - to be all the stuff that I needed.

So I took some functions and made the script (see attachment)

On round start it blocks the door and on tank death it opens the door.

For example it is working on: l4d_vs_airport01_greenhouse, l4d_vs_airport02_offices l4d_river01_docks etc

For some reasons that I just don't understand, it refuses to close the door on l4d_vs_airport04_terminal and l4d_river02_barge.

Looking at the log, there was nothing when I tried it on l4d_vs_airport01_greenhouse.

But on l4d_vs_airport04_terminal it gives errors like this:

L 02/22/2020 - 093:22: [SM] Call stack trace:
L 02/22/2020 - 093:22: [SM] [0] SetEntProp
L 02/22/2020 - 093:22: [SM] [1] Line 102, l4d_tank_announce_lock_door.sp::ControlDoor
L 02/22/2020 - 093:22: [SM] [2] Line 57, l4d_tank_announce_lock_door.sp::OnTankSpawn
L 02/22/2020 - 096:41: [SM] Exception reported: Property "m_hasUnlockSequence" not found (entity 451/func_door)
L 02/22/2020 - 096:41: [SM] Blaming: l4d_tank_announce_lock_door.smx

(I included an if statement to surpress this entries, to see if at least the tank announce happens.)

When enabling the color change it gives

[SM] Exception reported: Property "m_nRenderMode" not found (entity 66/keyframe_rope)
which I too not understand.

Only in this map, no error on l4d_vs_airport01_greenhouse whatsoever.

I suspect the door on l4d_vs_airport04_terminal and l4d_river02_barge to be different but I don't understand what is causing it.
And I'm somewhat sure that I saw this door working on the original plugin.

Any ideas are highly appreciated.

Finishlast
Attached Files
File Type: sp Get Plugin or Get Source (l4d_tank_announce_lock_door_v1.0.7.sp - 149 views - 5.0 KB)
__________________

Last edited by finishlast; 03-28-2020 at 10:02.
finishlast is offline
Aya Supay
Member
Join Date: Nov 2015
Old 02-23-2020 , 11:14   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #2

Quote:
Originally Posted by finishlast View Post
Hi there,

I'm trying to set up a script that locks the saferoom door on start and unlocks it when the tank is dead.
On multiple tanks after each other it is always closed again then opened after death of tank.

I included a condition to disable it on final maps of the standard map set of l4d1.

Since I have a tank on every map, it works on my server for my needs.

It is based on:
[L4D / L4D2] Lockdown System | 1.7 [Final] : Jan. 30, 2019 |
https://forums.alliedmods.net/showthread.php?t=281305

since it got - what seems - to be all the stuff that I needed.

So I took some functions and made the script (see attachment)

On round start it blocks the door and on tank death it opens the door.

For example it is working on: l4d_vs_airport01_greenhouse, l4d_vs_airport02_offices l4d_river01_docks etc

For some reasons that I just don't understand, it refuses to close the door on l4d_vs_airport04_terminal and l4d_river02_barge.

Looking at the log, there was nothing when I tried it on l4d_vs_airport01_greenhouse.

But on l4d_vs_airport04_terminal it gives errors like this:

L 02/22/2020 - 093:22: [SM] Call stack trace:
L 02/22/2020 - 093:22: [SM] [0] SetEntProp
L 02/22/2020 - 093:22: [SM] [1] Line 102, l4d_tank_announce_lock_door.sp::ControlDoor
L 02/22/2020 - 093:22: [SM] [2] Line 57, l4d_tank_announce_lock_door.sp::OnTankSpawn
L 02/22/2020 - 096:41: [SM] Exception reported: Property "m_hasUnlockSequence" not found (entity 451/func_door)
L 02/22/2020 - 096:41: [SM] Blaming: l4d_tank_announce_lock_door.smx

(I included an if statement to surpress this entries, to see if at least the tank announce happens.)

When enabling the color change it gives

[SM] Exception reported: Property "m_nRenderMode" not found (entity 66/keyframe_rope)
which I too not understand.

Only in this map, no error on l4d_vs_airport01_greenhouse whatsoever.

I suspect the door on l4d_vs_airport04_terminal and l4d_river02_barge to be different but I don't understand what is causing it.
And I'm somewhat sure that I saw this door working on the original plugin.

Any ideas are highly appreciated.

Finishlast
try this I only tried a whole day there were no mistakes
Attached Files
File Type: sp Get Plugin or Get Source (l4d_tank_announce_lock_door.sp - 88 views - 4.8 KB)
Aya Supay is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 02-23-2020 , 13:36   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #3

Thanks a lot, that looks quite good codewise.

Can't compile it though bc my colors.inc seems to be outdated.

left4dead/addons/sourcemod/scripting/include/colors.inc(203) : error 147: new-style declarations are required

Can you provide a link to a compatible color.inc file? 1.0.5 seems to be too old.
__________________
finishlast is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 02-23-2020 , 13:45   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #4

I compiled it with new newdecls off.

It still does not shut the door for me on l4d_vs_airport04_terminal.

Does it work for you? I disabled my stripper cfg for that map (just in case) but the door is still open.
__________________
finishlast is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 02-23-2020 , 14:22   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #5

Try using this check instead, it should work on all ending checkpoint doors...

Code:
void InitDoor()
{
	int target = -1;
	while((target = FindEntityByClassname(target, "prop_door_rotating_checkpoint")) > -1)
	{
		if(IsValidEntity(target))
		{
			char sModel[64];
			GetEntPropString(target, Prop_Data, "m_ModelName", sModel, sizeof(sModel));

			if(StrContains(sModel, "checkpoint_door") > -1 && StrContains(sModel, "02") > -1)
			{
				ControlDoor(target, LOCK);
			}
		}
	}
}
MasterMind420 is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 02-23-2020 , 16:14   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #6

Hey,

thank you both, the new function solves the problem for the l4d_vs_airport04_terminal and l4d_river02_barge door!!!

I attached the new version that seems to work now.

It now only locks the door when tank spawns and unlocks it when he dies.

I still need to find a new-style declarations compatible color.inc file though. Or leave it out.


Guess if it checks for 5 and 8 Zombie class, it would work for l4d1&l4d2 right?
Code:
		if( class == 5 || class == 8)
			return true;
Then maybe it would be good to make the "final map list" as a cfg file in data folder, don't know how to accomplish that though atm.

I'm going to release it under plugins after some more testing.

Thanks a lot guys!

Latest version is here: https://forums.alliedmods.net/showthread.php?t=321892
__________________

Last edited by finishlast; 03-28-2020 at 10:12.
finishlast is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 03-09-2020 , 13:36   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #7

Sorry for double post but another error accours now.

In the attached version I have the problem that the tank spawn event seems to fire multiple times.

1 Bot tank in stasis
2 Player becomes tank
3 Player looses Control

So in chat you will see at least 3 Messages_

[SM] A Tank spawned! The door is locked now!
stasis over Player takes Control
[SM] A Tank spawned! The door is locked now!
Player looses Control
[SM] A Tank spawned! The door is locked now!


It must be that every Change of tank fires the

HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);


I changed player_spawn to tank_spawn but this didn't change the fact that on stasis to Player or Player to loose Control, the tank gets announced again.

Any ideas how to prevent the announce on stasis to Player and Player to loose control? I wasn't able to test but I suspect it would announce the tank again, if another player gets the tank.

The expected behavior is:

Tank spawn, tankcount +1
Tank dead, tankcount -1 -> open door

If you have more than 1 tank at the same time, the counter goes up, when all are dead, it is 0 again and the door opens.

The behavior now:
Tank spawn tankcount+1 -> tank to Player tankcount +1 -> Player lost Control tankcount +1
so 3 tankcounts for 1 tank.

When the tank is dead the counter will be 2 and the door stays shut.


Thanks in advance!
Attached Files
File Type: sp Get Plugin or Get Source (l4d_tank_announce_lock_door_v1.0.5.sp - 125 views - 4.8 KB)
__________________

Last edited by finishlast; 03-09-2020 at 18:01.
finishlast is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 03-14-2020 , 12:45   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #8

Quote:
Originally Posted by finishlast View Post
Sorry for double post but another error accours now.

In the attached version I have the problem that the tank spawn event seems to fire multiple times.

1 Bot tank in stasis
2 Player becomes tank
3 Player looses Control

So in chat you will see at least 3 Messages_

[SM] A Tank spawned! The door is locked now!
stasis over Player takes Control
[SM] A Tank spawned! The door is locked now!
Player looses Control
[SM] A Tank spawned! The door is locked now!


It must be that every Change of tank fires the

HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);


I changed player_spawn to tank_spawn but this didn't change the fact that on stasis to Player or Player to loose Control, the tank gets announced again.

Any ideas how to prevent the announce on stasis to Player and Player to loose control? I wasn't able to test but I suspect it would announce the tank again, if another player gets the tank.

The expected behavior is:

Tank spawn, tankcount +1
Tank dead, tankcount -1 -> open door

If you have more than 1 tank at the same time, the counter goes up, when all are dead, it is 0 again and the door opens.

The behavior now:
Tank spawn tankcount+1 -> tank to Player tankcount +1 -> Player lost Control tankcount +1
so 3 tankcounts for 1 tank.

When the tank is dead the counter will be 2 and the door stays shut.


Thanks in advance!
How about instead of using the Tank Spawn event and plusing and minusing them accordingly...why not just globally check the tank count...and when its 0 allow the door to open? I use sdkhook player use on the doors to check if players try to open it and if they do while a tank is present it blocks them. you can also do the tank check within the sdkhook use function so it's not constantly checking. PS you don't even have to lock the saferoom doors using this method, you can stop players opening them to begin with....Using sdkhook use on the doors themselves gives you greater control of the situation ;)

Last edited by MasterMind420; 03-14-2020 at 12:49.
MasterMind420 is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 03-14-2020 , 19:45   Re: L4d1 lock saferoom door, announce tank spawn
Reply With Quote #9

The open door after last tank died is now checked via tank count:

int Tankcount = 0;
for (int i = 1; i <= MaxClients; i++)
if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetEntProp(i, Prop_Send, "m_zombieClass") == 5) Tankcountnow++;
if(Tankcount==0){ open door ….

In the player_Death event.

****

On the Sacrifice final you have multiple tanks. I want to announce them too, but not on every change of the tank control.

So I thought it might be possible to track a tank somehow and then when already announced just skip the announcement.

Using the sdkhook on the door would prevent endless checks on player_death that's true but then again, I liked how the door is closed on tank spawn and then when you fight near the door and kill the tank how it magically swings open.


When I put this into the tank spawn Event:

int Tankcountnow = 0;
for (int i = 1; i <= MaxClients; i++)
if (IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetEntProp(i, Prop_Send, "m_zombieClass") == 5) Tankcountnow++;
PrintToChatAll("[sm] now %d", Tankcountnow);


Chat Output is:

[sm] now 1 //Tank spawn
[sm] now 1 //Player takes control
[sm] now 2 //Player looses Control

So the bot tank and myself are counted together.

Is there by any chance the possibility to find out, if this one tank is basically the same tank in all this "control changes" and only announce the first initial spawn?

I attached the latest Version with the debug chat messages.

You will see in chat the multible announcements… I tried all week but I'm running out of ideas.

All that is needed is to ONLY announce the innitial spawn of each "different" tank.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_tank_announce_lock_door_v1.0.6.sp - 202 views - 5.2 KB)
__________________

Last edited by finishlast; 03-23-2020 at 13:07.
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 01:46.


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