How to recache spawn points?
In my FFA plugin I created a set of virtual spawn points, I mean they do not have an entity assigned to. In player spawn event I teleport the player to random virtual spawn point. It works but I am curious if it can be done using real spawn points.
My plugin is hot swappable and therefore default entities should be replaced with FFA ones, with the ability to revert these changes multiple times. I can easily remove default spawn points, but I cannot add new ones. I did several tests and I found out that such entities should be created in early timing only, like in plugin_precache. It looks like there is some caching mechanism to create a tree of entities, with "info_player_deathmatch" and "info_player_start" classes, to store their indexes. But if I have to remove entities, they will no longer work once I restore them back. Is there a function I can call to "cache" those entities like the engine does after plugin_precache? Or is there only teleport option? Maybe I can somehow disable spawn entities by assigning a player to it so that engine would not consider it for spawn? |
Re: How to recache spawn points?
The engine doesn't "cache" entities (I don't think it actually caches anything) but the client does cache files (models, sounds, etc.). Even if you were able to enable and disable spawn points, are you sure that they would even be random? In the game I play, Day of Defeat, they are definitely not random so certain spawn points would only get used if all of the others are already taken (have a player that spawned but hasn't moved yet).
|
Re: How to recache spawn points?
Quote:
PHP Code:
Quote:
|
Re: How to recache spawn points?
Ah, so I guess I was thinking of caching in the context of files. When I save pointers or other references in a variable, I don't think of it, instinctually, as "caching" (even though it can be described that way).
In Day of Defeat, we have properties of our spawn point entities that enable or disable them depending on an assigned control point master. Not sure if Counter-Strike 1.6 has something like that. |
Re: How to recache spawn points?
You can both remove and add player spawns at any time (not only in plugin_precache), and they will work correctly.
When a player respawns, the game goes through all the info_player_deathmatch entities. If there are no spawns at all, the player spawns at 0, 0, 0 (XYZ) coordinates. Important note: I'm talking about Half-Life, but I don't think they changed anything in this algorithm for CS. Ты можешь как удалять, так и добавлять спауны игроков в любой момент времени (не только в plugin_precache) и они будут работать корректно. При респауне игрока, игра проходится по всем info_player_deathmatch ентитям. Если спаунов нет вообще, то игрок появляется в 0, 0, 0 (XYZ) координатах. Важное замечение: говорю про Half-Life, но не думаю, что в CS поменяли что-то в этом алгоритме. |
Re: How to recache spawn points?
Quote:
|
Re: How to recache spawn points?
Quote:
|
Re: How to recache spawn points?
Is there any reason you need to disable a spawn point that you created? Could you maybe just put it near the normal spawn points so that it blends in with the map then when you move them dynamically, it'll be practically like they are new?
|
Re: How to recache spawn points?
Quote:
|
| All times are GMT -4. The time now is 00:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.