Is there any way to edit keyvalues of entities using the console ingame?

FoobyZeeky

Newbie
Joined
Apr 9, 2010
Messages
7
Reaction score
0
I know you can create various entities with the give command and use their inputs with ent_fire, but is there any way to set their keyvalues?

For example, I used give env_headcrabcanister to spawn a headcrab canister below me, and then I used ent_setname hcc and ent_fire hcc firecanister to fire it. But when I used the input spawnheadcrabs 5 afterwards, when the canister had impacted, nothing appeared; so I wonder if I had to set the HeadcrabType (I think that's what its called) keyvalue before. So, is it possible to set a keyvalue using the console? Any help would be greatly appreciated.

Edit: I checked VDC and the keyvalue is HeadcrabType and the options are 0 (normal headcrab), 1 (fast headcrab), and 2 (poison headcrab).
 
Yeah, I used the VDC to check on the keyvalue. It doesn't say anything about editing or setting them using the console though :/
 
you don't have to set headcrab type, it's classic headcrab by default. the problem is canister is already open when you spawn it, don't know why.
 
Yeah; actually, when I spawned it, it seemed to be invisible, but I launched it and when it impacted it became visible, but it was already open and no headcrabs appeared.

But if you know how to set the headcrab type using the console then that would be greatly appreciated because I could use the method to set keyvalues of other entities.
 
there's no input for headcrab type
 
I feel kind of awkward replying to a two-year-old thread, but I finally DID find out how to do this, and since my search for the same question lead me here (and nobody else seems to have answered it), I thought I'd post it, if for no other reason than to make the next person's search a little easier.

Anyway: you can use the addoutput action in ent_fire to set keyvalues as follows:

ent_fire <name of entity> addoutput "<name of keyvalue> <value you want to set it to>"

Don't type the <>, but DO type the spaces. So, for instance, to solve the problem above, you would want to use something like

ent_fire name_of_that_particular_canister addoutput "headcrabtype 2"

There is a way to do it with the ent_keyvalue command, but that requires the targetted entity to have a hammer id, which all console-spawned entities lack.
 
I think it would be much easier to actually mod the game files for the entry,and changing the value o that entry,than fiddiling around with the console :D
 
Back
Top