So this is my first post, and I’m attempting to create a gamemode similar to trikzsurf like how skyworld works in CSS. They use sourcemod to create triggers ingame and then based on which triggers the player has landed on and what order, it can tell the server they have completed a trick. I’m attempting to create something similar, but have been having problems even finding tutorials for proper implementation of entities. I know I can use Entity:SetTrigger to enable callbacks of trigger events when collided, my problem is actually creating an entity in the first place. Every tutorial I’ve been able to find is either almost a decade old or doesn’t explain what goes where, and when I try to implement pieces of code blindly, it just throwing errors.
I’m not asking for code to be spoonfed, but if anyone can at least steer me in the right direction or link me a proper tutorial, that would be appreciated. Thank you very much and hopefully after I learn more about LUA I can be a productive member of the forum and help others as well!
[editline]8th August 2017[/editline]
My gamemode file structure only consists of “gamemodename” inside the gamemodes folder and gamemodename.txt with everything it needs in that main folder, and cl_init.lua, init.lua, and shared.lua are in the gamemode folder inside my gamemode. Not much code is written for it right now other than setting up a really basic checkpoints system, and setting console vars to make the gameplay the way it should be. Here’s my init.lua file for it:
Is no one able to help me? I really just want some sort of tutorial or anything helpful, like I said I’m not asking to be spoonfed I just need to be pointed in the right direction is all. Any help would be appreciated. Thank you
Sorta both, I want to dynamically create multiple triggers around the map in arbitrary places through lua (hardcoded) and log any events where the players collide with it, and using that I need to somehow check the order that the player has touched the triggers and match it against a predefined “list” of tricks. If it matches, alert the player that they completed a trick.
It’s properly indented in my text editor, it just must have pasted wrong my bad.
I’ve considered creating the triggers in the maps designed specifically for the gamemode, but I also wanted the ability to add triggers to maps that already exist and weren’t meant for it, like construct for example. And I guess you could argue that I could just use a bsp decompiler and add them in, but that would mean it’d be an entirely new map and not only would people have to redownload the map, if they ever played it in a gamemode that wasn’t mine it’d just look exactly like a construct clone with no differences.
You can code an entity of brush type with SetTrigger enabled and create the entities in your hardcoded positions in an InitPostEntity hook. In your entity’s Touch method is where you can do whatever you want with the player.
Generally you can’t use ents.Create for brushes is because you can’t define their models, but for triggers you don’t really need an actual model. In fact, I’ve made a brush trigger entity just yesterday, and using SetCollisionBounds on it indeed works fine. Though I also had to do SetSolid(SOLID_BBOX) on it.
I’m not too worried about rendering the trigger, I could just draw a 3d box with the same coords if needed, so long as the trigger is placed where I’m trying to place it.
Second question, is there any way to get the face or vertex of the actual map closest to the players position or that the player is touching? Don’t know the full extent of lua or if it’s possible, but it would help a ton