PDA

View Full Version : Store information in map entity


Robadob
01-31-2012, 00:30
Hi i was wondering if anyone had a guide on how i could store information in an entity in the map (at compile time) such as the worldspawn entity or gamerules and then read the value in a plugin. I've trawled google without success.

the values only need to be like
plugin_supported = 1
&
arena_count = 3

I've tried using GetEntProp and GameRules_GetProp but i keep getting errors like;
Native "GetEntProp" reported: Property "arena_count" not found (entity 113/tf_gamerules)
Which leads me to assume that i'm missing something or that it's not possible.

If it is infact not possible, what would be the easiest way to go about creating a custom entity for storing these 2 values?

Thanks

berni
01-31-2012, 11:15
I'm not quite sure what you are trying to do.
You can't do anything at compile time, do you mean at run time ?
Maybe you give some hints on what you are trying to achieve.

Robadob
01-31-2012, 13:44
In simple terms i want to store 2 'keys' or markers in a map.

Then when the map is loaded, the plugin can check whether the map has the keys and supports the function of the plugin.

berni
01-31-2012, 13:48
That sounds like you want to read in per map config files.
See: KeyValues (SourceMod Scripting) (http://wiki.alliedmods.net/KeyValues_(SourceMod_Scripting))
Loading from database would also be an option.

Robadob
01-31-2012, 13:50
Ideally it would be something internal to the map, so you could just load a map with the plugin running on the server without needing to create a config or database entries.

Robadob
01-31-2012, 14:04
Someone has just suggested it might be possible for a map to call a console command, this would also work if it's possible.
Edit:
Yeah i think i've found how to trigger console commands on map spawn, i'll come back if that fails.

berni
01-31-2012, 14:18
now I get what you mean.

yes you could create a point_servercommand entity, and execute a command in your plugin on mapstart.
you could also move a config file into the .bsp of the map, and read it from the plugin.
but it's not possible to modify the .bsp map with the plugin.

Robadob
01-31-2012, 14:45
Yeah map calling server command works, sorry that i wasn't too clear about the explanation.
Thanks