Raised This Month: $ Target: $400
 0% 

Entity Keys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
More
Member
Join Date: Nov 2004
Location: Internet
Old 03-23-2005 , 14:37   Entity Keys
Reply With Quote #1

Hi, I have a question, possible you can help me:
some entities, in my case the entity info_tfgoal in a tfc map,
have some entity-keys that seem to be not include by the engine-module,
like maxammo_shells or team1_name.
Is there a way to create an entity with these values??
in the map editor "hammer" there you can create an entity with these values so they must exist.
any ideas?
More is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-23-2005 , 14:46  
Reply With Quote #2

I think you should use this:

Code:
/* 2 formats.    Format: DispatchKeyValue("KeyName","Value") - sets keyvalues for the entity specified in the keyvalue() forward.    Format: DispatchKeyValue(index,"KeyName","Value") - Sets keyvalue for entity not specified in keyvalue() forward. */ native DispatchKeyValue(...);

Then spawn the entity.
Johnny got his gun is offline
More
Member
Join Date: Nov 2004
Location: Internet
Old 03-23-2005 , 14:52  
Reply With Quote #3

thx very much
More is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-23-2005 , 15:11  
Reply With Quote #4

Make certain you use DispatchSpawn(ent) to spawn the entity, after setting keys on it.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
More
Member
Join Date: Nov 2004
Location: Internet
Old 03-23-2005 , 15:16  
Reply With Quote #5

when retrieving entity information i always get an empty string. whats wrong with this code?
Code:
#include <amxmodx> #include <engine> #include <amxmisc> public plugin_init() {   register_plugin("Map Imformation", "0.1", "More")   register_clcmd("amx_mapinfo", "admin_mapinfo", ADMIN_CVAR) } public admin_mapinfo(id, level, cid) {   if (!cmd_access(id, level, cid, 1)) {     return PLUGIN_HANDLED   }   new entity = find_ent_by_class(-1, "info_tfdetect")   if (entity > 0) {     new info[32]     get_keyvalue(entity, "maxammo_shells", info, 31)     client_print(id, print_console, "The info is: ^"%s^"", info)   }   else {     client_print(id, print_console, "The entity info_tfdetect does not exist!")   }   return PLUGIN_HANDLED }

sry when i express me wrong.
my goal is to check the values on the entity info_tfgoal and change it when required.

another question: returns the command get_keyvalue always a string?
More is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-23-2005 , 16:12  
Reply With Quote #6

As soon as an entity is spawned, I don't think you should/can use keyvalues anymore. Those are only used in map files.
Johnny got his gun is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 03-23-2005 , 17:12  
Reply With Quote #7

Quote:
Originally Posted by BAILOPAN
hook keyvalue forwards and use copy_keyvalue. get_keyvalue is a useless native and does not work as you think it does ;]
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-23-2005 , 19:46  
Reply With Quote #8

Just realized that Fakemeta module never implemented the FM_KeyValue forward. So, a few hours later, here's a test build. Guess I will add it to CVS soon, you can try it out here though.

Quite cool, in fy_iceworld I was able to hook the setting of the onground weapons, and put 5 weapons on each place instead of just one.... using this script:

Code:
public forward_keyvalue(ent) {     //new classname[64],     //get_kv(KV_ClassName, classname, 63)     new keyname[64], value[64]     get_kv(KV_KeyName, keyname, 63)     get_kv(KV_Value, value, 63)     //new ret = get_kv(KV_fHandled)     //server_print("KeyValue(%d, ^"%s^", ^"%s^", ^"%s^", %d)", ent, classname, keyname, value, ret)     if (equal(keyname, "count") && equal(value, "1"))         set_kv(KV_Value, "5")     return FMRES_IGNORED } public plugin_precache() {     register_forward(FM_KeyValue, "forward_keyvalue") }


See if you can make something other cool out of it... maybe replace all weapons of a certain type with another. I think you should be able to replace all awps to scouts, etc....

Edit: Here's how to switch onground awps to scouts... as expected:
Code:
if (equal(classname, "armoury_entity") && equal(keyname, "item") && equal(value, "10"))     set_kv(KV_Value, "8")

Not very surprisingly, these values follow the mod's FGD file.
Attached Files
File Type: rar fakemeta_amxx.rar (91.4 KB, 137 views)
Johnny got his gun is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-23-2005 , 20:24  
Reply With Quote #9

So wait, you guys forgot the key values in FM?
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-23-2005 , 20:51  
Reply With Quote #10

Not _forgot_. It was just a large project and 98% of it was done anyway. At the time it was "enough", and everyone (at least those who worked on it, primarily sawce) got fed up with all the repetitive tasks...
There might still be a few things still not taken care of in there...
Johnny got his gun 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 09:51.


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