Nero44 wrote:Can a floor trigger only be activated when the party is facing in a certain direction ?
Here are two methods.
For the the first you define this particular floor_trigger as a custom object.
Code: Select all
defineObject{
name = "floor_trigger_checked",
baseObject = "floor_trigger",
components = {
{
class = "FloorTrigger",
onActivate = function(self) if party.facing ~= self.go.facing then return false end end,
},
},
}
Alternatively, you can connect the floor_trigger to a script_entity, and call the connection manually:
Code: Select all
function faceCheck(self)
if party.facing == self.go.facing then
my_door.door:open()
end
end
*In both cases, it's setup that the facing of the floor_trigger, is the facing it checks for, before activating.
The floor_trigger should be set to only trigger for the party, unless you add a condition that checks that the party is standing on the floor_trigger; (that both are in the same tile). Also these do not account for the party turning in place; that requires a party onTurn hook... which can be done easy enough, but that changes the core behavior of the floor_trigger (as does having the facing check to begin with).
______________
Kuro01 wrote:Anyone have imfo somewhere on how to spawn a pressure plate or a lever and then set the components and connectors?
You use the Spawn function, and then call the spawned object's addConnector function, and give it the parameters to indicate how and what to connect to.
Example:
Code: Select all
spawn("dungeon_pressure_plate",1, 15,15,0,0).floortrigger
:addConnector("onActivate", spawn("dungeon_door_iron",1,15,15,0,0).id, "open")
A more clear example:
Code: Select all
spawn("dungeon_pressure_plate",1, 15,15,0,0, "my_plate")
spawn("dungeon_door_iron",1,15,15,0,0, "my_door")
my_plate.floortrigger:addConnector("onActivate", "my_door", "open")
*They both do the same thing.