Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Hareesun

I'm having this problem that I just can't seem to figure out. For some reason my triggers seem to be auto-firing.

Even if I use the default trigger and level changer from the Biolab Entity pack.

...
    check: function (other) {
      if (!this.collide) {
        this.collided();
      }
    },
    collided: function () {
      this.collide = true;
      console.log('this fires as soon as the level has loaded');
    },
...

EDIT: I've just done it, but it's not perfect by any means.
    update: function(){
      if (this.distanceTo(ig.game.player) < 4) {
        if (!this.collide) {
          this.collided();
        }
      }
      this.parent();
    },
    collided: function () {
      this.collide = true;
      console.log('this doesnt fire immediately');
    }

1 decade ago by dominic

I'm not sure I understand your problem. What do you mean with "firing"? What is the trigger supposed to do?

If you use the EntityTrigger from the Biolab Entity Pack, you shouldn&039;t need to change it's source at all; you don't need to overwrite the #check() method.

Instead, you place the trigger in your level somewhere and connect it with the entity that should be triggered, when some other entity walks into the trigger. I.e. set the target.1 property of the trigger to someName and give the target entity the name someName. Weltmeister should draw a line between those entities to indicate that they are connected.

In the entity that should do something, when it is triggered by the trigger, you&039;d have a #triggeredBy() method.

There's also some more info in the trigger.js file itself:
/*
This entity calls the triggeredBy( entity, trigger ) method of each of its
targets. #entity# is the entity that triggered this trigger and #trigger# 
is the trigger entity itself.


Keys for Weltmeister:

checks
	Specifies which type of entity can trigger this trigger. A, B or BOTH 
	Default: A

wait
	Time in seconds before this trigger can be triggered again. Set to -1
	to specify "never" - e.g. the trigger can only be triggered once.
	Default: -1
	
target.1, target.2 ... target.n
	Names of the entities whose triggeredBy() method will be called.
*/

1 decade ago by Hareesun

Wow. I'm a complete idiot. I had the trigger resting over an entity that I hadn't altered ig.Entity.TYPE on. Had it checking against A while it was on top of an A.

SIGH
Page 1 of 1
« first « previous next › last »