Portable sentry guns

Let’s make one thing clear. ALL pickups in DEdit that can be placed down WILL ALWAYS BE PLACED DOWN IN THE SAME LOCATION THEY WERE PICKED UP. Period.

What will a regular gamer expect from a portable turret?

  • he will expect that by hitting his use key, the turet to be picked up (disappear from his view).
  • when arriving to an appropriate point, he’ll expect that by hitting his use key again, the turret will appear and become active.

That’s exactly what you have to achieve. Sure, some limitations may appear, but as long as the main thing is accomplished, it’s unlikely someone will complain. So, in ‘Take 1’ I’ll just explain how the gamer can be tricked into believing he actually carried a turret (or two in our case) from point A to point B.

The harsh reality of ‘Take 1’

turrets1

Yes! Yes! There are actually 8 turrets there! The mere fact that you can see only two helped me to create the illusion that you can carry two turrets. So, the first prefab gives you 8 possible places where you can place one of the two visible turrets.

Describing the problem

How can one modder make sure that from N possible active items [turrets] only maximum two are active at any given moment?

‘Take 1’ solution

The structure I settled for a portable turret had three elements:

turrets2

  • the turret itself
  • two switches:
  • one that made the turret visible and active; placed on the floor. Becomes invisible after it has been activated.
  • another one that made the turret inactive and invisible; placed somewhere in the air. Becomes invisible at the same time like the turret.

Initially , you only have two turrets and their THide switches visible.

So what I did was to make a turret invisible and inactive in point A (say activated THide0), and then make another turret visible and acive in point B, by activating say TShow3. The gamer would belive that he actually carried the turret from point A to point B!

However, if you also activate TShow4 (say in point C) and TShow7 (in point E) you’ll have 3 visible turrets. But you only had two turrets! A counter is needed.
The final structure had 8 turrets each with their two switches, an event counter and two triggers (one hiding all TShow switches and another one showing them).
You should scatter the 8 turrets across the map.

The scripts

The switches have to send only one message, either they are triggered open or close. So, I locked all the switches and used the ‘Locked command’. Here are the strings for a THide switch:

turrets3

  • we decrement the counter that counts how many turrets are available
  • we inactivate the turret and hide both the turret and the switch.
  • make visible the corresponding TShow switch (the location is now available to ‘place’ the turret you’re ‘carrying’)

and a TShow switch:

turrets4

  • we say that we placed another turret ->increment the counter that counts how many turrets are available
  • we unhide both the turret and the switch. Turn on the turret – make invisible the corresponding THide switch (you already picked up the turret, you can’t pick it up again!)

The script for the EventCounter (named here TurretCount0) is the following:

turrets5

Sure, the starting value is not a script component. However, if you bare in mind that you need only a given number of turrets visible, setting this at 2 will tell us that when we reach 2, there shouldn’t be any TShow switches visible (all the turrets are placed). As soon as we drop below 2 (meaningvthat we’ve picked up a turret), we should show all the TShow switches.

If you don’e belive me, take a look at the script for the switches again: THide (pick-up) decrements the counter and TShow (put down) increments it. So, when we reach 2 through incremental ascension, we’ll hide all the TShow switches:

turrets6

However, as soon as we drop below 2 (at least one turret picked up) we should unhide all the TShow switches:

turrets7

HideAll0 is a trigger that sends the message (hidden 1) to all the TShow switches (TShow0, TShow1 etc.) so that after you’ve placed all your turrets you won’t be allowed to even try to place more turrets than initially visible.

ShowAll0 does exactly the opposite. Right after you pick up one turret, this trigger will send the message (hidden 0) to all the TShow switches; this way you’ll be alowed to place it down.

That’s about it. Feel free to use the prefab. The .zip file is here. (” … I push my fingers into my eyes … “) Best of luck, and I HOPE YOU’LL MAKE IT 🙂

09th of September 2006: Sentry gun prefab update [March 2005]

The update regarding ‘NEVERDESTROY’:
It seems that although the sentries are set to neverdestroy, at least in MP
they can be destroyed [it seems that also taking the map with them 😦 ].

Actually, the problem resides in the AIButes.txt file.
You should increase the hitpoints for the base turret:

..............
 [BasicTurret]
 HitPoints = 1000000.0

BurstSpeed = 10

AwakeSound = "Sounds\Events\Ed_SentryTurn01.wav"
 DetectSound =
 "Sounds\Weapons\Marine\SADAR\sadarlock.wav"
 MoveSound = "Sounds\Events\Ed_SentryTurn01.wav"
 ..............

This should keep them from beeing destroyed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s