reality bites  
 the problem  
   solutions?  
  the scripts   
  the .zip file  
prefabs 'office' [email protected]


  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 beliving
 he actually carried a turret (or two in our case) from point A to point B.

  a. The harsh reality of 'Take 1'

  

  Yes! Yes! There are actually 8 turrets there! The mere fact that you can 
 see only two helped me to create the ilusion 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.

  b. 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?

  c. 'Take 1' solution
  The stucture I settled for a portable turret had three elements:
  

   - the turret itself
   - two switches:
     - one that made the turret visible and active; 
       layed 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:

 - 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:

 - 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:

   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 (meaning
  that 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: However, as soon as we drop below 2 (at least one turret picked up) we should unhide all the TShow switches: 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 :)
index