I´ve made a simple trap. Works beautiful^^
No special animations, it is only a simple pressure plate with an extra floor model.
Elements needed for usage:
- 2 models - floor tile with holes and spikes as PressurePlate (included in the dm pack update)
- 2 pressure plate animations - up and down state
- 2 Scripts - 1x for Pr.Plate to set damage and pain sound, 1x for set trap sounds.
- 3 new sound effects: 1x party pain, 1x spikes up, 1x spikes down
PressurePlate "dm_spikes_floortrap" settings:
The 'silent' setting prevents the trap from play original plate sounds.
Script entity "spTrapevent" to connect to "dm_spikes_floortrap":
Code: Select all
-- Script 'spTrapevent'
-- Sets amount of damage and pain sound
-- Set connector from 'trap' PressurePlates to this script!
function SetPartyDmg(self)
if self:isDown() then
damageTile(self.level, self.x, self.y, self.facing, 6, "physical", 5)
playSoundAt("dm_party_pain", self.level, self.x, self.y)
else return false
end
end
Script entity "TrapSetSnd" to set trap sounds dungeon-wide:
Code: Select all
-- Script 'TrapSetSnd'
-- Sets new sounds to pressure plate actions
-- Placed at first level
--begin---------------------------------------------
-- Set connectors to PressurePlate(s) in dungeon
for m = 1, getMaxLevels() do
for f in allEntities(m) do
if f.class == "PressurePlate" then
f:addConnector('any', 'TrapSetSnd', 'playPplSnd')
end
end
end
-- The function to play custom sounds
function playPplSnd(self)
local PplLevl = self.level
local PplNam = self.name
local PplPosX = self.x
local PplPosY = self.y
-- play sounds for each state
if self:isDown() and PplNam == 'dm_spikes_floortrap' then
playSoundAt("dm_spikeblade_up", PplLevl, PplPosX, PplPosY)
elseif self:isDown() and PplNam == 'dm_spikes_floortrap_we' then
playSoundAt("dm_spikeblade_up", PplLevl, PplPosX, PplPosY)
elseif self:isUp() and PplNam == 'dm_spikes_floortrap' then
playSoundAt("dm_spikeblade_down", PplLevl, PplPosX, PplPosY)
elseif self:isUp() and PplNam == 'dm_spikes_floortrap_we' then
playSoundAt("dm_spikeblade_down", PplLevl, PplPosX, PplPosY)
end
end
--end-----------------------------------------------
As said, this is very simple but easy to manage^^
I have send the models to AdrTru, so he may come up with real animated spikes..