alertentity not working right


(G0-Gerbil) #21

The idea is you set an accum or bit of it to indicate the door is moving (you set it when it’s activated, and reset it when it’s finished moving).
Any other action must check against this flag, if it’s moving, either react differently or stop.


(Loffy) #22

When game starts, an accum or globalaccum is set to 1 (or 0, 2 up to 9).

EB has coded an example above:


tunnelgate_trigger 
{ 
   spawn 
   { 
      accum 1 set 1 
.... continue code here

In my mapping, whenever an entity is activated (I’ve not yet tried a func door rotating, but it might work) it triggers a target script trigger (tst). The tst will activate a section in the script. At the top of that script, there is a code that checks the accum or globalaccum (see below). If it is not 1, the code will not be executed. I can use bits of EB’s code for this to work.

EB writes:


   trigger up 
   { 
         accum 1 abort_if_not_equal 1 
...continue

The next thing, in that script section, that I would do is to give the accum or globalaccum a new value, for example 0 (see below):

Loffy-code, inspired by EB:


  trigger up 
   { 
         accum 1 abort_if_not_equal 1 
         accum 1 set 0 // New accum value.
...continue

Then the action is performed. (A gate is opened or a script mover moves or anything you want to happen in the map). The last thing in this script section is a command that gives the accum or globalaccum its initial value again (below):

The entire block:


  trigger up 
   { 
         accum 1 abort_if_not_equal 1 
         accum 1 set 0 // New accum value.
         trigger tunnelgate_lever up 
         wait 5000
         accum 1 set 1 // Accum value is reset.
   } 

In sum: entity (perhaps func_door_rotating?) > target_script_trigger > accum or globalaccum is changed > action is performed (e.g. a script mover moves) > wait 5000 > accum globalaccum is changed back.

A good way to learn more about target_script_triggers (tst) is to open a .map file, fly around and locate a tst. What is its scriptname? Find that section of script in the script. Look at the tst in the map. It will have a target. That target is also in the tst’s script. When the tst is activated, that section of the script will be executed.
Bend those brushes!
//Loffy


(EB) #23

Make any more sense to you yet Denizsi ? Loffy tends to explain things better than I do most times. :smiley:


(Loffy) #24

The thing that really helped me, was the fact that I could open maps and look at target_script_triggers (and their script). After that, I’ve used tons of those entities. :slight_smile: