Need some scripting help


(Avoc) #1

So, I really like to make maps, but I really suck in bringing them to life via scripting. I may be able to add all the nice small details, ambience, atmosphere and so on in the world, but I am not able to script for the life of me :frowning:

Anyways, long story short, for now, I need to get 2 things scripted.

  1. There is going to be a tank in the map, but not one you can mount or escort. When either an allied or axis player gets close to it (or gets inside the trigger brush) I want it to shoot at a building and destroy it (and if we’re to be really fancy, maybe even add some turret turning).
    The building has two states, like most damageable walls (oasis etc.) with one solid state, with the debris hidden, and one destroyed state, with the debris visible. But the question is, how do I do it?

  2. I have scattered a few car models around the map which can provide cover on the loney streets of my map. I would, however, like to make them explodable. I don’t know if any of you have tried a map called “six flags” by 2bit, but in that map there are some deer which, upon a few solid hits, explode and kill everything within its blast radius.
    How do I achieve this, maybe only make the car models destroyable by explosive damage.


(Boosted) #2

the second one is easy and doesnt need scripting.
simply make it a func_explosive.


(Avoc) #3

You can make models act as func_explosives? But how do I make it explode, and more interesting, how can I make it damageable only by explosives?


(Boosted) #4

yes, models can be used with func_explosive.

i think to make it that it only takes damage from explosives it really needs scripting.
but dont take my word for it, im a beginner too :slight_smile:


(S14Y3R) #5

Hi there. First off, don’t be intimidated by scripting. Its relatively easy, you just need to think in logical steps.

For the basics, there are great sites around made by mappers for mappers, to help you understand scripting and how to get what you want.

Definately bookmark these :slight_smile:

2bits tutes:
http://www.pythononline.co.uk/et/tutorial.htm

EB has great prefabs of working scripts, along with explanations and examples of the “other” entities.
http://www.spyjuice.com/tutorials_et.html

I think Hummer’s the author of this whicked pdf:
http://4newbies.planetwolfenstein.gamespy.com/Map_Scripting_4_Newbies.pdf

Erik-Ftn’s site “Scripting for total newbies.”:
http://user.tninet.se/~fzo823r/scripting.htm

These will give you a good basic understanding of things.

What you’ll need to focus on for your objectives, so you can search for proper techniques or examples, or ask more specific questions :stuck_out_tongue:

  1. Stationary Tank is easy enough, I’ll assume that when the allies “fire” it will point one direction, and the Axis will turn and fire at another building. right? k, so to start you’ll need a trigger_multiple(targetname/scriptname axis/allied_trigger, or something) for each team. with each of those targetting a target_script_trigger(targetname/scriptname axis/allied_event, or something). The target_script_trigger will basically call script to destroy your building walls using setstate commands. (Will the walls be reconstructable?)
    eg. Axis enters trigger_multiple which tells the target_script_trigger to call its script_block. In your block you’ll have something like:

target_script_trigger //axis_event
{
   spawn
   {
      wait 250
      setstate wall_1 default //buildings to map start default
      setstate wall_2 invisible
   }

   trigger run //this gets called by the trigger_multiple
   {
      trigger tank fire_axis
   }
}

tank //static script_mover
{
   trigger fire_axis
   {
      playsound path/to/sound/fire.wav
      faceangles 0 0 10 1000 wait //point where you'd like
      setstate wall_default invisible // remove good walls
      setstate wall_destroyed default // show damaged walls
      alertentity trigger_effect //smoke and fire
   }
   
   trigger fire_allies
   {
      same, just for allied destruction sequence :)
   }
}

So something along those lines should do the trick. You’ll just need to set accum abort_if_not_equal values, so said explosion isn’t retriggered infinately :stuck_out_tongue: Have a look at any scripted door to go about this.

Heh heh, so for #2, I’m not sure what 2bit did with his deer(haven’t seen yet) but its probably along the lines of a func_consructable alerting a trigger_hurt(to kill all in area) and a couple target_effect entity’s(for actual explosion).
func_constructibles can be set up for -any dmg(gun/nad/panzer) or -satchel only, or -dyno only. the latter will just do normal damage to something set up to be “shot”

That should get the ball rolling for you. Just remember to think in logical steps. like the tank. you walk in a trigger, the trigger calls some script, the script does the actual “setstating” and sound playing, etc.

gl. 8)


(Avoc) #6

Many thanks to you good sir! :slight_smile:

As for the tank, I just wanted it to shoot in one direction, into one building, no matter which team approached it, because the building it was suppose to damage should block the road so that I could narrow down the map in a more creative way.

And thanks for all the tutorials, seems like I have some midnight reading to do :smiley:


(Avoc) #7

Btw, I expect that I have to use a game_model and not a misc_model, right?