2013-02-12

Defibs

Since there is no rescue closet for survivors in Realism mode it can be annoying when you die early in a map.

Very often there is no defib available and you may have to watch the until the map is finished or restarted.

Some time ago I tested an "item spawning" plugin but it seems that it caused some problems (download things from server to client or so).
And it was far to powerful (to big etc) for the intended purpose.

So yesterday I did some digging again and found a nice small plugin which could help achieving my desired goal.
The plugin converts all the Medikits to Pills at the map start in Versus game mode only.
Well not exactly what I wanted so I had a look at the source code.

First I changed the game mode detection from "versus" to "realism" in plugin start.
But this did not help.
Why?
I saw an error message in the SourceMod log file:

[SM] Native "CreateEntityByName" reported: Cannot create new entity when no map is running

Hm?
It seems that the plugin was acting to early.
It hooked to "round_start".
So I searched for some "later" event here.
I came up with "OnMapStart"

Now it seems to work fine.
All Medikits were replaced by Pills at map start.

Ok. But I want to have a Defib instead of replacing Medikits with Pills.
Some some more changes are needed.
I exchanged "weapon_pain_pills_spawn" with "weapon_defibrillator_spawn"

One step closer^^
Now all Medikits were replaced by Defibs.

So the last step now.
Let the plugin exchange only one Medikit with a Defib so that the survivors will get 3 Mefikits and 1 Defib at each map start.
So I just break the loop in the plugin after one replacement.

Nice.
Seems to work.
So after some testing I may install the plugin on all Realism servers.

And remember then:
Always take a defib with you.

Tell me what you think about this modification.

Update:
Early beta version of the plugin is installed on alServ2019 now (connect 85.214.222.39:27019)

Update 2:
I did a proper coding now and have installed the plugin on all Realism servers (but not on the Survival server)

No comments:

Post a Comment