Talk:Authoring a Logical Entity
- 1 c stands for server ?
- 2 Testing the entity
- 3 What's with the C++ tutorial?
- 4 Forgetting something?
- 5 // memdbgon must be the last include file in a .cpp file!!!
- 6 Good tutorial!
- 7 Extra Things
- 8 Added a tutorial on using the logical entity in Hammer
- 9 CLogicalEntity
- 10 HL2:DM and Entities
- 11 Tried Tutorial twice! Grenade isn't igniting.
- 12 it does not work?
c stands for server ?
why prefixing server-side with stuff with the c letter ? i fail to see the subtility with the "c_" for "client side". why not "s" or "sr" ? Meithal 10:54, 2 Jun 2008 (PDT)
- It has been my understanding that C in the beginning of a class name means just that, "class". This as part of the Hungarian notation. But reading this made me wonder. For some reason it doesn't sound too unfamiliar however. Think I might have heard or seen this myself before. --Kodak 06:37, 30 January 2009 (UTC)
Testing the entity
So, maybe this is silly, but maybe this tutorial should also include instructions on testing this entity we just made on a map so that we know it actually did something. From what is here I have code that compiles but no idea if it actually did anything other than faith in the person who wrote the tutorial. How does one trigger the entity so it prints to the screen or console (or wherever it prints) when they put the entity into a map and run it? ent_fire? what? Zarbon9696
- You'd tie a map output to OnThreshold, and use either an input or ent_fire to prod it. You're right though, something needs to be added. --TomEdwards 03:03, 2 Jul 2008 (PDT)
Hi, I found a good tutorial that continues on this one and teaches you how to use your logical entity: Fabian Mejia: Valve's Source - Part 3 You'll work with the editor Hammer that you can find when opening Steam -> Tools -> Source SDK (where you also create your mod), and it's very easy to follow! Have fun!--------- Now, the question is how to do that by modding the source code itself?? --Kweiko 00:39, 15 Jun 2009
What's with the C++ tutorial?
This is a VDC article on how to mod in Source; why aren't we assuming that readers have a working knowledge of C++, and letting the unenlightened go to other, more in-depth websites actually intended to explain programming fundamentals? The extra stuff is making me have to sift through the article to find actual information. --TheRatcheteer 21:33, 7 Jul 2008 (PDT)
- It's the first in the "Your First Entity" series, geared towards beginners. I'd argue that there is some use for the information, seeing as some modders might be very new to programming and they're learning to code by hacking through the SDK (as misguided as that might be).. but I see your point too. --Campaignjunkie (talk) 23:41, 7 Jul 2008 (PDT)
- It comes down to the balance of requirements. There's little argument that the number of people already familiar with C++ trying to use this article isn't far smaller than the number who have never written a line of it before. (Plus if you already understand C++ you can just read the commented source code, surely?) --TomEdwards 02:07, 8 Jul 2008 (PDT)
// memdbgon must be the last include file in a .cpp file!!!
- This is to avoid memory leaks right? Idk i'm not a pro coder but seems fairly self explanatory :P
- --Jenkins08 11:07, 7 April 2009 (UTC)
- It enables a special memory allocator that is compatible with some sort of debugging tool. I'm not sure if modders have that tool or not - but either way, it's not necessary to do the #include. --TomEdwards 17:05, 17 August 2009 (UTC)
I did this tutorial yesterday, after fixing my code for VS 2008. It's pretty easy to follow, it worked after the first attempt. I tried to add some more functionality like in math_counter, but inputdata isn't being recognised by the compiler. Any idea why? Solokiller 12:54, 19 November 2009 (UTC)
- I figured out what caused this: the reference name had a capital D, which caused it to ignore inputdata with a lower case d. Solokiller 13:17, 19 November 2009 (UTC)
- You can use autocomplete (TomEdwards 18:41, 19 November 2009 (UTC) ) to avoid that in future. And thanks. :-) --
While this type of tutorial is very good (it certainly helped me in the general basics), I'm really struggling with the more Valve-specific and really very very basic stuff. With the creation code for a particle effect, for example:
DispatchParticleEffect( "BeanPickup_Red", ?, Vector(0,0,0), this );
I know that the first parameter is the name of the particle effect I want to create. I know that the second parameter is the origin of the particle effect but have no idea how to put this to any use, since it involves something to do with either a GetLocalOrigin or GetAbsOrigin function. All I know about these is that they return the origin in one format or another of an entity, but I don't know which one of the two to use or how to use it, since these then involve pointers and pointers involve something called "casting", and I need to have a pointer to the entity I'm in the code for where I'm trying to actually create this particle effect and have no idea how to do that either since it involves another utility function to return the entity to pass to the pointer, and there's nothing on this type of thing on the Wiki. I can only find code that does stuff with pointers relating to pOwner and that's no use to me from where I'm standing.
It's these small things that completely stop me from coding anything outside a tutorial. If we could have more beginner-targeted tutorials like this but for the useful little things then that would help me out a hell of a lot. --X6herbius 15:35, 26 April 2010 (UTC)
- This page can't cover everything. Check Accessing other entities to learn about pointers (it's on the main category page...) and GetAbsOrigin() for your other problem. --TomEdwards 14:46, 27 April 2010 (UTC)
Added a tutorial on using the logical entity in Hammer
An imageless, shorter re-telling of http://fabianmejia.blogspot.com/2008/06/valves-source-part-3.html with some differences. I'm just going through the tutorial myself and thought this would be relevant. --Kiwibonga 04:59, 27 July 2010 (UTC)
This tutorial is clearly broken. When i do the second step i get loads of errors about CLogicalEntity is not a class or stuctname
HL2:DM and Entities
I thought I would post this here because I was pulling out my hair. I created a multiplayer mod with the intent to modify hl2:dm. However, whatever code I was writing wasn't getting picked up. Forget Entities, I wasn't even able to set Console variables using ConVar!
This mistake I was using was I was using AppID 320 in my gameinfo.txt, apparently this led my mod to fallback to the hl2:dm dlls (wild speculation on my end). Whatever the reason, it just wasn't working, I couldn't write any code to affect the code base. The solution was to use AppID 215 (source 2006 base) and everything works so far!
Good luck all!
--Lazypenguin 12:59, 3 July 2012 (PDT)
Tried Tutorial twice! Grenade isn't igniting.
Hey guys, just tried to rebuild the tutorial twice. Added the cpp but divided into a .h and a .cpp. Compiled correctly, even checked with the given full source code. Seemed alright. When adding the entity into my map using Hammer everything can be added like the tutorials tells one to do. Created 3 Ammo-Packages and a grenade, and of course my entity. I put the Outputs of the Ammo to Tick "MyCounter" and set the Threshold on my counter to 3. The output of such is set to OnThreshold and Ignite "MyGrenade". I even tried with different entities. Tried ent_fire to start. Changed the limit threshold to 2 and picked up only two packages and even replaced the ammo packages with weapons (crossbow and shotgun) but nothing happens at all. I can pickup whatever I want it's not igniting. I actually double-double-checked the code but it seems pretty accurate. My system: Win 8 x64 VS 2012 (Mod is starting correctly from within this. DLL's are copied each time I recompile) Source Base 2007 (App-ID: 218) The Map is starting from within the Hammer-Editor as well, applying my changes. I can't see my mistake. Any help would be appreciated.
--Mvmnt-max 19:55, 25 March 2013 (PDT)
Edit: Figured it out myself: Before firstly imported into Visual Studio i copied some dll's from source base 1007 sdk to basically make the game run in the first place. wanted to try my map before. I forgot to delete those to get my self-created client.dll and server.dll into my bin-folder. Just erased those a few secs ago and rebuild my projects. The dll's have been copied correctly and the grenade is exploding as wanted!
So be sure to delete all self-copied dlls and let visual studio create those for you since those include all the self-written code.
it does not work?
it gives an error as soon as i declare the first class