Anti-tank Gun like in Venice


(mal^d^man) #1

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?


(mal^d^man) #2

:bump:


(Orange) #3

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.


(nUllSkillZ) #4

May be you can also ask chavo_one himself:
http://chavo-one.com/


(Oxygen - o2) #5

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


(chavo_one) #6

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:

  1. player triggers the gun.
  2. If the player is not a soldier, don’t fire.
  3. If the gun has been fired within the last 10 seconds, don’t fire.
  4. If the tank is out of range, don’t fire.
  5. else Fire

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:

  1. one of 4 different churchill_flash models are toggled on and back off depending on which angle the gun is pointed.
  2. If the shot missed, one of 7 different target_effects are alerted depending on the angle the gun is pointed. These are placed in different areas around the courtyard.
  3. If the shot hit, the target_effect attached to the tank is alerted, and the tank is damaged. This is what actually damages the tank and anyone near it.

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.


(mal^d^man) #7

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