Raised This Month: $51 Target: $400
 12% 

Get Entity Key Value?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spirrwell
Member
Join Date: Jul 2013
Old 11-08-2014 , 17:39   Get Entity Key Value?
Reply With Quote #1

Hi there! I've looked this up and all I've seen is about getting entity properties, not an entity key value directly. I know you can instill key values with DispatchKeyValue(), but there is no way to actually get a key value.

Basically I've been learning about creating my own custom gamemode and I wanted to do it in a "proper" kind of way. By editing and creating an FGD file for Hammer to create an entity. One of the key values I added was:

FlagCaptureLimit(integer) : "Capture Limit" : 10 : "Captures needed to win."

It shows up perfectly fine in Hammer. So, how would I go about getting the "FlagCaptureLimit" value from SourcePawn? Is it just not possible?
Spirrwell is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-08-2014 , 19:51   Re: Get Entity Key Value?
Reply With Quote #2

Values you dispatch with DispatchKeyValues correspond to DataMap values.

Look it up in an sm_datamap_dump.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 11-08-2014 at 19:51.
Powerlord is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 11-08-2014 , 21:04   Re: Get Entity Key Value?
Reply With Quote #3

He means:
sm_dump_datamaps <file>

:>
bl4nk is offline
Spirrwell
Member
Join Date: Jul 2013
Old 11-08-2014 , 21:14   Re: Get Entity Key Value?
Reply With Quote #4

Quote:
Originally Posted by bl4nk View Post
He means:
sm_dump_datamaps <file>

:>
Thanks, that worked, but what exactly am I looking for in this file? I don't understand. It's not like I edited the source code to the mod or anything, I just modified the FGD file. How does this work then?
Spirrwell is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 11-08-2014 , 22:09   Re: Get Entity Key Value?
Reply With Quote #5

Fgd values are usually on the right, you would see like m_iHealth Health, or m_Hdamage Damage, or whatever. Those you could dispatch keyvalues as since you have their names. Else use the setent natives.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Spirrwell
Member
Join Date: Jul 2013
Old 11-08-2014 , 22:59   Re: Get Entity Key Value?
Reply With Quote #6

I'm sorry, but maybe I made it a bit confusing by mentioning DispatchKeyValue(), but I'm NOT trying to set a key value.

Besides, FlagCaptureLimit in the FGD file I edited does not exist in the game's code, period. It's ONLY in the FGD file. So I'm not understanding all of this dumping stuff. I just want to get the key value, not set, get.

I created a test map with the entities I created\modified in the FGD files of this particular game. All I want is something that looks like this (pseudo-code):

Code:
new iFlagCaptures
new iEnt;
iEnt = FindEntityByClassName(iEnt, "info_pvk");
iFlagCaptures = GetKeyValue(iEnt, "FlagCaptureLimit");
Is there any way to get a key value directly?
Spirrwell is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-09-2014 , 02:54   Re: Get Entity Key Value?
Reply With Quote #7

Quote:
Originally Posted by Spirrwell View Post
I'm sorry, but maybe I made it a bit confusing by mentioning DispatchKeyValue(), but I'm NOT trying to set a key value.

Besides, FlagCaptureLimit in the FGD file I edited does not exist in the game's code, period. It's ONLY in the FGD file. So I'm not understanding all of this dumping stuff. I just want to get the key value, not set, get.

I created a test map with the entities I created\modified in the FGD files of this particular game. All I want is something that looks like this (pseudo-code):

Code:
new iFlagCaptures
new iEnt;
iEnt = FindEntityByClassName(iEnt, "info_pvk");
iFlagCaptures = GetKeyValue(iEnt, "FlagCaptureLimit");
Is there any way to get a key value directly?
I'm surprised that even works. Datamaps, Netprops, and KeyValues represent server-side variables compiled into the server binary (server.dll, server.so / server_srv.so, or server.dylib).

Just adding new properties to them in the map editor isn't going to magically pop those properties into being on the server side... the server is likely just going to toss them out (assuming it doesn't outright crash when the map is loaded).
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 11-09-2014 , 11:20   Re: Get Entity Key Value?
Reply With Quote #8

You can add as many keyvalues to an entity as you like, they eill just do nothing.
Probably you could make an extension to read them or something...
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Spirrwell
Member
Join Date: Jul 2013
Old 11-09-2014 , 12:15   Re: Get Entity Key Value?
Reply With Quote #9

Oh cool, I've been looking for an excuse to try out extension programming. I find C++ much more understandable anyhow. However it does seem that trying to create NEW entities is futile. It looks like they really do get thrown out by the server. But anything I simply add key values to seems to work just fine there's just nothing to read it.

Thank you though, if I have to I'll use info_targets, and used a voting system to vote on the capture limit and whatnot, but I'll see what I can learn.

Thanks again! If I do happen to make any progress at all I'll post it here.
Spirrwell is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-09-2014 , 12:44   Re: Get Entity Key Value?
Reply With Quote #10

What game is this for, anyway?

I know in TF2, there's a server cvar that sets the number of caps in a round.

I was going to say that there must be a way to override the cap limit in TF2 as well because sd_doomsday requires just one, but it occurred to me (having not looked at a decompile of it) that they may just use a game_round_win entity to do that.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply



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 05:21.


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