hello i want to make a map that has an anti-tank gun just like venice where it is shot and the tank is damaged.
can someone explain to me what i would have to do to make that work?
hello i want to make a map that has an anti-tank gun just like venice where it is shot and the tank is damaged.
can someone explain to me what i would have to do to make that work?
I don’t know how to do this but did you try the search button?
Just scroll up and look carefully, you’ll find it.
look in the map script and ask chavo for the surce, see how it works and then build ur own, but dont just copy and paste it cos thats lame
I hesitated to reply to this request because the anti-tank gun in venice was the hardest thing I have ever done regarding scripting. It was much harder than a tank/truck/boat because the gun had to know where the tank was at all times so that it could rotate to the correct angle to point at the tank. I don’t have the time to write up a proper tutorial so all I can offer is a general overview of the entities used, and you will have to do alot of hard work on your own to match those up with the map’s script.
Basically I set up the gun similar to a moving vehicle. Here’s a list of the entities, their scriptname in the map, and a description of their use:
at_gun[script_mover]: clip brush representation of the gun
gun_build[trigger_objective_info]: trigger for the gun to appear on the command map
gun_construct[func_constructible]: hidden in the map similar to the tank in goldrush
fire_gun_trigger[trigger_multiple]: trigger used by player to fire the gun
gun_enabler[target_script_trigger]: used by the trigger_multiple to access the script
gun_disabler[target_script_trigger]: disabler works the same way as on a vehicle (is targeted by a func_timer)
gun_axis[path_corner]: the gun is sent to this marker at spawn
But the magic all happens in the script which you already have since you are asking this question. Here is the logic flow when a player tries to fire the gun:
Then there is a bunch of logic to dictate whether the gun got a clear shot and hit the tank. I drew imaginary lines from the gun barrel to the various tank spline points, and grouped them into “hit” groups and “miss” groups.
When a shot is fired:
Like I said, it’s pretty complicated so good luck. If you don’t like scripting you won’t get very far with the concept. Here’s a quick editor shot showing the gun and its entities. Notice the four flash models and how they are positioned so I can turn them visible and invisible depending on how the gun fired.

Oh, I almost forgot…to rotate the gun around a central axis, you will have to use the gun model provided with venice. The Splash Damage gun model has its origin out along the length of the barrel, which makes rotation around a point virtually impossible. I edited the model and moved the origin to a more sensible spot for rotation purposes.
thanks for reply chavo, it helped alot to understand your script since i dont have the .map file to refer to
i will get cracking and see if i manage or not