• Register

Very dumb Arctic fox. Giving out free and open-source hugs. Also a GoldSRC modder, and a gamedev. (idTech 3, 4, Godot, Unigine)

  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
Report RSS The leap of (coding) faith [Half-Life] (view original)
The leap of (coding) faith [Half-Life]
embed
share
view previous next
Share Image
Share on Facebook Post Email a friend
Embed Image
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account:

Description

That bastard of an entity is finally done. At least the hardest part of it.

Here's what I am trying to do:

You have an entity called trigger_valueop. It essentially modifies a keyvalue of another entity.

In order to even read the keyvalues, however, I had to write a function in the CBaseEntity class (i.e. the mother of all entities in Half-Life). 384 lines.

It would take a string, and compare it to 95 keyvalue names (target, targetname, netname, classname, globalname, origin, health, velocity, angles etc. etc.).

If it finds a match, then it'll read the value of that keyvalue (e.g. health).
That is the simplified version. I also added a function for custom keyvalues, but that's a bit far-fetched to explain.

And then there's the entity itself, which utilises the newly-written function. Around 120 lines. Of course, other entities can also use this function, albeit I don't see that much of a use there.

Either way, the way things are now, it only reads the keyvalue and prints info to the console. The next step will be to enable writing of the keyvalues. And that won't be a problem now. :)