AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Unlock Doors (https://forums.alliedmods.net/showthread.php?t=20350)

commonbullet 11-06-2005 21:46

Unlock Doors
 
1 Attachment(s)
Unlock Doors

This script unlocks every door that is opened by buttons, so they will automatically open. This is particularly useful when playing with bots – many bots like the cz official bots (csbots) can’t open triggered doors.

It should work for every mod, but I only tested it in cs and I don’t know if it’s ever needed in other mods.

Cvars- amx_unlockatstart [0-1]
Set the script to unlock doors when map is loaded.

Commands
- amx_unlockdoors
Unlock triggered doors
- amx_defaultlock
Doors back to default

Modules Required:
Engine

About the script

The idea is very simple: to remove “targetname” property from func_doors and func_doors_rotating entities so they’ll open automatically. But that can’t be done very easily because there’s no way to remove targetname from an existing entity, and that’s not the same as setting targetname = “”.

The obvious solution is to duplicate the entity, copy only the desired properties and remove the old one. In order duplicate it, it's required to collect all entity properties. But entities pair values are tricky to be read, they have got to be hooked at spawn with that function,
Code:

public pfn_keyvalue(entid)
Not all doors that have a targetname should be replaced; sometimes func_doors are used to trigger a muilti-manager or other entity at spawn for example. So the plugin looks for buttons that are triggering a specific door targetname and if it finds one, the door will be respawned.

This plugin is not likely to be called more than once by users, so processing is not a big issue in here. Some global variables are inevitably allocated because of the hooking process; I did my best as so to use the minimum space.

I have tested it in cs_highsociety and cs_007bunker. It's working fine.

Log:
last version downloads: 668

Credits:
Hook function provided by
XxAvalanchexX

kILL-jOY 11-06-2005 21:47

downloading and testing this now

uTg | bigpapajiggs 11-06-2005 22:24

This sounds really useful. I would test it now, but unfortunately I am not on the correct computer and the other one is occupied. When I get a chance I will :). Good job.

commonbullet 11-07-2005 06:53

thanks,
I'll make it use even less memory - just realized that not all variables need to be hooked. I'll update it soon.

commonbullet 11-07-2005 17:22

ok,
It's been updated.

Lord_Destros 11-07-2005 23:18

lol interesting, this fixes bot problems on rats :D.

NedStar 11-08-2005 05:56

Any change of having an option that wil lock all doors ?

commonbullet 11-08-2005 06:37

I've set
amx_defaultlock
to restore default door settings. I can't guess all the situations that might faced in every different map, so I suppose it's nice to keep a way to revert it. Also it doesn't require much more resources from the plugin. :wink:

NedStar 11-08-2005 10:17

Yeah i know, i just got an map were some doors are open ( at map start )
Can be closed by using buttons but i would like them to be closed at map start. Thanks in advance.

commonbullet 11-08-2005 20:40

Quote:

Originally Posted by NedStar
Yeah i know, i just got an map were some doors are open ( at map start )
Can be closed by using buttons but i would like them to be closed at map start. Thanks in advance.

I may check it. What is the map?

...

hey EKS, thank you for approving this one.


All times are GMT -4. The time now is 17:51.

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