Thread: Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

Results 1 to 6 of 6
  1. #1
    Registered User CubeMath's Avatar
    Join Date
    Dec 2016
    Posts
    20

    Lightbulb Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

    There are multiple ways to set one or multiple Keyvalue of an Entity like
    Code:
    g_EntityFuncs.DispatchKeyValue(pEntity.edict(), "health", 50);
    or
    Code:
    pEntity.KeyValue("health", "50");
    It is even possible to create an Entity with a List of Keyvalues (dictionary).
    Code:
    g_EntityFuncs.CreateEntity("func_breakable", keyvalues, true);
    Now I would like to have a Getter-Function for the Keyvalues.
    Example: GetKeyValue("iMagnitude");

    Or even an entire list of Keyvalues.
    Example: GetDictionary(Entity);


  2. #2
    begadang jangan begadang =_= anggara_nothing's Avatar
    Join Date
    Jan 2016
    Location
    Indonesia
    Posts
    134

    Re: Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

    This?

    Quote Originally Posted by https://baso88.github.io/SC_AngelScript/docs/CEntityFuncs.htm
    KeyValueBuffer@ GetInfoKeyBuffer(edict_t@ pEdict)
    KeyValueBuffer@ GetPhysicsKeyBuffer(edict_t@ pEdict)

    Quote Originally Posted by Sniper
    Quote Originally Posted by FreeKill
    Quote Originally Posted by Sniper
    It's actually a HLDM feature. It has nothing to do with Half-Life single player - which is what we're trying to focus on.
    We'll look into adjusting the gameplay mechanics for the weapon as time progresses.
    By that logic, you should remove the M16 and the scope off the MP5. And the Uzis.
    Heh

  3. #3
    Registered User CubeMath's Avatar
    Join Date
    Dec 2016
    Posts
    20

    Re: Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

    I have tried out both functions on an env_explosion.
    Code:
    g_EngineFuncs.GetInfoKeyBuffer(pEntity.edict()).GetValue("iMagnitude");
    g_EngineFuncs.GetPhysicsKeyBuffer(pEntity.edict()).GetValue("iMagnitude");
    Both functions returned an empty String.
    This is not what I wanted.

    GetPhysicsKeyBuffer printed this into the Console:
    Code:
    tried to PF_GetPhysicsKeyValue a non-client
    Is it possible to double the magnitude on each exposion on the map?
    Is it possible to get and mutiply the Juice on a Health-Charger / HEV-Charger?

  4. #4
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,534

    Re: Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

    I don't think that data is preserved after the entity spawns. Special keyvalues like that are usually stored in private variables specific to that type of entity.

    I think we either need to have every entity class type exposed (e.g. CEnvExplosion), which is lots of work, or we could simply get read access to the maps/ folder so we can parse the entity data in the BSP.
    Love,
    w00tguy

  5. #5
    Still learning wolf-3d's Avatar  
    Tester
    Join Date
    Jan 2011
    Location
    Somewhere Warm.
    Posts
    1,413

    Re: Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

    I don't think that data is preserved after the entity spawns. ...
    My experience / understanding as well, but it might be possible to capture and store the data in AS itself tho. (Haven't tried in AS myself, although can trigger_create_entity in map and store off "initial values" at this point with trigger copy value).

    ... parse the entity data in the BSP.
    Will have to work out the "server security implications" although can't see to many problems with "read only" access. (BSP files could have been Ripent'd)
    Regards
    Wolf-3D

  6. #6
    Still learning wolf-3d's Avatar  
    Tester
    Join Date
    Jan 2011
    Location
    Somewhere Warm.
    Posts
    1,413

    Re: Feature-Request: Get a Keyvalue or an entire list of Keyvalues from an Entity

    Is it possible to double the magnitude on each exposion on the map?
    Is it possible to get and mutiply the Juice on a Health-Charger / HEV-Charger?
    Missed these Q's / Dangers of skim reading

    Depends on the circumstances, (AFAIK env_explosion & "it's code" is used for exploding "Breakables", and in base class Monster (i.e. exploding turrets, gargs, etc. for More info. see Github Half Life)
    However if you have a "Morter gun" or "mine-field" and want each explosion to be greater than the last one. Then the answer should be Yes.
    Either via Entities or AS.
    Place "mine brush triggers" in map link/point to trigger_create_entity or AS Create your env_explosions. (stored Init iMagnitude on map load, Check last iMagnitude then +/* and copy into template, create entity, store off last iMagnitude value).
    I did something similar once. The only thing then you really needed to be sure of was, you Do Not end up pointing to something not yet created. (i.e. Wrong timing or Lag etc. or if players can hit a trigger out of sequence, then a trigger will fire before the env_explosion.entity is created and initialized properly in map. Which will cause a null pointer error/crash.) With AS you should probably loop & check "un-fired" triggers before creating the env_explosion, with "Map entities" you must ensure sequential player triggering.] A Morter Gun should be self explanatory.
    Health-Charger / HEV-Charger, - Pretty sure trigger_change_value allows you to change these on-the-fly during Gameplay, so should be similar in AS.
    "Rule of thumb" If an entity has a Entity.TargetName (or similar in .fgd), then most of this entities PEV's are accessible. (Player Medkit's might be "get'able" via the EH_Player? IDK/never tried).
    Regards
    Wolf-3D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •