Page 1 of 1

receptor/wall trigger

Posted: Sat Sep 10, 2016 11:31 pm
by RayB
I have placed a receptor (and also tried a wall trigger) in my dungeon to open a door when triggered by a spell.

If I type 'poison_bolt' into the entityType box and blast a poison bolt at it, it works just fine.

If I type 'fireball' into the entityType box and blast a fireball at it, it does not work. I have tried fireball, fireball_small, etc. but I cannot get it to work shooting a fireball at it.

What prey tell is going on?

Any help would be appreciated.

Re: receptor/wall trigger

Posted: Sun Sep 11, 2016 12:38 am
by Zo Kath Ra
This entityType works for me:
fireball_large

Re: receptor/wall trigger

Posted: Sun Sep 11, 2016 11:37 am
by minmay
There is no object defined as "fireball" in the standard assets.

You probably want to connect the WallTrigger to a script entity function and check if the triggering projectile's GameObject is named "fireball_small", "fireball_medium", or "fireball_large" (all three of which can be created by the Fireball spell, depending on the champion's skill level/CastSpellComponent power).

Re: receptor/wall trigger

Posted: Mon Sep 12, 2016 10:52 pm
by RayB
How do you connect the wall_trigger/receptor to a script which checks to see what type fireball was cast when you need to know what type fireball was cast in the first place in order to trigger the receptor and run the script?

Re: receptor/wall trigger

Posted: Mon Sep 12, 2016 11:23 pm
by zimberzimber
RayB wrote:How do you connect the wall_trigger/receptor to a script which checks to see what type fireball was cast when you need to know what type fireball was cast in the first place in order to trigger the receptor and run the script?
You don't have to connect the receptor to anything to check which projectile it receives, you just input the name of the entity to hit it for it to trigger.
Image

Each fireball is a separate entity, so you would input the type of fireball you wish the receptor to respond to.

Re: receptor/wall trigger

Posted: Tue Sep 13, 2016 12:56 am
by minmay
RayB wrote:How do you connect the wall_trigger/receptor to a script which checks to see what type fireball was cast when you need to know what type fireball was cast in the first place in order to trigger the receptor and run the script?
Place a script_entity (or your preferred object with both a ScriptComponent named "script" and a ScriptControllerComponent named "controller"). In its source, define a function named "checkReceptor" or whatever you prefer, which does the check I mentioned. Example:

Code: Select all

function checkReceptor(walltrigger, projectile)
  if projectile.go.name == "fireball_small" or projectile.go.name == "fireball_medium" or projectile.go.name == "fireball_large" then
    receptor_door_1.controller:toggle()
  end
end
Place the object with the WallTriggerComponent. Select the pointer tool. Click on the object you just placed. On the panel on the right, look for the component named "walltrigger" (or whatever the name of your WallTriggerComponent is). You should see a spot to enter the entityType. Enter "any" so that it triggers for any projectile that hits it. Under "connectors", you'll see a '+' button. Click on that button, then click on the script_entity you placed earlier. This creates a connector from the WallTriggerComponent to a function in the ScriptComponent. Make sure the connector's action is set to "checkReceptor" or whatever you defined your function as.