receptor/wall trigger

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
RayB
Posts: 140
Joined: Fri Mar 06, 2015 3:45 am

receptor/wall trigger

Post 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.
User avatar
Zo Kath Ra
Posts: 944
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: receptor/wall trigger

Post by Zo Kath Ra »

This entityType works for me:
fireball_large
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: receptor/wall trigger

Post 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).
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
RayB
Posts: 140
Joined: Fri Mar 06, 2015 3:45 am

Re: receptor/wall trigger

Post 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?
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: receptor/wall trigger

Post 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.
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: receptor/wall trigger

Post 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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply