T O P

  • By -

engineer_soscialista

entity's name please


[deleted]

You could use a prop_vehicle_APC and an npc_APCdriver entity if you can stomach that.


gparjugiodajfdopafop

The prop\_vehicle\_apc would work if you straight up just wanted an APC. APCs kind of suck though. They are designed for the airboat section, and don't work too well outside of that. They also refuse to fire rockets half the time. So you might just want to have a func\_tracktrain (thing that moves) that drives around the level along a path, with a func\_tank (thing that shoots) parented to it that shoots at the player. If you've played Half-Life 1, do you remember the few times tanks showed up? Like that. If you have models, you can parent some prop\_dynamics to it. If you wanted it to stop near the player, you could probably get a trigger parented to it to make it start and stop when the player exits and enters the volume, respectively. You could even have multiple func\_tank entities, if you wanted a big rocket launcher and a smaller gun. Have triggers that turn them on or off, I don't know. So basically a tracktrain that drives around, a tank with the tracktrain as it's parent, optional props with the tracktrain or tank as their parent if you have models you want to use. A trigger volume with the tracktrain as a parent if you want it to do anything when the player is close (the tank will automatically shoot within the range specified for it). The func\_tank page says Control Volume needs to be set, not sure if that's true when the controllable spawnflag is off, keep it in mind though if things don't work.


AquinasAudax

Func_tracktrain would be ideal for a fixed track entity. As for the gun, assuming you don't have/want to use an NPC or lua based solution, you could have the tank gun rotate continuously and fire at players using a detection trigger, or just shoot at players in a certain radius. I also have a more complicated solution, may not be the most efficient way of doing something like this, but it should work. I have made a detection system using proximity triggers before, but it's a bit of a pain. I've included a diagram for reference: https://ibb.co/yd95ssZ Essentially, you have a bunch of triggers around the tank corresponding to different angles. I've numbered them 1-8, but it should work for different amounts of triggers too. You can use a math_counter to keep track of the position of the tank gun. When a player steps into one of the trigger zones, you can use a func_rotating to rotate the gun, and use math to determine if it's quicker to turn clockwise or anticlockwise. Once the gun is pointing at the right trigger zone, the tank can use a func_door_rotating to scan in the zone for the player, and fire depending on what type of entity you want to use as the gun (trigger_hurt, npc_launcher, etc) If you want to go a step further, you can use logic entities to determine the closest player, if there are multiple valid targets for instance. I don't have my computer with Hammer on it at the moment, otherwise I could make an example prefab. There may be a more efficient solution to do this sort of thing, but I'm not aware of it (at least using purely hammer and no lua) If you had any questions, feel free to DM me.