AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_pev vs set_kvd (https://forums.alliedmods.net/showthread.php?t=54127)

Vet 04-17-2007 16:32

set_pev vs set_kvd
 
Would someone explain to me, in detail, the difference between these 2?

Ryu2877 04-18-2007 03:30

Re: set_pev vs set_kvd
 
that's huge content......furthermore, by my level & English, it's impossible......

but a simple & ex part explanation is:

"set_kvd" use to change|set "spawnning(not already)" entity's key value data, general use in "hook" | "create some constant entity"......

VEN 04-18-2007 04:55

Re: set_pev vs set_kvd
 
set_kvd is mainly used to store values of KeyValueData (KVD) structure members.
In general to the first parameter should be passed global handle (0).
There are four KVD members:
  • ClassName - used to store entity classname (type: string)
  • KeyName - used to store name of key (type: string)
  • Value - used to store value of key (type: string)
  • fHandled - [see below] (type: integer)
Once KVD member values is stored they needs to be "fired" to the game dll with KeyValue (DLLFunc_KeyValue).
Right after firing it's possible to check whether given KVD was understood by game dll by checking fHandled value.
KVD is applied to entity on its Spawn so KVD should be fired only for entities that isn't spawned yet (DLLFunc_Spawn).
fm_set_kvd() is a function from Fakemeta Utilities that can be used to fire KVD easily.

set_pev is used to change values of several entity variables (entvars_t structure members).

Ryu2877 04-18-2007 05:25

Re: set_pev vs set_kvd
 
Quote:

Originally Posted by VEN (Post 466666)
set_kvd is mainly used to store values of KeyValueData (KVD) structure members.
In general to the first parameter should be passed global handle (0).
There are four KVD members:
  • ClassName - used to store entity classname (type: string)
  • KeyName - used to store name of key (type: string)
  • Value - used to store value of key (type: string)
  • fHandled - [see below] (type: integer)
Once KVD member values is stored they needs to be "fired" to the game dll with KeyValue (DLLFunc_KeyValue).
Right after firing it's possible to check whether given KVD was understood by game dll by checking fHandled value.
KVD is applied to entity on its Spawn so KVD should be fired only for entities that isn't spawned yet (DLLFunc_Spawn).
fm_set_kvd() is a function from Fakemeta Utilities that can be used to fire KVD easily.

set_pev is used to change values of several entity variables (entvars_t structure members).

receive, thanks!

Vet 04-18-2007 13:27

Re: set_pev vs set_kvd
 
So do I have this right...

I would use set_kvd to setup my entity parameters in advance and then put the whole thing in the game at once with a dispatchspawn or something?

And I would use set_pev to change an existing entity's parameters and the changes will automatically be applied to the entity on the next frame/think?

VEN 04-18-2007 15:27

Re: set_pev vs set_kvd
 
Quote:

Once KVD member values is stored they needs to be "fired" to the game dll with KeyValue (DLLFunc_KeyValue).
When you fired all necessary KVDs you can use
Quote:

dispatchspawn or something
to physically apply it to your entity.

Quote:

And I would use set_pev to change an existing entity's parameters and the changes will automatically be applied to the entity on the next frame/think?
Immediately.

Orangutanz 04-18-2007 17:22

Re: set_pev vs set_kvd
 
set_kvd can setup more advanced properties on entities which set_pev doesn't have access too.

Example of this would be creating a breakable entity, you can set the breakable model (glass, wood, metal etc) with set_kvd.

To find out values which are usable with different types of entities you need to look into the mod's fgd file.

Vet 04-18-2007 22:38

Re: set_pev vs set_kvd
 
Got it, I think. I've always used the fm_set_kvd / fm_DispatchSpawn pair to create my entities. But then noticed that many others used set_pev to do it. So I thought maybe I was missing something.

The one part that threw me was the 'firing' of the kvd. But now that I look at the include, I've always used 'fm_set_kvd' which does the 'firing' for me.

Thanx !


All times are GMT -4. The time now is 20:54.

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